Context stringlengths 57 92.3k | file_name stringlengths 21 79 | start int64 14 3.67k | end int64 18 3.69k | theorem stringlengths 25 2.71k | proof stringlengths 5 10.6k |
|---|---|---|---|---|---|
import Mathlib.Analysis.NormedSpace.BoundedLinearMaps
import Mathlib.Topology.FiberBundle.Basic
#align_import topology.vector_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
noncomputable section
open scoped Classical
open Bundle Set
open scoped Topology
variable (R : Type*) {B : Type*} (F : Type*) (E : B → Type*)
section TopologicalVectorSpace
variable {F E}
variable [Semiring R] [TopologicalSpace F] [TopologicalSpace B]
protected class Pretrivialization.IsLinear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)]
[∀ x, Module R (E x)] (e : Pretrivialization F (π F E)) : Prop where
linear : ∀ b ∈ e.baseSet, IsLinearMap R fun x : E b => (e ⟨b, x⟩).2
#align pretrivialization.is_linear Pretrivialization.IsLinear
variable [TopologicalSpace (TotalSpace F E)]
protected class Trivialization.IsLinear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)]
[∀ x, Module R (E x)] (e : Trivialization F (π F E)) : Prop where
linear : ∀ b ∈ e.baseSet, IsLinearMap R fun x : E b => (e ⟨b, x⟩).2
#align trivialization.is_linear Trivialization.IsLinear
namespace Trivialization
variable (e : Trivialization F (π F E)) {x : TotalSpace F E} {b : B} {y : E b}
protected theorem linear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)]
[∀ x, Module R (E x)] [e.IsLinear R] {b : B} (hb : b ∈ e.baseSet) :
IsLinearMap R fun y : E b => (e ⟨b, y⟩).2 :=
Trivialization.IsLinear.linear b hb
#align trivialization.linear Trivialization.linear
instance toPretrivialization.isLinear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)]
[∀ x, Module R (E x)] [e.IsLinear R] : e.toPretrivialization.IsLinear R :=
{ (‹_› : e.IsLinear R) with }
#align trivialization.to_pretrivialization.is_linear Trivialization.toPretrivialization.isLinear
variable [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
def linearEquivAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) (hb : b ∈ e.baseSet) :
E b ≃ₗ[R] F :=
e.toPretrivialization.linearEquivAt R b hb
#align trivialization.linear_equiv_at Trivialization.linearEquivAt
variable {R}
@[simp]
theorem linearEquivAt_apply (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) (v : E b) : e.linearEquivAt R b hb v = (e ⟨b, v⟩).2 :=
rfl
#align trivialization.linear_equiv_at_apply Trivialization.linearEquivAt_apply
@[simp]
theorem linearEquivAt_symm_apply (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) (v : F) : (e.linearEquivAt R b hb).symm v = e.symm b v :=
rfl
#align trivialization.linear_equiv_at_symm_apply Trivialization.linearEquivAt_symm_apply
variable (R)
protected def symmₗ (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : F →ₗ[R] E b :=
e.toPretrivialization.symmₗ R b
#align trivialization.symmₗ Trivialization.symmₗ
variable {R}
theorem coe_symmₗ (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) :
⇑(e.symmₗ R b) = e.symm b :=
rfl
#align trivialization.coe_symmₗ Trivialization.coe_symmₗ
variable (R)
protected def linearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : E b →ₗ[R] F :=
e.toPretrivialization.linearMapAt R b
#align trivialization.linear_map_at Trivialization.linearMapAt
variable {R}
theorem coe_linearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) :
⇑(e.linearMapAt R b) = fun y => if b ∈ e.baseSet then (e ⟨b, y⟩).2 else 0 :=
e.toPretrivialization.coe_linearMapAt b
#align trivialization.coe_linear_map_at Trivialization.coe_linearMapAt
theorem coe_linearMapAt_of_mem (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) : ⇑(e.linearMapAt R b) = fun y => (e ⟨b, y⟩).2 := by
simp_rw [coe_linearMapAt, if_pos hb]
#align trivialization.coe_linear_map_at_of_mem Trivialization.coe_linearMapAt_of_mem
theorem linearMapAt_apply (e : Trivialization F (π F E)) [e.IsLinear R] {b : B} (y : E b) :
e.linearMapAt R b y = if b ∈ e.baseSet then (e ⟨b, y⟩).2 else 0 := by
rw [coe_linearMapAt]
#align trivialization.linear_map_at_apply Trivialization.linearMapAt_apply
theorem linearMapAt_def_of_mem (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) : e.linearMapAt R b = e.linearEquivAt R b hb :=
dif_pos hb
#align trivialization.linear_map_at_def_of_mem Trivialization.linearMapAt_def_of_mem
theorem linearMapAt_def_of_not_mem (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∉ e.baseSet) : e.linearMapAt R b = 0 :=
dif_neg hb
#align trivialization.linear_map_at_def_of_not_mem Trivialization.linearMapAt_def_of_not_mem
theorem symmₗ_linearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] {b : B} (hb : b ∈ e.baseSet)
(y : E b) : e.symmₗ R b (e.linearMapAt R b y) = y :=
e.toPretrivialization.symmₗ_linearMapAt hb y
#align trivialization.symmₗ_linear_map_at Trivialization.symmₗ_linearMapAt
theorem linearMapAt_symmₗ (e : Trivialization F (π F E)) [e.IsLinear R] {b : B} (hb : b ∈ e.baseSet)
(y : F) : e.linearMapAt R b (e.symmₗ R b y) = y :=
e.toPretrivialization.linearMapAt_symmₗ hb y
#align trivialization.linear_map_at_symmₗ Trivialization.linearMapAt_symmₗ
variable (R)
def coordChangeL (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] (b : B) :
F ≃L[R] F :=
{ toLinearEquiv := if hb : b ∈ e.baseSet ∩ e'.baseSet
then (e.linearEquivAt R b (hb.1 : _)).symm.trans (e'.linearEquivAt R b hb.2)
else LinearEquiv.refl R F
continuous_toFun := by
by_cases hb : b ∈ e.baseSet ∩ e'.baseSet
· rw [dif_pos hb]
refine (e'.continuousOn.comp_continuous ?_ ?_).snd
· exact e.continuousOn_symm.comp_continuous (Continuous.Prod.mk b) fun y =>
mk_mem_prod hb.1 (mem_univ y)
· exact fun y => e'.mem_source.mpr hb.2
· rw [dif_neg hb]
exact continuous_id
continuous_invFun := by
by_cases hb : b ∈ e.baseSet ∩ e'.baseSet
· rw [dif_pos hb]
refine (e.continuousOn.comp_continuous ?_ ?_).snd
· exact e'.continuousOn_symm.comp_continuous (Continuous.Prod.mk b) fun y =>
mk_mem_prod hb.2 (mem_univ y)
exact fun y => e.mem_source.mpr hb.1
· rw [dif_neg hb]
exact continuous_id }
set_option linter.uppercaseLean3 false in
#align trivialization.coord_changeL Trivialization.coordChangeL
variable {R}
theorem coe_coordChangeL (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e.baseSet ∩ e'.baseSet) :
⇑(coordChangeL R e e' b) = (e.linearEquivAt R b hb.1).symm.trans (e'.linearEquivAt R b hb.2) :=
congr_arg (fun f : F ≃ₗ[R] F ↦ ⇑f) (dif_pos hb)
set_option linter.uppercaseLean3 false in
#align trivialization.coe_coord_changeL Trivialization.coe_coordChangeL
theorem coe_coordChangeL' (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e.baseSet ∩ e'.baseSet) :
(coordChangeL R e e' b).toLinearEquiv =
(e.linearEquivAt R b hb.1).symm.trans (e'.linearEquivAt R b hb.2) :=
LinearEquiv.coe_injective (coe_coordChangeL _ _ hb)
set_option linter.uppercaseLean3 false in
#align trivialization.coe_coord_changeL' Trivialization.coe_coordChangeL'
theorem symm_coordChangeL (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e'.baseSet ∩ e.baseSet) : (e.coordChangeL R e' b).symm = e'.coordChangeL R e b := by
apply ContinuousLinearEquiv.toLinearEquiv_injective
rw [coe_coordChangeL' e' e hb, (coordChangeL R e e' b).symm_toLinearEquiv,
coe_coordChangeL' e e' hb.symm, LinearEquiv.trans_symm, LinearEquiv.symm_symm]
set_option linter.uppercaseLean3 false in
#align trivialization.symm_coord_changeL Trivialization.symm_coordChangeL
theorem coordChangeL_apply (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e.baseSet ∩ e'.baseSet) (y : F) :
coordChangeL R e e' b y = (e' ⟨b, e.symm b y⟩).2 :=
congr_fun (coe_coordChangeL e e' hb) y
set_option linter.uppercaseLean3 false in
#align trivialization.coord_changeL_apply Trivialization.coordChangeL_apply
theorem mk_coordChangeL (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e.baseSet ∩ e'.baseSet) (y : F) :
(b, coordChangeL R e e' b y) = e' ⟨b, e.symm b y⟩ := by
ext
· rw [e.mk_symm hb.1 y, e'.coe_fst', e.proj_symm_apply' hb.1]
rw [e.proj_symm_apply' hb.1]
exact hb.2
· exact e.coordChangeL_apply e' hb y
set_option linter.uppercaseLean3 false in
#align trivialization.mk_coord_changeL Trivialization.mk_coordChangeL
theorem apply_symm_apply_eq_coordChangeL (e e' : Trivialization F (π F E)) [e.IsLinear R]
[e'.IsLinear R] {b : B} (hb : b ∈ e.baseSet ∩ e'.baseSet) (v : F) :
e' (e.toPartialHomeomorph.symm (b, v)) = (b, e.coordChangeL R e' b v) := by
rw [e.mk_coordChangeL e' hb, e.mk_symm hb.1]
set_option linter.uppercaseLean3 false in
#align trivialization.apply_symm_apply_eq_coord_changeL Trivialization.apply_symm_apply_eq_coordChangeL
theorem coordChangeL_apply' (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R] {b : B}
(hb : b ∈ e.baseSet ∩ e'.baseSet) (y : F) :
coordChangeL R e e' b y = (e' (e.toPartialHomeomorph.symm (b, y))).2 := by
rw [e.coordChangeL_apply e' hb, e.mk_symm hb.1]
set_option linter.uppercaseLean3 false in
#align trivialization.coord_changeL_apply' Trivialization.coordChangeL_apply'
theorem coordChangeL_symm_apply (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R]
{b : B} (hb : b ∈ e.baseSet ∩ e'.baseSet) :
⇑(coordChangeL R e e' b).symm =
(e'.linearEquivAt R b hb.2).symm.trans (e.linearEquivAt R b hb.1) :=
congr_arg LinearEquiv.invFun (dif_pos hb)
set_option linter.uppercaseLean3 false in
#align trivialization.coord_changeL_symm_apply Trivialization.coordChangeL_symm_apply
end Trivialization
end TopologicalVectorSpace
section
namespace Bundle
def zeroSection [∀ x, Zero (E x)] : B → TotalSpace F E := (⟨·, 0⟩)
#align bundle.zero_section Bundle.zeroSection
@[simp, mfld_simps]
theorem zeroSection_proj [∀ x, Zero (E x)] (x : B) : (zeroSection F E x).proj = x :=
rfl
#align bundle.zero_section_proj Bundle.zeroSection_proj
@[simp, mfld_simps]
theorem zeroSection_snd [∀ x, Zero (E x)] (x : B) : (zeroSection F E x).2 = 0 :=
rfl
#align bundle.zero_section_snd Bundle.zeroSection_snd
end Bundle
open Bundle
variable [NontriviallyNormedField R] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
[NormedAddCommGroup F] [NormedSpace R F] [TopologicalSpace B] [TopologicalSpace (TotalSpace F E)]
[∀ x, TopologicalSpace (E x)] [FiberBundle F E]
class VectorBundle : Prop where
trivialization_linear' : ∀ (e : Trivialization F (π F E)) [MemTrivializationAtlas e], e.IsLinear R
continuousOn_coordChange' :
∀ (e e' : Trivialization F (π F E)) [MemTrivializationAtlas e] [MemTrivializationAtlas e'],
ContinuousOn (fun b => Trivialization.coordChangeL R e e' b : B → F →L[R] F)
(e.baseSet ∩ e'.baseSet)
#align vector_bundle VectorBundle
variable {F E}
instance (priority := 100) trivialization_linear [VectorBundle R F E] (e : Trivialization F (π F E))
[MemTrivializationAtlas e] : e.IsLinear R :=
VectorBundle.trivialization_linear' e
#align trivialization_linear trivialization_linear
theorem continuousOn_coordChange [VectorBundle R F E] (e e' : Trivialization F (π F E))
[MemTrivializationAtlas e] [MemTrivializationAtlas e'] :
ContinuousOn (fun b => Trivialization.coordChangeL R e e' b : B → F →L[R] F)
(e.baseSet ∩ e'.baseSet) :=
VectorBundle.continuousOn_coordChange' e e'
#align continuous_on_coord_change continuousOn_coordChange
namespace Trivialization
@[simps (config := .asFn) apply]
def continuousLinearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : E b →L[R] F :=
{ e.linearMapAt R b with
toFun := e.linearMapAt R b -- given explicitly to help `simps`
cont := by
dsimp
rw [e.coe_linearMapAt b]
refine continuous_if_const _ (fun hb => ?_) fun _ => continuous_zero
exact (e.continuousOn.comp_continuous (FiberBundle.totalSpaceMk_inducing F E b).continuous
fun x => e.mem_source.mpr hb).snd }
#align trivialization.continuous_linear_map_at Trivialization.continuousLinearMapAt
@[simps (config := .asFn) apply]
def symmL (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : F →L[R] E b :=
{ e.symmₗ R b with
toFun := e.symm b -- given explicitly to help `simps`
cont := by
by_cases hb : b ∈ e.baseSet
· rw [(FiberBundle.totalSpaceMk_inducing F E b).continuous_iff]
exact e.continuousOn_symm.comp_continuous (continuous_const.prod_mk continuous_id) fun x ↦
mk_mem_prod hb (mem_univ x)
· refine continuous_zero.congr fun x => (e.symm_apply_of_not_mem hb x).symm }
set_option linter.uppercaseLean3 false in
#align trivialization.symmL Trivialization.symmL
variable {R}
theorem symmL_continuousLinearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) (y : E b) : e.symmL R b (e.continuousLinearMapAt R b y) = y :=
e.symmₗ_linearMapAt hb y
set_option linter.uppercaseLean3 false in
#align trivialization.symmL_continuous_linear_map_at Trivialization.symmL_continuousLinearMapAt
theorem continuousLinearMapAt_symmL (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) (y : F) : e.continuousLinearMapAt R b (e.symmL R b y) = y :=
e.linearMapAt_symmₗ hb y
set_option linter.uppercaseLean3 false in
#align trivialization.continuous_linear_map_at_symmL Trivialization.continuousLinearMapAt_symmL
variable (R)
@[simps (config := .asFn) apply symm_apply]
def continuousLinearEquivAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) : E b ≃L[R] F :=
{ e.toPretrivialization.linearEquivAt R b hb with
toFun := fun y => (e ⟨b, y⟩).2 -- given explicitly to help `simps`
invFun := e.symm b -- given explicitly to help `simps`
continuous_toFun := (e.continuousOn.comp_continuous
(FiberBundle.totalSpaceMk_inducing F E b).continuous fun _ => e.mem_source.mpr hb).snd
continuous_invFun := (e.symmL R b).continuous }
#align trivialization.continuous_linear_equiv_at Trivialization.continuousLinearEquivAt
variable {R}
theorem coe_continuousLinearEquivAt_eq (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) :
(e.continuousLinearEquivAt R b hb : E b → F) = e.continuousLinearMapAt R b :=
(e.coe_linearMapAt_of_mem hb).symm
#align trivialization.coe_continuous_linear_equiv_at_eq Trivialization.coe_continuousLinearEquivAt_eq
theorem symm_continuousLinearEquivAt_eq (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) : ((e.continuousLinearEquivAt R b hb).symm : F → E b) = e.symmL R b :=
rfl
#align trivialization.symm_continuous_linear_equiv_at_eq Trivialization.symm_continuousLinearEquivAt_eq
@[simp, nolint simpNF] -- `simp` can prove it but `dsimp` can't; todo: prove `Sigma.eta` with `rfl`
theorem continuousLinearEquivAt_apply' (e : Trivialization F (π F E)) [e.IsLinear R]
(x : TotalSpace F E) (hx : x ∈ e.source) :
e.continuousLinearEquivAt R x.proj (e.mem_source.1 hx) x.2 = (e x).2 := rfl
#align trivialization.continuous_linear_equiv_at_apply' Trivialization.continuousLinearEquivAt_apply'
variable (R)
theorem apply_eq_prod_continuousLinearEquivAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) (z : E b) : e ⟨b, z⟩ = (b, e.continuousLinearEquivAt R b hb z) := by
ext
· refine e.coe_fst ?_
rw [e.source_eq]
exact hb
· simp only [coe_coe, continuousLinearEquivAt_apply]
#align trivialization.apply_eq_prod_continuous_linear_equiv_at Trivialization.apply_eq_prod_continuousLinearEquivAt
protected theorem zeroSection (e : Trivialization F (π F E)) [e.IsLinear R] {x : B}
(hx : x ∈ e.baseSet) : e (zeroSection F E x) = (x, 0) := by
simp_rw [zeroSection, e.apply_eq_prod_continuousLinearEquivAt R x hx 0, map_zero]
#align trivialization.zero_section
namespace Bundle
def zeroSection [∀ x, Zero (E x)] : B → TotalSpace F E := (⟨·, 0⟩)
#align bundle.zero_open Bundle
variable [NontriviallyNormedField R] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
[NormedAddCommGroup F] [NormedSpace R F] [TopologicalSpace B] [TopologicalSpace (TotalSpace F E)]
[∀ x, TopologicalSpace (E x)] [FiberBundle F E]
class VectorBundle : Prop where
trivialization_linear' : ∀ (e : Trivialization F (π F E)) [MemTrivializationAtlas e], e.IsLinear R
continuousOn_coordChange' :
∀ (e e' : Trivialization F (π F E)) [MemTrivializationAtlas e] [MemTrivializationAtlas e'],
ContinuousOn (fun b => Trivialization.coordChangeL R e e' b : B → F →L[R] F)
(e.baseSet ∩ e'.baseSet)
#align vector_bundle VectorBundle
variable {F E}
instance (priority := 100) trivialization_linear [VectorBundle R F E] (e : Trivialization F (π F E))
[MemTrivializationAtlas e] : e.IsLinear R :=
VectorBundle.trivialization_linear' e
#align trivialization_linear trivialization_linear
theorem continuousOn_coordChange [VectorBundle R F E] (e e' : Trivialization F (π F E))
[MemTrivializationAtlas e] [MemTrivializationAtlas e'] :
ContinuousOn (fun b => Trivialization.coordChangeL R e e' b : B → F →L[R] F)
(e.baseSet ∩ e'.baseSet) :=
VectorBundle.continuousOn_coordChange' e e'
#align continuous_on_coord_change continuousOn_coordChange
namespace Trivialization
@[simps (config := .asFn) apply]
def continuousLinearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : E b →L[R] F :=
{ e.linearMapAt R b with
toFun := e.linearMapAt R b -- given explicitly to help `simps`
cont := by
dsimp
rw [e.coe_linearMapAt b]
refine continuous_if_const _ (fun hb => ?_) fun _ => continuous_zero
exact (e.continuousOn.comp_continuous (FiberBundle.totalSpaceMk_inducing F E b).continuous
fun x => e.mem_source.mpr hb).snd }
#align trivialization.continuous_linear_map_at Trivialization.continuousLinearMapAt
@[simps (config := .asFn) apply]
def symmL (e : Trivialization F (π F E)) [e.IsLinear R] (b : B) : F →L[R] E b :=
{ e.symmₗ R b with
toFun := e.symm b -- given explicitly to help `simps`
cont := by
by_cases hb : b ∈ e.baseSet
· rw [(FiberBundle.totalSpaceMk_inducing F E b).continuous_iff]
exact e.continuousOn_symm.comp_continuous (continuous_const.prod_mk continuous_id) fun x ↦
mk_mem_prod hb (mem_univ x)
· refine continuous_zero.congr fun x => (e.symm_apply_of_not_mem hb x).symm }
set_option linter.uppercaseLean3 false in
#align trivialization.symmL Trivialization.symmL
variable {R}
theorem symmL_continuousLinearMapAt (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) (y : E b) : e.symmL R b (e.continuousLinearMapAt R b y) = y :=
e.symmₗ_linearMapAt hb y
set_option linter.uppercaseLean3 false in
#align trivialization.symmL_continuous_linear_map_at Trivialization.symmL_continuousLinearMapAt
theorem continuousLinearMapAt_symmL (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) (y : F) : e.continuousLinearMapAt R b (e.symmL R b y) = y :=
e.linearMapAt_symmₗ hb y
set_option linter.uppercaseLean3 false in
#align trivialization.continuous_linear_map_at_symmL Trivialization.continuousLinearMapAt_symmL
variable (R)
@[simps (config := .asFn) apply symm_apply]
def continuousLinearEquivAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) : E b ≃L[R] F :=
{ e.toPretrivialization.linearEquivAt R b hb with
toFun := fun y => (e ⟨b, y⟩).2 -- given explicitly to help `simps`
invFun := e.symm b -- given explicitly to help `simps`
continuous_toFun := (e.continuousOn.comp_continuous
(FiberBundle.totalSpaceMk_inducing F E b).continuous fun _ => e.mem_source.mpr hb).snd
continuous_invFun := (e.symmL R b).continuous }
#align trivialization.continuous_linear_equiv_at Trivialization.continuousLinearEquivAt
variable {R}
theorem coe_continuousLinearEquivAt_eq (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) :
(e.continuousLinearEquivAt R b hb : E b → F) = e.continuousLinearMapAt R b :=
(e.coe_linearMapAt_of_mem hb).symm
#align trivialization.coe_continuous_linear_equiv_at_eq Trivialization.coe_continuousLinearEquivAt_eq
theorem symm_continuousLinearEquivAt_eq (e : Trivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) : ((e.continuousLinearEquivAt R b hb).symm : F → E b) = e.symmL R b :=
rfl
#align trivialization.symm_continuous_linear_equiv_at_eq Trivialization.symm_continuousLinearEquivAt_eq
@[simp, nolint simpNF] -- `simp` can prove it but `dsimp` can't; todo: prove `Sigma.eta` with `rfl`
theorem continuousLinearEquivAt_apply' (e : Trivialization F (π F E)) [e.IsLinear R]
(x : TotalSpace F E) (hx : x ∈ e.source) :
e.continuousLinearEquivAt R x.proj (e.mem_source.1 hx) x.2 = (e x).2 := rfl
#align trivialization.continuous_linear_equiv_at_apply' Trivialization.continuousLinearEquivAt_apply'
variable (R)
theorem apply_eq_prod_continuousLinearEquivAt (e : Trivialization F (π F E)) [e.IsLinear R] (b : B)
(hb : b ∈ e.baseSet) (z : E b) : e ⟨b, z⟩ = (b, e.continuousLinearEquivAt R b hb z) := by
ext
· refine e.coe_fst ?_
rw [e.source_eq]
exact hb
· simp only [coe_coe, continuousLinearEquivAt_apply]
#align trivialization.apply_eq_prod_continuous_linear_equiv_at Trivialization.apply_eq_prod_continuousLinearEquivAt
protected theorem zeroSection (e : Trivialization F (π F E)) [e.IsLinear R] {x : B}
(hx : x ∈ e.baseSet) : e (zeroSection F E x) = (x, 0) := by
simp_rw [zeroSection, e.apply_eq_prod_continuousLinearEquivAt R x hx 0, map_zero]
#align trivialization.zero_
variable (B F)
structure VectorBundleCore (ι : Type*) where
baseSet : ι → Set B
isOpen_baseSet : ∀ i, IsOpen (baseSet i)
indexAt : B → ι
mem_baseSet_at : ∀ x, x ∈ baseSet (indexAt x)
coordChange : ι → ι → B → F →L[R] F
coordChange_self : ∀ i, ∀ x ∈ baseSet i, ∀ v, coordChange i i x v = v
continuousOn_coordChange : ∀ i j, ContinuousOn (coordChange i j) (baseSet i ∩ baseSet j)
coordChange_comp : ∀ i j k, ∀ x ∈ baseSet i ∩ baseSet j ∩ baseSet k, ∀ v,
(coordChange j k x) (coordChange i j x v) = coordChange i k x v
#align vector_bundle_core VectorBundleCore
def trivialVectorBundleCore (ι : Type*) [Inhabited ι] : VectorBundleCore R B F ι where
baseSet _ := univ
isOpen_baseSet _ := isOpen_univ
indexAt := default
mem_baseSet_at x := mem_univ x
coordChange _ _ _ := ContinuousLinearMap.id R F
coordChange_self _ _ _ _ := rfl
coordChange_comp _ _ _ _ _ _ := rfl
continuousOn_coordChange _ _ := continuousOn_const
#align trivial_vector_bundle_core trivialVectorBundleCore
instance (ι : Type*) [Inhabited ι] : Inhabited (VectorBundleCore R B F ι) :=
⟨trivialVectorBundleCore R B F ι⟩
end
section
variable [NontriviallyNormedField R] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
[NormedAddCommGroup F] [NormedSpace R F] [TopologicalSpace B] [∀ x, TopologicalSpace (E x)]
open TopologicalSpace
open VectorBundle
-- Porting note(#5171): was @[nolint has_nonempty_instance]
structure VectorPrebundle where
pretrivializationAtlas : Set (Pretrivialization F (π F E))
pretrivialization_linear' : ∀ e, e ∈ pretrivializationAtlas → e.IsLinear R
pretrivializationAt : B → Pretrivialization F (π F E)
mem_base_pretrivializationAt : ∀ x : B, x ∈ (pretrivializationAt x).baseSet
pretrivialization_mem_atlas : ∀ x : B, pretrivializationAt x ∈ pretrivializationAtlas
exists_coordChange : ∀ᵉ (e ∈ pretrivializationAtlas) (e' ∈ pretrivializationAtlas),
∃ f : B → F →L[R] F, ContinuousOn f (e.baseSet ∩ e'.baseSet) ∧
∀ᵉ (b ∈ e.baseSet ∩ e'.baseSet) (v : F), f b v = (e' ⟨b, e.symm b v⟩).2
totalSpaceMk_inducing : ∀ b : B, Inducing (pretrivializationAt b ∘ .mk b)
#align vector_prebundle VectorPrebundle
namespace ContinuousLinearMap
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NontriviallyNormedField 𝕜₂]
variable {σ : 𝕜₁ →+* 𝕜₂}
variable {B' : Type*} [TopologicalSpace B']
variable [NormedSpace 𝕜₁ F] [∀ x, Module 𝕜₁ (E x)] [TopologicalSpace (TotalSpace F E)]
variable {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕜₂ F'] {E' : B' → Type*}
[∀ x, AddCommMonoid (E' x)] [∀ x, Module 𝕜₂ (E' x)] [TopologicalSpace (TotalSpace F' E')]
variable [FiberBundle F E] [VectorBundle 𝕜₁ F E]
variable [∀ x, TopologicalSpace (E' x)] [FiberBundle F' E'] [VectorBundle 𝕜₂ F' E']
variable (F' E')
def inCoordinates (x₀ x : B) (y₀ y : B') (ϕ : E x →SL[σ] E' y) : F →SL[σ] F' :=
((trivializationAt F' E' y₀).continuousLinearMapAt 𝕜₂ y).comp <|
ϕ.comp <| (trivializationAt F E x₀).symmL 𝕜₁ x
#align continuous_linear_map.in_coordinates ContinuousLinearMap.inCoordinates
variable {F F'}
| Mathlib/Topology/VectorBundle/Basic.lean | 1,029 | 1,037 | theorem inCoordinates_eq (x₀ x : B) (y₀ y : B') (ϕ : E x →SL[σ] E' y)
(hx : x ∈ (trivializationAt F E x₀).baseSet) (hy : y ∈ (trivializationAt F' E' y₀).baseSet) :
inCoordinates F E F' E' x₀ x y₀ y ϕ =
((trivializationAt F' E' y₀).continuousLinearEquivAt 𝕜₂ y hy : E' y →L[𝕜₂] F').comp
(ϕ.comp <|
(((trivializationAt F E x₀).continuousLinearEquivAt 𝕜₁ x hx).symm : F →L[𝕜₁] E x)) := by |
ext
simp_rw [inCoordinates, ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe,
Trivialization.coe_continuousLinearEquivAt_eq, Trivialization.symm_continuousLinearEquivAt_eq]
|
import Mathlib.Init.Align
import Mathlib.Data.Fintype.Order
import Mathlib.Algebra.DirectLimit
import Mathlib.ModelTheory.Quotients
import Mathlib.ModelTheory.FinitelyGenerated
#align_import model_theory.direct_limit from "leanprover-community/mathlib"@"f53b23994ac4c13afa38d31195c588a1121d1860"
universe v w w' u₁ u₂
open FirstOrder
namespace FirstOrder
namespace Language
open Structure Set
variable {L : Language} {ι : Type v} [Preorder ι]
variable {G : ι → Type w} [∀ i, L.Structure (G i)]
variable (f : ∀ i j, i ≤ j → G i ↪[L] G j)
-- Porting note: Instead of `Σ i, G i`, we use the alias `Language.Structure.Sigma`
-- which depends on `f`. This way, Lean can infer what `L` and `f` are in the `Setoid` instance.
-- Otherwise we have a "cannot find synthesization order" error. See the discussion at
-- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/local.20instance.20cannot.20find.20synthesization.20order.20in.20porting
set_option linter.unusedVariables false in
@[nolint unusedArguments]
protected abbrev Structure.Sigma (f : ∀ i j, i ≤ j → G i ↪[L] G j) := Σ i, G i
-- Porting note: Setting up notation for `Language.Structure.Sigma`: add a little asterisk to `Σ`
local notation "Σˣ" => Structure.Sigma
abbrev Structure.Sigma.mk (i : ι) (x : G i) : Σˣ f := ⟨i, x⟩
def DirectLimit [DirectedSystem G fun i j h => f i j h] [IsDirected ι (· ≤ ·)] :=
Quotient (DirectLimit.setoid G f)
#align first_order.language.direct_limit FirstOrder.Language.DirectLimit
attribute [local instance] DirectLimit.setoid
-- Porting note (#10754): Added local instance
attribute [local instance] DirectLimit.sigmaStructure
instance [DirectedSystem G fun i j h => f i j h] [IsDirected ι (· ≤ ·)] [Inhabited ι]
[Inhabited (G default)] : Inhabited (DirectLimit G f) :=
⟨⟦⟨default, default⟩⟧⟩
namespace DirectLimit
variable [IsDirected ι (· ≤ ·)] [DirectedSystem G fun i j h => f i j h]
theorem equiv_iff {x y : Σˣ f} {i : ι} (hx : x.1 ≤ i) (hy : y.1 ≤ i) :
x ≈ y ↔ (f x.1 i hx) x.2 = (f y.1 i hy) y.2 := by
cases x
cases y
refine ⟨fun xy => ?_, fun xy => ⟨i, hx, hy, xy⟩⟩
obtain ⟨j, _, _, h⟩ := xy
obtain ⟨k, ik, jk⟩ := directed_of (· ≤ ·) i j
have h := congr_arg (f j k jk) h
apply (f i k ik).injective
rw [DirectedSystem.map_map, DirectedSystem.map_map] at *
exact h
#align first_order.language.direct_limit.equiv_iff FirstOrder.Language.DirectLimit.equiv_iff
theorem funMap_unify_equiv {n : ℕ} (F : L.Functions n) (x : Fin n → Σˣ f) (i j : ι)
(hi : i ∈ upperBounds (range (Sigma.fst ∘ x))) (hj : j ∈ upperBounds (range (Sigma.fst ∘ x))) :
Structure.Sigma.mk f i (funMap F (unify f x i hi)) ≈ .mk f j (funMap F (unify f x j hj)) := by
obtain ⟨k, ik, jk⟩ := directed_of (· ≤ ·) i j
refine ⟨k, ik, jk, ?_⟩
rw [(f i k ik).map_fun, (f j k jk).map_fun, comp_unify, comp_unify]
#align first_order.language.direct_limit.fun_map_unify_equiv FirstOrder.Language.DirectLimit.funMap_unify_equiv
theorem relMap_unify_equiv {n : ℕ} (R : L.Relations n) (x : Fin n → Σˣ f) (i j : ι)
(hi : i ∈ upperBounds (range (Sigma.fst ∘ x))) (hj : j ∈ upperBounds (range (Sigma.fst ∘ x))) :
RelMap R (unify f x i hi) = RelMap R (unify f x j hj) := by
obtain ⟨k, ik, jk⟩ := directed_of (· ≤ ·) i j
rw [← (f i k ik).map_rel, comp_unify, ← (f j k jk).map_rel, comp_unify]
#align first_order.language.direct_limit.rel_map_unify_equiv FirstOrder.Language.DirectLimit.relMap_unify_equiv
variable [Nonempty ι]
theorem exists_unify_eq {α : Type*} [Finite α] {x y : α → Σˣ f} (xy : x ≈ y) :
∃ (i : ι) (hx : i ∈ upperBounds (range (Sigma.fst ∘ x)))
(hy : i ∈ upperBounds (range (Sigma.fst ∘ y))), unify f x i hx = unify f y i hy := by
obtain ⟨i, hi⟩ := Finite.bddAbove_range (Sum.elim (fun a => (x a).1) fun a => (y a).1)
rw [Sum.elim_range, upperBounds_union] at hi
simp_rw [← Function.comp_apply (f := Sigma.fst)] at hi
exact ⟨i, hi.1, hi.2, funext fun a => (equiv_iff G f _ _).1 (xy a)⟩
#align first_order.language.direct_limit.exists_unify_eq FirstOrder.Language.DirectLimit.exists_unify_eq
theorem funMap_equiv_unify {n : ℕ} (F : L.Functions n) (x : Fin n → Σˣ f) (i : ι)
(hi : i ∈ upperBounds (range (Sigma.fst ∘ x))) :
funMap F x ≈ .mk f _ (funMap F (unify f x i hi)) :=
funMap_unify_equiv G f F x (Classical.choose (Finite.bddAbove_range fun a => (x a).1)) i _ hi
#align first_order.language.direct_limit.fun_map_equiv_unify FirstOrder.Language.DirectLimit.funMap_equiv_unify
theorem relMap_equiv_unify {n : ℕ} (R : L.Relations n) (x : Fin n → Σˣ f) (i : ι)
(hi : i ∈ upperBounds (range (Sigma.fst ∘ x))) :
RelMap R x = RelMap R (unify f x i hi) :=
relMap_unify_equiv G f R x (Classical.choose (Finite.bddAbove_range fun a => (x a).1)) i _ hi
#align first_order.language.direct_limit.rel_map_equiv_unify FirstOrder.Language.DirectLimit.relMap_equiv_unify
noncomputable instance prestructure : L.Prestructure (DirectLimit.setoid G f) where
toStructure := sigmaStructure G f
fun_equiv {n} {F} x y xy := by
obtain ⟨i, hx, hy, h⟩ := exists_unify_eq G f xy
refine
Setoid.trans (funMap_equiv_unify G f F x i hx)
(Setoid.trans ?_ (Setoid.symm (funMap_equiv_unify G f F y i hy)))
rw [h]
rel_equiv {n} {R} x y xy := by
obtain ⟨i, hx, hy, h⟩ := exists_unify_eq G f xy
refine _root_.trans (relMap_equiv_unify G f R x i hx)
(_root_.trans ?_ (symm (relMap_equiv_unify G f R y i hy)))
rw [h]
#align first_order.language.direct_limit.prestructure FirstOrder.Language.DirectLimit.prestructure
noncomputable instance instStructureDirectLimit : L.Structure (DirectLimit G f) :=
Language.quotientStructure
set_option linter.uppercaseLean3 false in
#align first_order.language.direct_limit.Structure FirstOrder.Language.DirectLimit.instStructureDirectLimit
@[simp]
theorem funMap_quotient_mk'_sigma_mk' {n : ℕ} {F : L.Functions n} {i : ι} {x : Fin n → G i} :
funMap F (fun a => (⟦.mk f i (x a)⟧ : DirectLimit G f)) = ⟦.mk f i (funMap F x)⟧ := by
simp only [funMap_quotient_mk', Quotient.eq]
obtain ⟨k, ik, jk⟩ :=
directed_of (· ≤ ·) i (Classical.choose (Finite.bddAbove_range fun _ : Fin n => i))
refine ⟨k, jk, ik, ?_⟩
simp only [Embedding.map_fun, comp_unify]
rfl
#align first_order.language.direct_limit.fun_map_quotient_mk_sigma_mk FirstOrder.Language.DirectLimit.funMap_quotient_mk'_sigma_mk'
@[simp]
theorem relMap_quotient_mk'_sigma_mk' {n : ℕ} {R : L.Relations n} {i : ι} {x : Fin n → G i} :
RelMap R (fun a => (⟦.mk f i (x a)⟧ : DirectLimit G f)) = RelMap R x := by
rw [relMap_quotient_mk']
obtain ⟨k, _, _⟩ :=
directed_of (· ≤ ·) i (Classical.choose (Finite.bddAbove_range fun _ : Fin n => i))
rw [relMap_equiv_unify G f R (fun a => .mk f i (x a)) i]
rw [unify_sigma_mk_self]
#align first_order.language.direct_limit.rel_map_quotient_mk_sigma_mk FirstOrder.Language.DirectLimit.relMap_quotient_mk'_sigma_mk'
| Mathlib/ModelTheory/DirectLimit.lean | 279 | 291 | theorem exists_quotient_mk'_sigma_mk'_eq {α : Type*} [Finite α] (x : α → DirectLimit G f) :
∃ (i : ι) (y : α → G i), x = fun a => ⟦.mk f i (y a)⟧ := by |
obtain ⟨i, hi⟩ := Finite.bddAbove_range fun a => (x a).out.1
refine ⟨i, unify f (Quotient.out ∘ x) i hi, ?_⟩
ext a
rw [Quotient.eq_mk_iff_out, unify]
generalize_proofs r
change _ ≈ .mk f i (f (Quotient.out (x a)).fst i r (Quotient.out (x a)).snd)
have : (.mk f i (f (Quotient.out (x a)).fst i r (Quotient.out (x a)).snd) : Σˣ f).fst ≤ i :=
le_rfl
rw [equiv_iff G f (i := i) (hi _) this]
· simp only [DirectedSystem.map_self]
exact ⟨a, rfl⟩
|
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.MeasureTheory.Function.SimpleFunc
import Mathlib.MeasureTheory.Measure.MutuallySingular
import Mathlib.MeasureTheory.Measure.Count
import Mathlib.Topology.IndicatorConstPointwise
import Mathlib.MeasureTheory.Constructions.BorelSpace.Real
#align_import measure_theory.integral.lebesgue from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
assert_not_exists NormedSpace
set_option autoImplicit true
noncomputable section
open Set hiding restrict restrict_apply
open Filter ENNReal
open Function (support)
open scoped Classical
open Topology NNReal ENNReal MeasureTheory
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
variable {α β γ δ : Type*}
section Lintegral
open SimpleFunc
variable {m : MeasurableSpace α} {μ ν : Measure α}
irreducible_def lintegral {_ : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : ℝ≥0∞ :=
⨆ (g : α →ₛ ℝ≥0∞) (_ : ⇑g ≤ f), g.lintegral μ
#align measure_theory.lintegral MeasureTheory.lintegral
@[inherit_doc MeasureTheory.lintegral]
notation3 "∫⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => lintegral μ r
@[inherit_doc MeasureTheory.lintegral]
notation3 "∫⁻ "(...)", "r:60:(scoped f => lintegral volume f) => r
@[inherit_doc MeasureTheory.lintegral]
notation3"∫⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => lintegral (Measure.restrict μ s) r
@[inherit_doc MeasureTheory.lintegral]
notation3"∫⁻ "(...)" in "s", "r:60:(scoped f => lintegral (Measure.restrict volume s) f) => r
theorem SimpleFunc.lintegral_eq_lintegral {m : MeasurableSpace α} (f : α →ₛ ℝ≥0∞) (μ : Measure α) :
∫⁻ a, f a ∂μ = f.lintegral μ := by
rw [MeasureTheory.lintegral]
exact le_antisymm (iSup₂_le fun g hg => lintegral_mono hg <| le_rfl)
(le_iSup₂_of_le f le_rfl le_rfl)
#align measure_theory.simple_func.lintegral_eq_lintegral MeasureTheory.SimpleFunc.lintegral_eq_lintegral
@[mono]
theorem lintegral_mono' {m : MeasurableSpace α} ⦃μ ν : Measure α⦄ (hμν : μ ≤ ν) ⦃f g : α → ℝ≥0∞⦄
(hfg : f ≤ g) : ∫⁻ a, f a ∂μ ≤ ∫⁻ a, g a ∂ν := by
rw [lintegral, lintegral]
exact iSup_mono fun φ => iSup_mono' fun hφ => ⟨le_trans hφ hfg, lintegral_mono (le_refl φ) hμν⟩
#align measure_theory.lintegral_mono' MeasureTheory.lintegral_mono'
-- workaround for the known eta-reduction issue with `@[gcongr]`
@[gcongr] theorem lintegral_mono_fn' ⦃f g : α → ℝ≥0∞⦄ (hfg : ∀ x, f x ≤ g x) (h2 : μ ≤ ν) :
lintegral μ f ≤ lintegral ν g :=
lintegral_mono' h2 hfg
theorem lintegral_mono ⦃f g : α → ℝ≥0∞⦄ (hfg : f ≤ g) : ∫⁻ a, f a ∂μ ≤ ∫⁻ a, g a ∂μ :=
lintegral_mono' (le_refl μ) hfg
#align measure_theory.lintegral_mono MeasureTheory.lintegral_mono
-- workaround for the known eta-reduction issue with `@[gcongr]`
@[gcongr] theorem lintegral_mono_fn ⦃f g : α → ℝ≥0∞⦄ (hfg : ∀ x, f x ≤ g x) :
lintegral μ f ≤ lintegral μ g :=
lintegral_mono hfg
theorem lintegral_mono_nnreal {f g : α → ℝ≥0} (h : f ≤ g) : ∫⁻ a, f a ∂μ ≤ ∫⁻ a, g a ∂μ :=
lintegral_mono fun a => ENNReal.coe_le_coe.2 (h a)
#align measure_theory.lintegral_mono_nnreal MeasureTheory.lintegral_mono_nnreal
theorem iSup_lintegral_measurable_le_eq_lintegral (f : α → ℝ≥0∞) :
⨆ (g : α → ℝ≥0∞) (_ : Measurable g) (_ : g ≤ f), ∫⁻ a, g a ∂μ = ∫⁻ a, f a ∂μ := by
apply le_antisymm
· exact iSup_le fun i => iSup_le fun _ => iSup_le fun h'i => lintegral_mono h'i
· rw [lintegral]
refine iSup₂_le fun i hi => le_iSup₂_of_le i i.measurable <| le_iSup_of_le hi ?_
exact le_of_eq (i.lintegral_eq_lintegral _).symm
#align measure_theory.supr_lintegral_measurable_le_eq_lintegral MeasureTheory.iSup_lintegral_measurable_le_eq_lintegral
theorem lintegral_mono_set {_ : MeasurableSpace α} ⦃μ : Measure α⦄ {s t : Set α} {f : α → ℝ≥0∞}
(hst : s ⊆ t) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in t, f x ∂μ :=
lintegral_mono' (Measure.restrict_mono hst (le_refl μ)) (le_refl f)
#align measure_theory.lintegral_mono_set MeasureTheory.lintegral_mono_set
theorem lintegral_mono_set' {_ : MeasurableSpace α} ⦃μ : Measure α⦄ {s t : Set α} {f : α → ℝ≥0∞}
(hst : s ≤ᵐ[μ] t) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in t, f x ∂μ :=
lintegral_mono' (Measure.restrict_mono' hst (le_refl μ)) (le_refl f)
#align measure_theory.lintegral_mono_set' MeasureTheory.lintegral_mono_set'
theorem monotone_lintegral {_ : MeasurableSpace α} (μ : Measure α) : Monotone (lintegral μ) :=
lintegral_mono
#align measure_theory.monotone_lintegral MeasureTheory.monotone_lintegral
@[simp]
theorem lintegral_const (c : ℝ≥0∞) : ∫⁻ _, c ∂μ = c * μ univ := by
rw [← SimpleFunc.const_lintegral, ← SimpleFunc.lintegral_eq_lintegral, SimpleFunc.coe_const]
rfl
#align measure_theory.lintegral_const MeasureTheory.lintegral_const
theorem lintegral_zero : ∫⁻ _ : α, 0 ∂μ = 0 := by simp
#align measure_theory.lintegral_zero MeasureTheory.lintegral_zero
theorem lintegral_zero_fun : lintegral μ (0 : α → ℝ≥0∞) = 0 :=
lintegral_zero
#align measure_theory.lintegral_zero_fun MeasureTheory.lintegral_zero_fun
-- @[simp] -- Porting note (#10618): simp can prove this
theorem lintegral_one : ∫⁻ _, (1 : ℝ≥0∞) ∂μ = μ univ := by rw [lintegral_const, one_mul]
#align measure_theory.lintegral_one MeasureTheory.lintegral_one
theorem set_lintegral_const (s : Set α) (c : ℝ≥0∞) : ∫⁻ _ in s, c ∂μ = c * μ s := by
rw [lintegral_const, Measure.restrict_apply_univ]
#align measure_theory.set_lintegral_const MeasureTheory.set_lintegral_const
theorem set_lintegral_one (s) : ∫⁻ _ in s, 1 ∂μ = μ s := by rw [set_lintegral_const, one_mul]
#align measure_theory.set_lintegral_one MeasureTheory.set_lintegral_one
theorem set_lintegral_const_lt_top [IsFiniteMeasure μ] (s : Set α) {c : ℝ≥0∞} (hc : c ≠ ∞) :
∫⁻ _ in s, c ∂μ < ∞ := by
rw [lintegral_const]
exact ENNReal.mul_lt_top hc (measure_ne_top (μ.restrict s) univ)
#align measure_theory.set_lintegral_const_lt_top MeasureTheory.set_lintegral_const_lt_top
theorem lintegral_const_lt_top [IsFiniteMeasure μ] {c : ℝ≥0∞} (hc : c ≠ ∞) : ∫⁻ _, c ∂μ < ∞ := by
simpa only [Measure.restrict_univ] using set_lintegral_const_lt_top (univ : Set α) hc
#align measure_theory.lintegral_const_lt_top MeasureTheory.lintegral_const_lt_top
section
variable (μ)
theorem exists_measurable_le_lintegral_eq (f : α → ℝ≥0∞) :
∃ g : α → ℝ≥0∞, Measurable g ∧ g ≤ f ∧ ∫⁻ a, f a ∂μ = ∫⁻ a, g a ∂μ := by
rcases eq_or_ne (∫⁻ a, f a ∂μ) 0 with h₀ | h₀
· exact ⟨0, measurable_zero, zero_le f, h₀.trans lintegral_zero.symm⟩
rcases exists_seq_strictMono_tendsto' h₀.bot_lt with ⟨L, _, hLf, hL_tendsto⟩
have : ∀ n, ∃ g : α → ℝ≥0∞, Measurable g ∧ g ≤ f ∧ L n < ∫⁻ a, g a ∂μ := by
intro n
simpa only [← iSup_lintegral_measurable_le_eq_lintegral f, lt_iSup_iff, exists_prop] using
(hLf n).2
choose g hgm hgf hLg using this
refine
⟨fun x => ⨆ n, g n x, measurable_iSup hgm, fun x => iSup_le fun n => hgf n x, le_antisymm ?_ ?_⟩
· refine le_of_tendsto' hL_tendsto fun n => (hLg n).le.trans <| lintegral_mono fun x => ?_
exact le_iSup (fun n => g n x) n
· exact lintegral_mono fun x => iSup_le fun n => hgf n x
#align measure_theory.exists_measurable_le_lintegral_eq MeasureTheory.exists_measurable_le_lintegral_eq
end
theorem lintegral_eq_nnreal {m : MeasurableSpace α} (f : α → ℝ≥0∞) (μ : Measure α) :
∫⁻ a, f a ∂μ =
⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ x, ↑(φ x) ≤ f x), (φ.map ((↑) : ℝ≥0 → ℝ≥0∞)).lintegral μ := by
rw [lintegral]
refine
le_antisymm (iSup₂_le fun φ hφ => ?_) (iSup_mono' fun φ => ⟨φ.map ((↑) : ℝ≥0 → ℝ≥0∞), le_rfl⟩)
by_cases h : ∀ᵐ a ∂μ, φ a ≠ ∞
· let ψ := φ.map ENNReal.toNNReal
replace h : ψ.map ((↑) : ℝ≥0 → ℝ≥0∞) =ᵐ[μ] φ := h.mono fun a => ENNReal.coe_toNNReal
have : ∀ x, ↑(ψ x) ≤ f x := fun x => le_trans ENNReal.coe_toNNReal_le_self (hφ x)
exact
le_iSup_of_le (φ.map ENNReal.toNNReal) (le_iSup_of_le this (ge_of_eq <| lintegral_congr h))
· have h_meas : μ (φ ⁻¹' {∞}) ≠ 0 := mt measure_zero_iff_ae_nmem.1 h
refine le_trans le_top (ge_of_eq <| (iSup_eq_top _).2 fun b hb => ?_)
obtain ⟨n, hn⟩ : ∃ n : ℕ, b < n * μ (φ ⁻¹' {∞}) := exists_nat_mul_gt h_meas (ne_of_lt hb)
use (const α (n : ℝ≥0)).restrict (φ ⁻¹' {∞})
simp only [lt_iSup_iff, exists_prop, coe_restrict, φ.measurableSet_preimage, coe_const,
ENNReal.coe_indicator, map_coe_ennreal_restrict, SimpleFunc.map_const, ENNReal.coe_natCast,
restrict_const_lintegral]
refine ⟨indicator_le fun x hx => le_trans ?_ (hφ _), hn⟩
simp only [mem_preimage, mem_singleton_iff] at hx
simp only [hx, le_top]
#align measure_theory.lintegral_eq_nnreal MeasureTheory.lintegral_eq_nnreal
theorem exists_simpleFunc_forall_lintegral_sub_lt_of_pos {f : α → ℝ≥0∞} (h : ∫⁻ x, f x ∂μ ≠ ∞)
{ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ φ : α →ₛ ℝ≥0,
(∀ x, ↑(φ x) ≤ f x) ∧
∀ ψ : α →ₛ ℝ≥0, (∀ x, ↑(ψ x) ≤ f x) → (map (↑) (ψ - φ)).lintegral μ < ε := by
rw [lintegral_eq_nnreal] at h
have := ENNReal.lt_add_right h hε
erw [ENNReal.biSup_add] at this <;> [skip; exact ⟨0, fun x => zero_le _⟩]
simp_rw [lt_iSup_iff, iSup_lt_iff, iSup_le_iff] at this
rcases this with ⟨φ, hle : ∀ x, ↑(φ x) ≤ f x, b, hbφ, hb⟩
refine ⟨φ, hle, fun ψ hψ => ?_⟩
have : (map (↑) φ).lintegral μ ≠ ∞ := ne_top_of_le_ne_top h (by exact le_iSup₂ (α := ℝ≥0∞) φ hle)
rw [← ENNReal.add_lt_add_iff_left this, ← add_lintegral, ← SimpleFunc.map_add @ENNReal.coe_add]
refine (hb _ fun x => le_trans ?_ (max_le (hle x) (hψ x))).trans_lt hbφ
norm_cast
simp only [add_apply, sub_apply, add_tsub_eq_max]
rfl
#align measure_theory.exists_simple_func_forall_lintegral_sub_lt_of_pos MeasureTheory.exists_simpleFunc_forall_lintegral_sub_lt_of_pos
theorem iSup_lintegral_le {ι : Sort*} (f : ι → α → ℝ≥0∞) :
⨆ i, ∫⁻ a, f i a ∂μ ≤ ∫⁻ a, ⨆ i, f i a ∂μ := by
simp only [← iSup_apply]
exact (monotone_lintegral μ).le_map_iSup
#align measure_theory.supr_lintegral_le MeasureTheory.iSup_lintegral_le
theorem iSup₂_lintegral_le {ι : Sort*} {ι' : ι → Sort*} (f : ∀ i, ι' i → α → ℝ≥0∞) :
⨆ (i) (j), ∫⁻ a, f i j a ∂μ ≤ ∫⁻ a, ⨆ (i) (j), f i j a ∂μ := by
convert (monotone_lintegral μ).le_map_iSup₂ f with a
simp only [iSup_apply]
#align measure_theory.supr₂_lintegral_le MeasureTheory.iSup₂_lintegral_le
theorem le_iInf_lintegral {ι : Sort*} (f : ι → α → ℝ≥0∞) :
∫⁻ a, ⨅ i, f i a ∂μ ≤ ⨅ i, ∫⁻ a, f i a ∂μ := by
simp only [← iInf_apply]
exact (monotone_lintegral μ).map_iInf_le
#align measure_theory.le_infi_lintegral MeasureTheory.le_iInf_lintegral
theorem le_iInf₂_lintegral {ι : Sort*} {ι' : ι → Sort*} (f : ∀ i, ι' i → α → ℝ≥0∞) :
∫⁻ a, ⨅ (i) (h : ι' i), f i h a ∂μ ≤ ⨅ (i) (h : ι' i), ∫⁻ a, f i h a ∂μ := by
convert (monotone_lintegral μ).map_iInf₂_le f with a
simp only [iInf_apply]
#align measure_theory.le_infi₂_lintegral MeasureTheory.le_iInf₂_lintegral
theorem lintegral_mono_ae {f g : α → ℝ≥0∞} (h : ∀ᵐ a ∂μ, f a ≤ g a) :
∫⁻ a, f a ∂μ ≤ ∫⁻ a, g a ∂μ := by
rcases exists_measurable_superset_of_null h with ⟨t, hts, ht, ht0⟩
have : ∀ᵐ x ∂μ, x ∉ t := measure_zero_iff_ae_nmem.1 ht0
rw [lintegral, lintegral]
refine iSup_le fun s => iSup_le fun hfs => le_iSup_of_le (s.restrict tᶜ) <| le_iSup_of_le ?_ ?_
· intro a
by_cases h : a ∈ t <;>
simp only [restrict_apply s ht.compl, mem_compl_iff, h, not_true, not_false_eq_true,
indicator_of_not_mem, zero_le, not_false_eq_true, indicator_of_mem]
exact le_trans (hfs a) (_root_.by_contradiction fun hnfg => h (hts hnfg))
· refine le_of_eq (SimpleFunc.lintegral_congr <| this.mono fun a hnt => ?_)
by_cases hat : a ∈ t <;> simp only [restrict_apply s ht.compl, mem_compl_iff, hat, not_true,
not_false_eq_true, indicator_of_not_mem, not_false_eq_true, indicator_of_mem]
exact (hnt hat).elim
#align measure_theory.lintegral_mono_ae MeasureTheory.lintegral_mono_ae
theorem set_lintegral_mono_ae {s : Set α} {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g)
(hfg : ∀ᵐ x ∂μ, x ∈ s → f x ≤ g x) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in s, g x ∂μ :=
lintegral_mono_ae <| (ae_restrict_iff <| measurableSet_le hf hg).2 hfg
#align measure_theory.set_lintegral_mono_ae MeasureTheory.set_lintegral_mono_ae
theorem set_lintegral_mono {s : Set α} {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g)
(hfg : ∀ x ∈ s, f x ≤ g x) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in s, g x ∂μ :=
set_lintegral_mono_ae hf hg (ae_of_all _ hfg)
#align measure_theory.set_lintegral_mono MeasureTheory.set_lintegral_mono
theorem set_lintegral_mono_ae' {s : Set α} {f g : α → ℝ≥0∞} (hs : MeasurableSet s)
(hfg : ∀ᵐ x ∂μ, x ∈ s → f x ≤ g x) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in s, g x ∂μ :=
lintegral_mono_ae <| (ae_restrict_iff' hs).2 hfg
theorem set_lintegral_mono' {s : Set α} {f g : α → ℝ≥0∞} (hs : MeasurableSet s)
(hfg : ∀ x ∈ s, f x ≤ g x) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in s, g x ∂μ :=
set_lintegral_mono_ae' hs (ae_of_all _ hfg)
theorem set_lintegral_le_lintegral (s : Set α) (f : α → ℝ≥0∞) :
∫⁻ x in s, f x ∂μ ≤ ∫⁻ x, f x ∂μ :=
lintegral_mono' Measure.restrict_le_self le_rfl
theorem lintegral_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ∫⁻ a, f a ∂μ = ∫⁻ a, g a ∂μ :=
le_antisymm (lintegral_mono_ae <| h.le) (lintegral_mono_ae <| h.symm.le)
#align measure_theory.lintegral_congr_ae MeasureTheory.lintegral_congr_ae
theorem lintegral_congr {f g : α → ℝ≥0∞} (h : ∀ a, f a = g a) : ∫⁻ a, f a ∂μ = ∫⁻ a, g a ∂μ := by
simp only [h]
#align measure_theory.lintegral_congr MeasureTheory.lintegral_congr
theorem set_lintegral_congr {f : α → ℝ≥0∞} {s t : Set α} (h : s =ᵐ[μ] t) :
∫⁻ x in s, f x ∂μ = ∫⁻ x in t, f x ∂μ := by rw [Measure.restrict_congr_set h]
#align measure_theory.set_lintegral_congr MeasureTheory.set_lintegral_congr
theorem set_lintegral_congr_fun {f g : α → ℝ≥0∞} {s : Set α} (hs : MeasurableSet s)
(hfg : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : ∫⁻ x in s, f x ∂μ = ∫⁻ x in s, g x ∂μ := by
rw [lintegral_congr_ae]
rw [EventuallyEq]
rwa [ae_restrict_iff' hs]
#align measure_theory.set_lintegral_congr_fun MeasureTheory.set_lintegral_congr_fun
theorem lintegral_ofReal_le_lintegral_nnnorm (f : α → ℝ) :
∫⁻ x, ENNReal.ofReal (f x) ∂μ ≤ ∫⁻ x, ‖f x‖₊ ∂μ := by
simp_rw [← ofReal_norm_eq_coe_nnnorm]
refine lintegral_mono fun x => ENNReal.ofReal_le_ofReal ?_
rw [Real.norm_eq_abs]
exact le_abs_self (f x)
#align measure_theory.lintegral_of_real_le_lintegral_nnnorm MeasureTheory.lintegral_ofReal_le_lintegral_nnnorm
theorem lintegral_nnnorm_eq_of_ae_nonneg {f : α → ℝ} (h_nonneg : 0 ≤ᵐ[μ] f) :
∫⁻ x, ‖f x‖₊ ∂μ = ∫⁻ x, ENNReal.ofReal (f x) ∂μ := by
apply lintegral_congr_ae
filter_upwards [h_nonneg] with x hx
rw [Real.nnnorm_of_nonneg hx, ENNReal.ofReal_eq_coe_nnreal hx]
#align measure_theory.lintegral_nnnorm_eq_of_ae_nonneg MeasureTheory.lintegral_nnnorm_eq_of_ae_nonneg
theorem lintegral_nnnorm_eq_of_nonneg {f : α → ℝ} (h_nonneg : 0 ≤ f) :
∫⁻ x, ‖f x‖₊ ∂μ = ∫⁻ x, ENNReal.ofReal (f x) ∂μ :=
lintegral_nnnorm_eq_of_ae_nonneg (Filter.eventually_of_forall h_nonneg)
#align measure_theory.lintegral_nnnorm_eq_of_nonneg MeasureTheory.lintegral_nnnorm_eq_of_nonneg
theorem lintegral_iSup {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, Measurable (f n)) (h_mono : Monotone f) :
∫⁻ a, ⨆ n, f n a ∂μ = ⨆ n, ∫⁻ a, f n a ∂μ := by
set c : ℝ≥0 → ℝ≥0∞ := (↑)
set F := fun a : α => ⨆ n, f n a
refine le_antisymm ?_ (iSup_lintegral_le _)
rw [lintegral_eq_nnreal]
refine iSup_le fun s => iSup_le fun hsf => ?_
refine ENNReal.le_of_forall_lt_one_mul_le fun a ha => ?_
rcases ENNReal.lt_iff_exists_coe.1 ha with ⟨r, rfl, _⟩
have ha : r < 1 := ENNReal.coe_lt_coe.1 ha
let rs := s.map fun a => r * a
have eq_rs : rs.map c = (const α r : α →ₛ ℝ≥0∞) * map c s := rfl
have eq : ∀ p, rs.map c ⁻¹' {p} = ⋃ n, rs.map c ⁻¹' {p} ∩ { a | p ≤ f n a } := by
intro p
rw [← inter_iUnion]; nth_rw 1 [← inter_univ (map c rs ⁻¹' {p})]
refine Set.ext fun x => and_congr_right fun hx => true_iff_iff.2 ?_
by_cases p_eq : p = 0
· simp [p_eq]
simp only [coe_map, mem_preimage, Function.comp_apply, mem_singleton_iff] at hx
subst hx
have : r * s x ≠ 0 := by rwa [Ne, ← ENNReal.coe_eq_zero]
have : s x ≠ 0 := right_ne_zero_of_mul this
have : (rs.map c) x < ⨆ n : ℕ, f n x := by
refine lt_of_lt_of_le (ENNReal.coe_lt_coe.2 ?_) (hsf x)
suffices r * s x < 1 * s x by simpa
exact mul_lt_mul_of_pos_right ha (pos_iff_ne_zero.2 this)
rcases lt_iSup_iff.1 this with ⟨i, hi⟩
exact mem_iUnion.2 ⟨i, le_of_lt hi⟩
have mono : ∀ r : ℝ≥0∞, Monotone fun n => rs.map c ⁻¹' {r} ∩ { a | r ≤ f n a } := by
intro r i j h
refine inter_subset_inter_right _ ?_
simp_rw [subset_def, mem_setOf]
intro x hx
exact le_trans hx (h_mono h x)
have h_meas : ∀ n, MeasurableSet {a : α | map c rs a ≤ f n a} := fun n =>
measurableSet_le (SimpleFunc.measurable _) (hf n)
calc
(r : ℝ≥0∞) * (s.map c).lintegral μ = ∑ r ∈ (rs.map c).range, r * μ (rs.map c ⁻¹' {r}) := by
rw [← const_mul_lintegral, eq_rs, SimpleFunc.lintegral]
_ = ∑ r ∈ (rs.map c).range, r * μ (⋃ n, rs.map c ⁻¹' {r} ∩ { a | r ≤ f n a }) := by
simp only [(eq _).symm]
_ = ∑ r ∈ (rs.map c).range, ⨆ n, r * μ (rs.map c ⁻¹' {r} ∩ { a | r ≤ f n a }) :=
(Finset.sum_congr rfl fun x _ => by
rw [measure_iUnion_eq_iSup (mono x).directed_le, ENNReal.mul_iSup])
_ = ⨆ n, ∑ r ∈ (rs.map c).range, r * μ (rs.map c ⁻¹' {r} ∩ { a | r ≤ f n a }) := by
refine ENNReal.finset_sum_iSup_nat fun p i j h ↦ ?_
gcongr _ * μ ?_
exact mono p h
_ ≤ ⨆ n : ℕ, ((rs.map c).restrict { a | (rs.map c) a ≤ f n a }).lintegral μ := by
gcongr with n
rw [restrict_lintegral _ (h_meas n)]
refine le_of_eq (Finset.sum_congr rfl fun r _ => ?_)
congr 2 with a
refine and_congr_right ?_
simp (config := { contextual := true })
_ ≤ ⨆ n, ∫⁻ a, f n a ∂μ := by
simp only [← SimpleFunc.lintegral_eq_lintegral]
gcongr with n a
simp only [map_apply] at h_meas
simp only [coe_map, restrict_apply _ (h_meas _), (· ∘ ·)]
exact indicator_apply_le id
#align measure_theory.lintegral_supr MeasureTheory.lintegral_iSup
theorem lintegral_iSup' {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, AEMeasurable (f n) μ)
(h_mono : ∀ᵐ x ∂μ, Monotone fun n => f n x) : ∫⁻ a, ⨆ n, f n a ∂μ = ⨆ n, ∫⁻ a, f n a ∂μ := by
simp_rw [← iSup_apply]
let p : α → (ℕ → ℝ≥0∞) → Prop := fun _ f' => Monotone f'
have hp : ∀ᵐ x ∂μ, p x fun i => f i x := h_mono
have h_ae_seq_mono : Monotone (aeSeq hf p) := by
intro n m hnm x
by_cases hx : x ∈ aeSeqSet hf p
· exact aeSeq.prop_of_mem_aeSeqSet hf hx hnm
· simp only [aeSeq, hx, if_false, le_rfl]
rw [lintegral_congr_ae (aeSeq.iSup hf hp).symm]
simp_rw [iSup_apply]
rw [lintegral_iSup (aeSeq.measurable hf p) h_ae_seq_mono]
congr with n
exact lintegral_congr_ae (aeSeq.aeSeq_n_eq_fun_n_ae hf hp n)
#align measure_theory.lintegral_supr' MeasureTheory.lintegral_iSup'
theorem lintegral_tendsto_of_tendsto_of_monotone {f : ℕ → α → ℝ≥0∞} {F : α → ℝ≥0∞}
(hf : ∀ n, AEMeasurable (f n) μ) (h_mono : ∀ᵐ x ∂μ, Monotone fun n => f n x)
(h_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 <| F x)) :
Tendsto (fun n => ∫⁻ x, f n x ∂μ) atTop (𝓝 <| ∫⁻ x, F x ∂μ) := by
have : Monotone fun n => ∫⁻ x, f n x ∂μ := fun i j hij =>
lintegral_mono_ae (h_mono.mono fun x hx => hx hij)
suffices key : ∫⁻ x, F x ∂μ = ⨆ n, ∫⁻ x, f n x ∂μ by
rw [key]
exact tendsto_atTop_iSup this
rw [← lintegral_iSup' hf h_mono]
refine lintegral_congr_ae ?_
filter_upwards [h_mono, h_tendsto] with _ hx_mono hx_tendsto using
tendsto_nhds_unique hx_tendsto (tendsto_atTop_iSup hx_mono)
#align measure_theory.lintegral_tendsto_of_tendsto_of_monotone MeasureTheory.lintegral_tendsto_of_tendsto_of_monotone
theorem lintegral_eq_iSup_eapprox_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) :
∫⁻ a, f a ∂μ = ⨆ n, (eapprox f n).lintegral μ :=
calc
∫⁻ a, f a ∂μ = ∫⁻ a, ⨆ n, (eapprox f n : α → ℝ≥0∞) a ∂μ := by
congr; ext a; rw [iSup_eapprox_apply f hf]
_ = ⨆ n, ∫⁻ a, (eapprox f n : α → ℝ≥0∞) a ∂μ := by
apply lintegral_iSup
· measurability
· intro i j h
exact monotone_eapprox f h
_ = ⨆ n, (eapprox f n).lintegral μ := by
congr; ext n; rw [(eapprox f n).lintegral_eq_lintegral]
#align measure_theory.lintegral_eq_supr_eapprox_lintegral MeasureTheory.lintegral_eq_iSup_eapprox_lintegral
theorem exists_pos_set_lintegral_lt_of_measure_lt {f : α → ℝ≥0∞} (h : ∫⁻ x, f x ∂μ ≠ ∞) {ε : ℝ≥0∞}
(hε : ε ≠ 0) : ∃ δ > 0, ∀ s, μ s < δ → ∫⁻ x in s, f x ∂μ < ε := by
rcases exists_between (pos_iff_ne_zero.mpr hε) with ⟨ε₂, hε₂0, hε₂ε⟩
rcases exists_between hε₂0 with ⟨ε₁, hε₁0, hε₁₂⟩
rcases exists_simpleFunc_forall_lintegral_sub_lt_of_pos h hε₁0.ne' with ⟨φ, _, hφ⟩
rcases φ.exists_forall_le with ⟨C, hC⟩
use (ε₂ - ε₁) / C, ENNReal.div_pos_iff.2 ⟨(tsub_pos_iff_lt.2 hε₁₂).ne', ENNReal.coe_ne_top⟩
refine fun s hs => lt_of_le_of_lt ?_ hε₂ε
simp only [lintegral_eq_nnreal, iSup_le_iff]
intro ψ hψ
calc
(map (↑) ψ).lintegral (μ.restrict s) ≤
(map (↑) φ).lintegral (μ.restrict s) + (map (↑) (ψ - φ)).lintegral (μ.restrict s) := by
rw [← SimpleFunc.add_lintegral, ← SimpleFunc.map_add @ENNReal.coe_add]
refine SimpleFunc.lintegral_mono (fun x => ?_) le_rfl
simp only [add_tsub_eq_max, le_max_right, coe_map, Function.comp_apply, SimpleFunc.coe_add,
SimpleFunc.coe_sub, Pi.add_apply, Pi.sub_apply, ENNReal.coe_max (φ x) (ψ x)]
_ ≤ (map (↑) φ).lintegral (μ.restrict s) + ε₁ := by
gcongr
refine le_trans ?_ (hφ _ hψ).le
exact SimpleFunc.lintegral_mono le_rfl Measure.restrict_le_self
_ ≤ (SimpleFunc.const α (C : ℝ≥0∞)).lintegral (μ.restrict s) + ε₁ := by
gcongr
exact SimpleFunc.lintegral_mono (fun x ↦ ENNReal.coe_le_coe.2 (hC x)) le_rfl
_ = C * μ s + ε₁ := by
simp only [← SimpleFunc.lintegral_eq_lintegral, coe_const, lintegral_const,
Measure.restrict_apply, MeasurableSet.univ, univ_inter, Function.const]
_ ≤ C * ((ε₂ - ε₁) / C) + ε₁ := by gcongr
_ ≤ ε₂ - ε₁ + ε₁ := by gcongr; apply mul_div_le
_ = ε₂ := tsub_add_cancel_of_le hε₁₂.le
#align measure_theory.exists_pos_set_lintegral_lt_of_measure_lt MeasureTheory.exists_pos_set_lintegral_lt_of_measure_lt
theorem tendsto_set_lintegral_zero {ι} {f : α → ℝ≥0∞} (h : ∫⁻ x, f x ∂μ ≠ ∞) {l : Filter ι}
{s : ι → Set α} (hl : Tendsto (μ ∘ s) l (𝓝 0)) :
Tendsto (fun i => ∫⁻ x in s i, f x ∂μ) l (𝓝 0) := by
simp only [ENNReal.nhds_zero, tendsto_iInf, tendsto_principal, mem_Iio,
← pos_iff_ne_zero] at hl ⊢
intro ε ε0
rcases exists_pos_set_lintegral_lt_of_measure_lt h ε0.ne' with ⟨δ, δ0, hδ⟩
exact (hl δ δ0).mono fun i => hδ _
#align measure_theory.tendsto_set_lintegral_zero MeasureTheory.tendsto_set_lintegral_zero
theorem le_lintegral_add (f g : α → ℝ≥0∞) :
∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ ≤ ∫⁻ a, f a + g a ∂μ := by
simp only [lintegral]
refine ENNReal.biSup_add_biSup_le' (p := fun h : α →ₛ ℝ≥0∞ => h ≤ f)
(q := fun h : α →ₛ ℝ≥0∞ => h ≤ g) ⟨0, zero_le f⟩ ⟨0, zero_le g⟩ fun f' hf' g' hg' => ?_
exact le_iSup₂_of_le (f' + g') (add_le_add hf' hg') (add_lintegral _ _).ge
#align measure_theory.le_lintegral_add MeasureTheory.le_lintegral_add
-- Use stronger lemmas `lintegral_add_left`/`lintegral_add_right` instead
theorem lintegral_add_aux {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g) :
∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ :=
calc
∫⁻ a, f a + g a ∂μ =
∫⁻ a, (⨆ n, (eapprox f n : α → ℝ≥0∞) a) + ⨆ n, (eapprox g n : α → ℝ≥0∞) a ∂μ := by
simp only [iSup_eapprox_apply, hf, hg]
_ = ∫⁻ a, ⨆ n, (eapprox f n + eapprox g n : α → ℝ≥0∞) a ∂μ := by
congr; funext a
rw [ENNReal.iSup_add_iSup_of_monotone]
· simp only [Pi.add_apply]
· intro i j h
exact monotone_eapprox _ h a
· intro i j h
exact monotone_eapprox _ h a
_ = ⨆ n, (eapprox f n).lintegral μ + (eapprox g n).lintegral μ := by
rw [lintegral_iSup]
· congr
funext n
rw [← SimpleFunc.add_lintegral, ← SimpleFunc.lintegral_eq_lintegral]
simp only [Pi.add_apply, SimpleFunc.coe_add]
· measurability
· intro i j h a
dsimp
gcongr <;> exact monotone_eapprox _ h _
_ = (⨆ n, (eapprox f n).lintegral μ) + ⨆ n, (eapprox g n).lintegral μ := by
refine (ENNReal.iSup_add_iSup_of_monotone ?_ ?_).symm <;>
· intro i j h
exact SimpleFunc.lintegral_mono (monotone_eapprox _ h) le_rfl
_ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ := by
rw [lintegral_eq_iSup_eapprox_lintegral hf, lintegral_eq_iSup_eapprox_lintegral hg]
#align measure_theory.lintegral_add_aux MeasureTheory.lintegral_add_aux
@[simp]
theorem lintegral_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) :
∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ := by
refine le_antisymm ?_ (le_lintegral_add _ _)
rcases exists_measurable_le_lintegral_eq μ fun a => f a + g a with ⟨φ, hφm, hφ_le, hφ_eq⟩
calc
∫⁻ a, f a + g a ∂μ = ∫⁻ a, φ a ∂μ := hφ_eq
_ ≤ ∫⁻ a, f a + (φ a - f a) ∂μ := lintegral_mono fun a => le_add_tsub
_ = ∫⁻ a, f a ∂μ + ∫⁻ a, φ a - f a ∂μ := lintegral_add_aux hf (hφm.sub hf)
_ ≤ ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ :=
add_le_add_left (lintegral_mono fun a => tsub_le_iff_left.2 <| hφ_le a) _
#align measure_theory.lintegral_add_left MeasureTheory.lintegral_add_left
theorem lintegral_add_left' {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (g : α → ℝ≥0∞) :
∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ := by
rw [lintegral_congr_ae hf.ae_eq_mk, ← lintegral_add_left hf.measurable_mk,
lintegral_congr_ae (hf.ae_eq_mk.add (ae_eq_refl g))]
#align measure_theory.lintegral_add_left' MeasureTheory.lintegral_add_left'
theorem lintegral_add_right' (f : α → ℝ≥0∞) {g : α → ℝ≥0∞} (hg : AEMeasurable g μ) :
∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ := by
simpa only [add_comm] using lintegral_add_left' hg f
#align measure_theory.lintegral_add_right' MeasureTheory.lintegral_add_right'
@[simp]
theorem lintegral_add_right (f : α → ℝ≥0∞) {g : α → ℝ≥0∞} (hg : Measurable g) :
∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ :=
lintegral_add_right' f hg.aemeasurable
#align measure_theory.lintegral_add_right MeasureTheory.lintegral_add_right
@[simp]
theorem lintegral_smul_measure (c : ℝ≥0∞) (f : α → ℝ≥0∞) : ∫⁻ a, f a ∂c • μ = c * ∫⁻ a, f a ∂μ := by
simp only [lintegral, iSup_subtype', SimpleFunc.lintegral_smul, ENNReal.mul_iSup, smul_eq_mul]
#align measure_theory.lintegral_smul_measure MeasureTheory.lintegral_smul_measure
lemma set_lintegral_smul_measure (c : ℝ≥0∞) (f : α → ℝ≥0∞) (s : Set α) :
∫⁻ a in s, f a ∂(c • μ) = c * ∫⁻ a in s, f a ∂μ := by
rw [Measure.restrict_smul, lintegral_smul_measure]
@[simp]
theorem lintegral_sum_measure {m : MeasurableSpace α} {ι} (f : α → ℝ≥0∞) (μ : ι → Measure α) :
∫⁻ a, f a ∂Measure.sum μ = ∑' i, ∫⁻ a, f a ∂μ i := by
simp only [lintegral, iSup_subtype', SimpleFunc.lintegral_sum, ENNReal.tsum_eq_iSup_sum]
rw [iSup_comm]
congr; funext s
induction' s using Finset.induction_on with i s hi hs
· simp
simp only [Finset.sum_insert hi, ← hs]
refine (ENNReal.iSup_add_iSup ?_).symm
intro φ ψ
exact
⟨⟨φ ⊔ ψ, fun x => sup_le (φ.2 x) (ψ.2 x)⟩,
add_le_add (SimpleFunc.lintegral_mono le_sup_left le_rfl)
(Finset.sum_le_sum fun j _ => SimpleFunc.lintegral_mono le_sup_right le_rfl)⟩
#align measure_theory.lintegral_sum_measure MeasureTheory.lintegral_sum_measure
theorem hasSum_lintegral_measure {ι} {_ : MeasurableSpace α} (f : α → ℝ≥0∞) (μ : ι → Measure α) :
HasSum (fun i => ∫⁻ a, f a ∂μ i) (∫⁻ a, f a ∂Measure.sum μ) :=
(lintegral_sum_measure f μ).symm ▸ ENNReal.summable.hasSum
#align measure_theory.has_sum_lintegral_measure MeasureTheory.hasSum_lintegral_measure
@[simp]
theorem lintegral_add_measure {m : MeasurableSpace α} (f : α → ℝ≥0∞) (μ ν : Measure α) :
∫⁻ a, f a ∂(μ + ν) = ∫⁻ a, f a ∂μ + ∫⁻ a, f a ∂ν := by
simpa [tsum_fintype] using lintegral_sum_measure f fun b => cond b μ ν
#align measure_theory.lintegral_add_measure MeasureTheory.lintegral_add_measure
@[simp]
theorem lintegral_finset_sum_measure {ι} {m : MeasurableSpace α} (s : Finset ι) (f : α → ℝ≥0∞)
(μ : ι → Measure α) : ∫⁻ a, f a ∂(∑ i ∈ s, μ i) = ∑ i ∈ s, ∫⁻ a, f a ∂μ i := by
rw [← Measure.sum_coe_finset, lintegral_sum_measure, ← Finset.tsum_subtype']
simp only [Finset.coe_sort_coe]
#align measure_theory.lintegral_finset_sum_measure MeasureTheory.lintegral_finset_sum_measure
@[simp]
theorem lintegral_zero_measure {m : MeasurableSpace α} (f : α → ℝ≥0∞) :
∫⁻ a, f a ∂(0 : Measure α) = 0 := by
simp [lintegral]
#align measure_theory.lintegral_zero_measure MeasureTheory.lintegral_zero_measure
@[simp]
theorem lintegral_of_isEmpty {α} [MeasurableSpace α] [IsEmpty α] (μ : Measure α) (f : α → ℝ≥0∞) :
∫⁻ x, f x ∂μ = 0 := by
have : Subsingleton (Measure α) := inferInstance
convert lintegral_zero_measure f
theorem set_lintegral_empty (f : α → ℝ≥0∞) : ∫⁻ x in ∅, f x ∂μ = 0 := by
rw [Measure.restrict_empty, lintegral_zero_measure]
#align measure_theory.set_lintegral_empty MeasureTheory.set_lintegral_empty
theorem set_lintegral_univ (f : α → ℝ≥0∞) : ∫⁻ x in univ, f x ∂μ = ∫⁻ x, f x ∂μ := by
rw [Measure.restrict_univ]
#align measure_theory.set_lintegral_univ MeasureTheory.set_lintegral_univ
theorem set_lintegral_measure_zero (s : Set α) (f : α → ℝ≥0∞) (hs' : μ s = 0) :
∫⁻ x in s, f x ∂μ = 0 := by
convert lintegral_zero_measure _
exact Measure.restrict_eq_zero.2 hs'
#align measure_theory.set_lintegral_measure_zero MeasureTheory.set_lintegral_measure_zero
theorem lintegral_finset_sum' (s : Finset β) {f : β → α → ℝ≥0∞}
(hf : ∀ b ∈ s, AEMeasurable (f b) μ) :
∫⁻ a, ∑ b ∈ s, f b a ∂μ = ∑ b ∈ s, ∫⁻ a, f b a ∂μ := by
induction' s using Finset.induction_on with a s has ih
· simp
· simp only [Finset.sum_insert has]
rw [Finset.forall_mem_insert] at hf
rw [lintegral_add_left' hf.1, ih hf.2]
#align measure_theory.lintegral_finset_sum' MeasureTheory.lintegral_finset_sum'
theorem lintegral_finset_sum (s : Finset β) {f : β → α → ℝ≥0∞} (hf : ∀ b ∈ s, Measurable (f b)) :
∫⁻ a, ∑ b ∈ s, f b a ∂μ = ∑ b ∈ s, ∫⁻ a, f b a ∂μ :=
lintegral_finset_sum' s fun b hb => (hf b hb).aemeasurable
#align measure_theory.lintegral_finset_sum MeasureTheory.lintegral_finset_sum
@[simp]
theorem lintegral_const_mul (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : Measurable f) :
∫⁻ a, r * f a ∂μ = r * ∫⁻ a, f a ∂μ :=
calc
∫⁻ a, r * f a ∂μ = ∫⁻ a, ⨆ n, (const α r * eapprox f n) a ∂μ := by
congr
funext a
rw [← iSup_eapprox_apply f hf, ENNReal.mul_iSup]
simp
_ = ⨆ n, r * (eapprox f n).lintegral μ := by
rw [lintegral_iSup]
· congr
funext n
rw [← SimpleFunc.const_mul_lintegral, ← SimpleFunc.lintegral_eq_lintegral]
· intro n
exact SimpleFunc.measurable _
· intro i j h a
exact mul_le_mul_left' (monotone_eapprox _ h _) _
_ = r * ∫⁻ a, f a ∂μ := by rw [← ENNReal.mul_iSup, lintegral_eq_iSup_eapprox_lintegral hf]
#align measure_theory.lintegral_const_mul MeasureTheory.lintegral_const_mul
theorem lintegral_const_mul'' (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
∫⁻ a, r * f a ∂μ = r * ∫⁻ a, f a ∂μ := by
have A : ∫⁻ a, f a ∂μ = ∫⁻ a, hf.mk f a ∂μ := lintegral_congr_ae hf.ae_eq_mk
have B : ∫⁻ a, r * f a ∂μ = ∫⁻ a, r * hf.mk f a ∂μ :=
lintegral_congr_ae (EventuallyEq.fun_comp hf.ae_eq_mk _)
rw [A, B, lintegral_const_mul _ hf.measurable_mk]
#align measure_theory.lintegral_const_mul'' MeasureTheory.lintegral_const_mul''
theorem lintegral_const_mul_le (r : ℝ≥0∞) (f : α → ℝ≥0∞) :
r * ∫⁻ a, f a ∂μ ≤ ∫⁻ a, r * f a ∂μ := by
rw [lintegral, ENNReal.mul_iSup]
refine iSup_le fun s => ?_
rw [ENNReal.mul_iSup, iSup_le_iff]
intro hs
rw [← SimpleFunc.const_mul_lintegral, lintegral]
refine le_iSup_of_le (const α r * s) (le_iSup_of_le (fun x => ?_) le_rfl)
exact mul_le_mul_left' (hs x) _
#align measure_theory.lintegral_const_mul_le MeasureTheory.lintegral_const_mul_le
theorem lintegral_const_mul' (r : ℝ≥0∞) (f : α → ℝ≥0∞) (hr : r ≠ ∞) :
∫⁻ a, r * f a ∂μ = r * ∫⁻ a, f a ∂μ := by
by_cases h : r = 0
· simp [h]
apply le_antisymm _ (lintegral_const_mul_le r f)
have rinv : r * r⁻¹ = 1 := ENNReal.mul_inv_cancel h hr
have rinv' : r⁻¹ * r = 1 := by
rw [mul_comm]
exact rinv
have := lintegral_const_mul_le (μ := μ) r⁻¹ fun x => r * f x
simp? [(mul_assoc _ _ _).symm, rinv'] at this says
simp only [(mul_assoc _ _ _).symm, rinv', one_mul] at this
simpa [(mul_assoc _ _ _).symm, rinv] using mul_le_mul_left' this r
#align measure_theory.lintegral_const_mul' MeasureTheory.lintegral_const_mul'
theorem lintegral_mul_const (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : Measurable f) :
∫⁻ a, f a * r ∂μ = (∫⁻ a, f a ∂μ) * r := by simp_rw [mul_comm, lintegral_const_mul r hf]
#align measure_theory.lintegral_mul_const MeasureTheory.lintegral_mul_const
theorem lintegral_mul_const'' (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
∫⁻ a, f a * r ∂μ = (∫⁻ a, f a ∂μ) * r := by simp_rw [mul_comm, lintegral_const_mul'' r hf]
#align measure_theory.lintegral_mul_const'' MeasureTheory.lintegral_mul_const''
theorem lintegral_mul_const_le (r : ℝ≥0∞) (f : α → ℝ≥0∞) :
(∫⁻ a, f a ∂μ) * r ≤ ∫⁻ a, f a * r ∂μ := by
simp_rw [mul_comm, lintegral_const_mul_le r f]
#align measure_theory.lintegral_mul_const_le MeasureTheory.lintegral_mul_const_le
theorem lintegral_mul_const' (r : ℝ≥0∞) (f : α → ℝ≥0∞) (hr : r ≠ ∞) :
∫⁻ a, f a * r ∂μ = (∫⁻ a, f a ∂μ) * r := by simp_rw [mul_comm, lintegral_const_mul' r f hr]
#align measure_theory.lintegral_mul_const' MeasureTheory.lintegral_mul_const'
theorem lintegral_lintegral_mul {β} [MeasurableSpace β] {ν : Measure β} {f : α → ℝ≥0∞}
{g : β → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g ν) :
∫⁻ x, ∫⁻ y, f x * g y ∂ν ∂μ = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
simp [lintegral_const_mul'' _ hg, lintegral_mul_const'' _ hf]
#align measure_theory.lintegral_lintegral_mul MeasureTheory.lintegral_lintegral_mul
-- TODO: Need a better way of rewriting inside of an integral
theorem lintegral_rw₁ {f f' : α → β} (h : f =ᵐ[μ] f') (g : β → ℝ≥0∞) :
∫⁻ a, g (f a) ∂μ = ∫⁻ a, g (f' a) ∂μ :=
lintegral_congr_ae <| h.mono fun a h => by dsimp only; rw [h]
#align measure_theory.lintegral_rw₁ MeasureTheory.lintegral_rw₁
-- TODO: Need a better way of rewriting inside of an integral
theorem lintegral_rw₂ {f₁ f₁' : α → β} {f₂ f₂' : α → γ} (h₁ : f₁ =ᵐ[μ] f₁') (h₂ : f₂ =ᵐ[μ] f₂')
(g : β → γ → ℝ≥0∞) : ∫⁻ a, g (f₁ a) (f₂ a) ∂μ = ∫⁻ a, g (f₁' a) (f₂' a) ∂μ :=
lintegral_congr_ae <| h₁.mp <| h₂.mono fun _ h₂ h₁ => by dsimp only; rw [h₁, h₂]
#align measure_theory.lintegral_rw₂ MeasureTheory.lintegral_rw₂
theorem lintegral_indicator_le (f : α → ℝ≥0∞) (s : Set α) :
∫⁻ a, s.indicator f a ∂μ ≤ ∫⁻ a in s, f a ∂μ := by
simp only [lintegral]
apply iSup_le (fun g ↦ (iSup_le (fun hg ↦ ?_)))
have : g ≤ f := hg.trans (indicator_le_self s f)
refine le_iSup_of_le g (le_iSup_of_le this (le_of_eq ?_))
rw [lintegral_restrict, SimpleFunc.lintegral]
congr with t
by_cases H : t = 0
· simp [H]
congr with x
simp only [mem_preimage, mem_singleton_iff, mem_inter_iff, iff_self_and]
rintro rfl
contrapose! H
simpa [H] using hg x
@[simp]
theorem lintegral_indicator (f : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s) :
∫⁻ a, s.indicator f a ∂μ = ∫⁻ a in s, f a ∂μ := by
apply le_antisymm (lintegral_indicator_le f s)
simp only [lintegral, ← restrict_lintegral_eq_lintegral_restrict _ hs, iSup_subtype']
refine iSup_mono' (Subtype.forall.2 fun φ hφ => ?_)
refine ⟨⟨φ.restrict s, fun x => ?_⟩, le_rfl⟩
simp [hφ x, hs, indicator_le_indicator]
#align measure_theory.lintegral_indicator MeasureTheory.lintegral_indicator
theorem lintegral_indicator₀ (f : α → ℝ≥0∞) {s : Set α} (hs : NullMeasurableSet s μ) :
∫⁻ a, s.indicator f a ∂μ = ∫⁻ a in s, f a ∂μ := by
rw [← lintegral_congr_ae (indicator_ae_eq_of_ae_eq_set hs.toMeasurable_ae_eq),
lintegral_indicator _ (measurableSet_toMeasurable _ _),
Measure.restrict_congr_set hs.toMeasurable_ae_eq]
#align measure_theory.lintegral_indicator₀ MeasureTheory.lintegral_indicator₀
theorem lintegral_indicator_const_le (s : Set α) (c : ℝ≥0∞) :
∫⁻ a, s.indicator (fun _ => c) a ∂μ ≤ c * μ s :=
(lintegral_indicator_le _ _).trans (set_lintegral_const s c).le
theorem lintegral_indicator_const₀ {s : Set α} (hs : NullMeasurableSet s μ) (c : ℝ≥0∞) :
∫⁻ a, s.indicator (fun _ => c) a ∂μ = c * μ s := by
rw [lintegral_indicator₀ _ hs, set_lintegral_const]
theorem lintegral_indicator_const {s : Set α} (hs : MeasurableSet s) (c : ℝ≥0∞) :
∫⁻ a, s.indicator (fun _ => c) a ∂μ = c * μ s :=
lintegral_indicator_const₀ hs.nullMeasurableSet c
#align measure_theory.lintegral_indicator_const MeasureTheory.lintegral_indicator_const
theorem set_lintegral_eq_const {f : α → ℝ≥0∞} (hf : Measurable f) (r : ℝ≥0∞) :
∫⁻ x in { x | f x = r }, f x ∂μ = r * μ { x | f x = r } := by
have : ∀ᵐ x ∂μ, x ∈ { x | f x = r } → f x = r := ae_of_all μ fun _ hx => hx
rw [set_lintegral_congr_fun _ this]
· rw [lintegral_const, Measure.restrict_apply MeasurableSet.univ, Set.univ_inter]
· exact hf (measurableSet_singleton r)
#align measure_theory.set_lintegral_eq_const MeasureTheory.set_lintegral_eq_const
theorem lintegral_indicator_one_le (s : Set α) : ∫⁻ a, s.indicator 1 a ∂μ ≤ μ s :=
(lintegral_indicator_const_le _ _).trans <| (one_mul _).le
@[simp]
theorem lintegral_indicator_one₀ (hs : NullMeasurableSet s μ) : ∫⁻ a, s.indicator 1 a ∂μ = μ s :=
(lintegral_indicator_const₀ hs _).trans <| one_mul _
@[simp]
theorem lintegral_indicator_one (hs : MeasurableSet s) : ∫⁻ a, s.indicator 1 a ∂μ = μ s :=
(lintegral_indicator_const hs _).trans <| one_mul _
#align measure_theory.lintegral_indicator_one MeasureTheory.lintegral_indicator_one
theorem lintegral_add_mul_meas_add_le_le_lintegral {f g : α → ℝ≥0∞} (hle : f ≤ᵐ[μ] g)
(hg : AEMeasurable g μ) (ε : ℝ≥0∞) :
∫⁻ a, f a ∂μ + ε * μ { x | f x + ε ≤ g x } ≤ ∫⁻ a, g a ∂μ := by
rcases exists_measurable_le_lintegral_eq μ f with ⟨φ, hφm, hφ_le, hφ_eq⟩
calc
∫⁻ x, f x ∂μ + ε * μ { x | f x + ε ≤ g x } = ∫⁻ x, φ x ∂μ + ε * μ { x | f x + ε ≤ g x } := by
rw [hφ_eq]
_ ≤ ∫⁻ x, φ x ∂μ + ε * μ { x | φ x + ε ≤ g x } := by
gcongr
exact fun x => (add_le_add_right (hφ_le _) _).trans
_ = ∫⁻ x, φ x + indicator { x | φ x + ε ≤ g x } (fun _ => ε) x ∂μ := by
rw [lintegral_add_left hφm, lintegral_indicator₀, set_lintegral_const]
exact measurableSet_le (hφm.nullMeasurable.measurable'.add_const _) hg.nullMeasurable
_ ≤ ∫⁻ x, g x ∂μ := lintegral_mono_ae (hle.mono fun x hx₁ => ?_)
simp only [indicator_apply]; split_ifs with hx₂
exacts [hx₂, (add_zero _).trans_le <| (hφ_le x).trans hx₁]
#align measure_theory.lintegral_add_mul_meas_add_le_le_lintegral MeasureTheory.lintegral_add_mul_meas_add_le_le_lintegral
theorem mul_meas_ge_le_lintegral₀ {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (ε : ℝ≥0∞) :
ε * μ { x | ε ≤ f x } ≤ ∫⁻ a, f a ∂μ := by
simpa only [lintegral_zero, zero_add] using
lintegral_add_mul_meas_add_le_le_lintegral (ae_of_all _ fun x => zero_le (f x)) hf ε
#align measure_theory.mul_meas_ge_le_lintegral₀ MeasureTheory.mul_meas_ge_le_lintegral₀
theorem mul_meas_ge_le_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) (ε : ℝ≥0∞) :
ε * μ { x | ε ≤ f x } ≤ ∫⁻ a, f a ∂μ :=
mul_meas_ge_le_lintegral₀ hf.aemeasurable ε
#align measure_theory.mul_meas_ge_le_lintegral MeasureTheory.mul_meas_ge_le_lintegral
lemma meas_le_lintegral₀ {f : α → ℝ≥0∞} (hf : AEMeasurable f μ)
{s : Set α} (hs : ∀ x ∈ s, 1 ≤ f x) : μ s ≤ ∫⁻ a, f a ∂μ := by
apply le_trans _ (mul_meas_ge_le_lintegral₀ hf 1)
rw [one_mul]
exact measure_mono hs
lemma lintegral_le_meas {s : Set α} {f : α → ℝ≥0∞} (hf : ∀ a, f a ≤ 1) (h'f : ∀ a ∈ sᶜ, f a = 0) :
∫⁻ a, f a ∂μ ≤ μ s := by
apply (lintegral_mono (fun x ↦ ?_)).trans (lintegral_indicator_one_le s)
by_cases hx : x ∈ s
· simpa [hx] using hf x
· simpa [hx] using h'f x hx
theorem lintegral_eq_top_of_measure_eq_top_ne_zero {f : α → ℝ≥0∞} (hf : AEMeasurable f μ)
(hμf : μ {x | f x = ∞} ≠ 0) : ∫⁻ x, f x ∂μ = ∞ :=
eq_top_iff.mpr <|
calc
∞ = ∞ * μ { x | ∞ ≤ f x } := by simp [mul_eq_top, hμf]
_ ≤ ∫⁻ x, f x ∂μ := mul_meas_ge_le_lintegral₀ hf ∞
#align measure_theory.lintegral_eq_top_of_measure_eq_top_ne_zero MeasureTheory.lintegral_eq_top_of_measure_eq_top_ne_zero
theorem setLintegral_eq_top_of_measure_eq_top_ne_zero (hf : AEMeasurable f (μ.restrict s))
(hμf : μ ({x ∈ s | f x = ∞}) ≠ 0) : ∫⁻ x in s, f x ∂μ = ∞ :=
lintegral_eq_top_of_measure_eq_top_ne_zero hf <|
mt (eq_bot_mono <| by rw [← setOf_inter_eq_sep]; exact Measure.le_restrict_apply _ _) hμf
#align measure_theory.set_lintegral_eq_top_of_measure_eq_top_ne_zero MeasureTheory.setLintegral_eq_top_of_measure_eq_top_ne_zero
theorem measure_eq_top_of_lintegral_ne_top (hf : AEMeasurable f μ) (hμf : ∫⁻ x, f x ∂μ ≠ ∞) :
μ {x | f x = ∞} = 0 :=
of_not_not fun h => hμf <| lintegral_eq_top_of_measure_eq_top_ne_zero hf h
#align measure_theory.measure_eq_top_of_lintegral_ne_top MeasureTheory.measure_eq_top_of_lintegral_ne_top
theorem measure_eq_top_of_setLintegral_ne_top (hf : AEMeasurable f (μ.restrict s))
(hμf : ∫⁻ x in s, f x ∂μ ≠ ∞) : μ ({x ∈ s | f x = ∞}) = 0 :=
of_not_not fun h => hμf <| setLintegral_eq_top_of_measure_eq_top_ne_zero hf h
#align measure_theory.measure_eq_top_of_set_lintegral_ne_top MeasureTheory.measure_eq_top_of_setLintegral_ne_top
theorem meas_ge_le_lintegral_div {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) {ε : ℝ≥0∞} (hε : ε ≠ 0)
(hε' : ε ≠ ∞) : μ { x | ε ≤ f x } ≤ (∫⁻ a, f a ∂μ) / ε :=
(ENNReal.le_div_iff_mul_le (Or.inl hε) (Or.inl hε')).2 <| by
rw [mul_comm]
exact mul_meas_ge_le_lintegral₀ hf ε
#align measure_theory.meas_ge_le_lintegral_div MeasureTheory.meas_ge_le_lintegral_div
theorem ae_eq_of_ae_le_of_lintegral_le {f g : α → ℝ≥0∞} (hfg : f ≤ᵐ[μ] g) (hf : ∫⁻ x, f x ∂μ ≠ ∞)
(hg : AEMeasurable g μ) (hgf : ∫⁻ x, g x ∂μ ≤ ∫⁻ x, f x ∂μ) : f =ᵐ[μ] g := by
have : ∀ n : ℕ, ∀ᵐ x ∂μ, g x < f x + (n : ℝ≥0∞)⁻¹ := by
intro n
simp only [ae_iff, not_lt]
have : ∫⁻ x, f x ∂μ + (↑n)⁻¹ * μ { x : α | f x + (n : ℝ≥0∞)⁻¹ ≤ g x } ≤ ∫⁻ x, f x ∂μ :=
(lintegral_add_mul_meas_add_le_le_lintegral hfg hg n⁻¹).trans hgf
rw [(ENNReal.cancel_of_ne hf).add_le_iff_nonpos_right, nonpos_iff_eq_zero, mul_eq_zero] at this
exact this.resolve_left (ENNReal.inv_ne_zero.2 (ENNReal.natCast_ne_top _))
refine hfg.mp ((ae_all_iff.2 this).mono fun x hlt hle => hle.antisymm ?_)
suffices Tendsto (fun n : ℕ => f x + (n : ℝ≥0∞)⁻¹) atTop (𝓝 (f x)) from
ge_of_tendsto' this fun i => (hlt i).le
simpa only [inv_top, add_zero] using
tendsto_const_nhds.add (ENNReal.tendsto_inv_iff.2 ENNReal.tendsto_nat_nhds_top)
#align measure_theory.ae_eq_of_ae_le_of_lintegral_le MeasureTheory.ae_eq_of_ae_le_of_lintegral_le
@[simp]
theorem lintegral_eq_zero_iff' {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
∫⁻ a, f a ∂μ = 0 ↔ f =ᵐ[μ] 0 :=
have : ∫⁻ _ : α, 0 ∂μ ≠ ∞ := by simp [lintegral_zero, zero_ne_top]
⟨fun h =>
(ae_eq_of_ae_le_of_lintegral_le (ae_of_all _ <| zero_le f) this hf
(h.trans lintegral_zero.symm).le).symm,
fun h => (lintegral_congr_ae h).trans lintegral_zero⟩
#align measure_theory.lintegral_eq_zero_iff' MeasureTheory.lintegral_eq_zero_iff'
@[simp]
theorem lintegral_eq_zero_iff {f : α → ℝ≥0∞} (hf : Measurable f) : ∫⁻ a, f a ∂μ = 0 ↔ f =ᵐ[μ] 0 :=
lintegral_eq_zero_iff' hf.aemeasurable
#align measure_theory.lintegral_eq_zero_iff MeasureTheory.lintegral_eq_zero_iff
theorem lintegral_pos_iff_support {f : α → ℝ≥0∞} (hf : Measurable f) :
(0 < ∫⁻ a, f a ∂μ) ↔ 0 < μ (Function.support f) := by
simp [pos_iff_ne_zero, hf, Filter.EventuallyEq, ae_iff, Function.support]
#align measure_theory.lintegral_pos_iff_support MeasureTheory.lintegral_pos_iff_support
theorem setLintegral_pos_iff {f : α → ℝ≥0∞} (hf : Measurable f) {s : Set α} :
0 < ∫⁻ a in s, f a ∂μ ↔ 0 < μ (Function.support f ∩ s) := by
rw [lintegral_pos_iff_support hf, Measure.restrict_apply (measurableSet_support hf)]
theorem lintegral_iSup_ae {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, Measurable (f n))
(h_mono : ∀ n, ∀ᵐ a ∂μ, f n a ≤ f n.succ a) : ∫⁻ a, ⨆ n, f n a ∂μ = ⨆ n, ∫⁻ a, f n a ∂μ := by
let ⟨s, hs⟩ := exists_measurable_superset_of_null (ae_iff.1 (ae_all_iff.2 h_mono))
let g n a := if a ∈ s then 0 else f n a
have g_eq_f : ∀ᵐ a ∂μ, ∀ n, g n a = f n a :=
(measure_zero_iff_ae_nmem.1 hs.2.2).mono fun a ha n => if_neg ha
calc
∫⁻ a, ⨆ n, f n a ∂μ = ∫⁻ a, ⨆ n, g n a ∂μ :=
lintegral_congr_ae <| g_eq_f.mono fun a ha => by simp only [ha]
_ = ⨆ n, ∫⁻ a, g n a ∂μ :=
(lintegral_iSup (fun n => measurable_const.piecewise hs.2.1 (hf n))
(monotone_nat_of_le_succ fun n a => ?_))
_ = ⨆ n, ∫⁻ a, f n a ∂μ := by simp only [lintegral_congr_ae (g_eq_f.mono fun _a ha => ha _)]
simp only [g]
split_ifs with h
· rfl
· have := Set.not_mem_subset hs.1 h
simp only [not_forall, not_le, mem_setOf_eq, not_exists, not_lt] at this
exact this n
#align measure_theory.lintegral_supr_ae MeasureTheory.lintegral_iSup_ae
theorem lintegral_sub' {f g : α → ℝ≥0∞} (hg : AEMeasurable g μ) (hg_fin : ∫⁻ a, g a ∂μ ≠ ∞)
(h_le : g ≤ᵐ[μ] f) : ∫⁻ a, f a - g a ∂μ = ∫⁻ a, f a ∂μ - ∫⁻ a, g a ∂μ := by
refine ENNReal.eq_sub_of_add_eq hg_fin ?_
rw [← lintegral_add_right' _ hg]
exact lintegral_congr_ae (h_le.mono fun x hx => tsub_add_cancel_of_le hx)
#align measure_theory.lintegral_sub' MeasureTheory.lintegral_sub'
theorem lintegral_sub {f g : α → ℝ≥0∞} (hg : Measurable g) (hg_fin : ∫⁻ a, g a ∂μ ≠ ∞)
(h_le : g ≤ᵐ[μ] f) : ∫⁻ a, f a - g a ∂μ = ∫⁻ a, f a ∂μ - ∫⁻ a, g a ∂μ :=
lintegral_sub' hg.aemeasurable hg_fin h_le
#align measure_theory.lintegral_sub MeasureTheory.lintegral_sub
theorem lintegral_sub_le' (f g : α → ℝ≥0∞) (hf : AEMeasurable f μ) :
∫⁻ x, g x ∂μ - ∫⁻ x, f x ∂μ ≤ ∫⁻ x, g x - f x ∂μ := by
rw [tsub_le_iff_right]
by_cases hfi : ∫⁻ x, f x ∂μ = ∞
· rw [hfi, add_top]
exact le_top
· rw [← lintegral_add_right' _ hf]
gcongr
exact le_tsub_add
#align measure_theory.lintegral_sub_le' MeasureTheory.lintegral_sub_le'
theorem lintegral_sub_le (f g : α → ℝ≥0∞) (hf : Measurable f) :
∫⁻ x, g x ∂μ - ∫⁻ x, f x ∂μ ≤ ∫⁻ x, g x - f x ∂μ :=
lintegral_sub_le' f g hf.aemeasurable
#align measure_theory.lintegral_sub_le MeasureTheory.lintegral_sub_le
theorem lintegral_strict_mono_of_ae_le_of_frequently_ae_lt {f g : α → ℝ≥0∞} (hg : AEMeasurable g μ)
(hfi : ∫⁻ x, f x ∂μ ≠ ∞) (h_le : f ≤ᵐ[μ] g) (h : ∃ᵐ x ∂μ, f x ≠ g x) :
∫⁻ x, f x ∂μ < ∫⁻ x, g x ∂μ := by
contrapose! h
simp only [not_frequently, Ne, Classical.not_not]
exact ae_eq_of_ae_le_of_lintegral_le h_le hfi hg h
#align measure_theory.lintegral_strict_mono_of_ae_le_of_frequently_ae_lt MeasureTheory.lintegral_strict_mono_of_ae_le_of_frequently_ae_lt
theorem lintegral_strict_mono_of_ae_le_of_ae_lt_on {f g : α → ℝ≥0∞} (hg : AEMeasurable g μ)
(hfi : ∫⁻ x, f x ∂μ ≠ ∞) (h_le : f ≤ᵐ[μ] g) {s : Set α} (hμs : μ s ≠ 0)
(h : ∀ᵐ x ∂μ, x ∈ s → f x < g x) : ∫⁻ x, f x ∂μ < ∫⁻ x, g x ∂μ :=
lintegral_strict_mono_of_ae_le_of_frequently_ae_lt hg hfi h_le <|
((frequently_ae_mem_iff.2 hμs).and_eventually h).mono fun _x hx => (hx.2 hx.1).ne
#align measure_theory.lintegral_strict_mono_of_ae_le_of_ae_lt_on MeasureTheory.lintegral_strict_mono_of_ae_le_of_ae_lt_on
| Mathlib/MeasureTheory/Integral/Lebesgue.lean | 1,010 | 1,014 | theorem lintegral_strict_mono {f g : α → ℝ≥0∞} (hμ : μ ≠ 0) (hg : AEMeasurable g μ)
(hfi : ∫⁻ x, f x ∂μ ≠ ∞) (h : ∀ᵐ x ∂μ, f x < g x) : ∫⁻ x, f x ∂μ < ∫⁻ x, g x ∂μ := by |
rw [Ne, ← Measure.measure_univ_eq_zero] at hμ
refine lintegral_strict_mono_of_ae_le_of_ae_lt_on hg hfi (ae_le_of_ae_lt h) hμ ?_
simpa using h
|
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Inverse
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical NNReal Nat
local notation "∞" => (⊤ : ℕ∞)
universe u v w uD uE uF uG
attribute [local instance 1001]
NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
open Set Fin Filter Function
open scoped Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
{X : Type*} [NormedAddCommGroup X] [NormedSpace 𝕜 X] {s s₁ t u : Set E} {f f₁ : E → F}
{g : F → G} {x x₀ : E} {c : F} {b : E × F → G} {m n : ℕ∞} {p : E → FormalMultilinearSeries 𝕜 E F}
@[simp]
theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} :
iteratedFDerivWithin 𝕜 i (fun _ : E ↦ (0 : F)) s x = 0 := by
induction i generalizing x with
| zero => ext; simp
| succ i IH =>
ext m
rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)]
rw [fderivWithin_const_apply _ (hs x hx)]
rfl
@[simp]
theorem iteratedFDeriv_zero_fun {n : ℕ} : (iteratedFDeriv 𝕜 n fun _ : E ↦ (0 : F)) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
theorem contDiff_zero_fun : ContDiff 𝕜 n fun _ : E => (0 : F) :=
contDiff_of_differentiable_iteratedFDeriv fun m _ => by
rw [iteratedFDeriv_zero_fun]
exact differentiable_const (0 : E[×m]→L[𝕜] F)
#align cont_diff_zero_fun contDiff_zero_fun
theorem contDiff_const {c : F} : ContDiff 𝕜 n fun _ : E => c := by
suffices h : ContDiff 𝕜 ∞ fun _ : E => c from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine ⟨differentiable_const c, ?_⟩
rw [fderiv_const]
exact contDiff_zero_fun
#align cont_diff_const contDiff_const
theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn 𝕜 n (fun _ : E => c) s :=
contDiff_const.contDiffOn
#align cont_diff_on_const contDiffOn_const
theorem contDiffAt_const {c : F} : ContDiffAt 𝕜 n (fun _ : E => c) x :=
contDiff_const.contDiffAt
#align cont_diff_at_const contDiffAt_const
theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt 𝕜 n (fun _ : E => c) s x :=
contDiffAt_const.contDiffWithinAt
#align cont_diff_within_at_const contDiffWithinAt_const
@[nontriviality]
theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff 𝕜 n f := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
#align cont_diff_of_subsingleton contDiff_of_subsingleton
@[nontriviality]
theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt 𝕜 n f x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
#align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton
@[nontriviality]
theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt 𝕜 n f s x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
#align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton
@[nontriviality]
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 122 | 123 | theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn 𝕜 n f s := by |
rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
|
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
import Mathlib.RingTheory.PowerBasis
#align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
open scoped Polynomial
open Polynomial
noncomputable section
universe u v
-- Porting note: this looks like something that should not be here
-- -- This class doesn't really make sense on a predicate
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) : Type max u v where
map : R[X] →+* S
map_surjective : Function.Surjective map
ker_map : RingHom.ker map = Ideal.span {f}
algebraMap_eq : algebraMap R S = map.comp Polynomial.C
#align is_adjoin_root IsAdjoinRoot
-- This class doesn't really make sense on a predicate
-- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) extends IsAdjoinRoot S f where
Monic : Monic f
#align is_adjoin_root_monic IsAdjoinRootMonic
section Ring
variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S]
namespace IsAdjoinRoot
def root (h : IsAdjoinRoot S f) : S :=
h.map X
#align is_adjoin_root.root IsAdjoinRoot.root
theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S :=
h.map_surjective.subsingleton
#align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton
theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) :
algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply]
#align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply
@[simp]
theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by
rw [h.ker_map, Ideal.mem_span_singleton]
#align is_adjoin_root.mem_ker_map IsAdjoinRoot.mem_ker_map
theorem map_eq_zero_iff (h : IsAdjoinRoot S f) {p} : h.map p = 0 ↔ f ∣ p := by
rw [← h.mem_ker_map, RingHom.mem_ker]
#align is_adjoin_root.map_eq_zero_iff IsAdjoinRoot.map_eq_zero_iff
@[simp]
theorem map_X (h : IsAdjoinRoot S f) : h.map X = h.root := rfl
set_option linter.uppercaseLean3 false in
#align is_adjoin_root.map_X IsAdjoinRoot.map_X
@[simp]
theorem map_self (h : IsAdjoinRoot S f) : h.map f = 0 := h.map_eq_zero_iff.mpr dvd_rfl
#align is_adjoin_root.map_self IsAdjoinRoot.map_self
@[simp]
theorem aeval_eq (h : IsAdjoinRoot S f) (p : R[X]) : aeval h.root p = h.map p :=
Polynomial.induction_on p (fun x => by rw [aeval_C, h.algebraMap_apply])
(fun p q ihp ihq => by rw [AlgHom.map_add, RingHom.map_add, ihp, ihq]) fun n x _ => by
rw [AlgHom.map_mul, aeval_C, AlgHom.map_pow, aeval_X, RingHom.map_mul, ← h.algebraMap_apply,
RingHom.map_pow, map_X]
#align is_adjoin_root.aeval_eq IsAdjoinRoot.aeval_eq
-- @[simp] -- Porting note (#10618): simp can prove this
theorem aeval_root (h : IsAdjoinRoot S f) : aeval h.root f = 0 := by rw [aeval_eq, map_self]
#align is_adjoin_root.aeval_root IsAdjoinRoot.aeval_root
def repr (h : IsAdjoinRoot S f) (x : S) : R[X] :=
(h.map_surjective x).choose
#align is_adjoin_root.repr IsAdjoinRoot.repr
theorem map_repr (h : IsAdjoinRoot S f) (x : S) : h.map (h.repr x) = x :=
(h.map_surjective x).choose_spec
#align is_adjoin_root.map_repr IsAdjoinRoot.map_repr
theorem repr_zero_mem_span (h : IsAdjoinRoot S f) : h.repr 0 ∈ Ideal.span ({f} : Set R[X]) := by
rw [← h.ker_map, RingHom.mem_ker, h.map_repr]
#align is_adjoin_root.repr_zero_mem_span IsAdjoinRoot.repr_zero_mem_span
theorem repr_add_sub_repr_add_repr_mem_span (h : IsAdjoinRoot S f) (x y : S) :
h.repr (x + y) - (h.repr x + h.repr y) ∈ Ideal.span ({f} : Set R[X]) := by
rw [← h.ker_map, RingHom.mem_ker, map_sub, h.map_repr, map_add, h.map_repr, h.map_repr, sub_self]
#align is_adjoin_root.repr_add_sub_repr_add_repr_mem_span IsAdjoinRoot.repr_add_sub_repr_add_repr_mem_span
theorem ext_map (h h' : IsAdjoinRoot S f) (eq : ∀ x, h.map x = h'.map x) : h = h' := by
cases h; cases h'; congr
exact RingHom.ext eq
#align is_adjoin_root.ext_map IsAdjoinRoot.ext_map
@[ext]
theorem ext (h h' : IsAdjoinRoot S f) (eq : h.root = h'.root) : h = h' :=
h.ext_map h' fun x => by rw [← h.aeval_eq, ← h'.aeval_eq, eq]
#align is_adjoin_root.ext IsAdjoinRoot.ext
section lift
variable {T : Type*} [CommRing T] {i : R →+* T} {x : T} (hx : f.eval₂ i x = 0)
theorem eval₂_repr_eq_eval₂_of_map_eq (h : IsAdjoinRoot S f) (z : S) (w : R[X])
(hzw : h.map w = z) : (h.repr z).eval₂ i x = w.eval₂ i x := by
rw [eq_comm, ← sub_eq_zero, ← h.map_repr z, ← map_sub, h.map_eq_zero_iff] at hzw
obtain ⟨y, hy⟩ := hzw
rw [← sub_eq_zero, ← eval₂_sub, hy, eval₂_mul, hx, zero_mul]
#align is_adjoin_root.eval₂_repr_eq_eval₂_of_map_eq IsAdjoinRoot.eval₂_repr_eq_eval₂_of_map_eq
variable (i x)
-- To match `AdjoinRoot.lift`
def lift (h : IsAdjoinRoot S f) : S →+* T where
toFun z := (h.repr z).eval₂ i x
map_zero' := by
dsimp only -- Porting note (#10752): added `dsimp only`
rw [h.eval₂_repr_eq_eval₂_of_map_eq hx _ _ (map_zero _), eval₂_zero]
map_add' z w := by
dsimp only -- Porting note (#10752): added `dsimp only`
rw [h.eval₂_repr_eq_eval₂_of_map_eq hx _ (h.repr z + h.repr w), eval₂_add]
rw [map_add, map_repr, map_repr]
map_one' := by
beta_reduce -- Porting note (#12129): additional beta reduction needed
rw [h.eval₂_repr_eq_eval₂_of_map_eq hx _ _ (map_one _), eval₂_one]
map_mul' z w := by
dsimp only -- Porting note (#10752): added `dsimp only`
rw [h.eval₂_repr_eq_eval₂_of_map_eq hx _ (h.repr z * h.repr w), eval₂_mul]
rw [map_mul, map_repr, map_repr]
#align is_adjoin_root.lift IsAdjoinRoot.lift
variable {i x}
@[simp]
theorem lift_map (h : IsAdjoinRoot S f) (z : R[X]) : h.lift i x hx (h.map z) = z.eval₂ i x := by
rw [lift, RingHom.coe_mk]
dsimp -- Porting note (#11227):added a `dsimp`
rw [h.eval₂_repr_eq_eval₂_of_map_eq hx _ _ rfl]
#align is_adjoin_root.lift_map IsAdjoinRoot.lift_map
@[simp]
| Mathlib/RingTheory/IsAdjoinRoot.lean | 243 | 244 | theorem lift_root (h : IsAdjoinRoot S f) : h.lift i x hx h.root = x := by |
rw [← h.map_X, lift_map, eval₂_X]
|
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Data.List.Cycle
import Mathlib.Data.Nat.Prime
import Mathlib.Data.PNat.Basic
import Mathlib.Dynamics.FixedPoints.Basic
import Mathlib.GroupTheory.GroupAction.Group
#align_import dynamics.periodic_pts from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
open Set
namespace Function
open Function (Commute)
variable {α : Type*} {β : Type*} {f fa : α → α} {fb : β → β} {x y : α} {m n : ℕ}
def IsPeriodicPt (f : α → α) (n : ℕ) (x : α) :=
IsFixedPt f^[n] x
#align function.is_periodic_pt Function.IsPeriodicPt
theorem IsFixedPt.isPeriodicPt (hf : IsFixedPt f x) (n : ℕ) : IsPeriodicPt f n x :=
hf.iterate n
#align function.is_fixed_pt.is_periodic_pt Function.IsFixedPt.isPeriodicPt
theorem is_periodic_id (n : ℕ) (x : α) : IsPeriodicPt id n x :=
(isFixedPt_id x).isPeriodicPt n
#align function.is_periodic_id Function.is_periodic_id
theorem isPeriodicPt_zero (f : α → α) (x : α) : IsPeriodicPt f 0 x :=
isFixedPt_id x
#align function.is_periodic_pt_zero Function.isPeriodicPt_zero
def ptsOfPeriod (f : α → α) (n : ℕ) : Set α :=
{ x : α | IsPeriodicPt f n x }
#align function.pts_of_period Function.ptsOfPeriod
@[simp]
theorem mem_ptsOfPeriod : x ∈ ptsOfPeriod f n ↔ IsPeriodicPt f n x :=
Iff.rfl
#align function.mem_pts_of_period Function.mem_ptsOfPeriod
theorem Semiconj.mapsTo_ptsOfPeriod {g : α → β} (h : Semiconj g fa fb) (n : ℕ) :
MapsTo g (ptsOfPeriod fa n) (ptsOfPeriod fb n) :=
(h.iterate_right n).mapsTo_fixedPoints
#align function.semiconj.maps_to_pts_of_period Function.Semiconj.mapsTo_ptsOfPeriod
theorem bijOn_ptsOfPeriod (f : α → α) {n : ℕ} (hn : 0 < n) :
BijOn f (ptsOfPeriod f n) (ptsOfPeriod f n) :=
⟨(Commute.refl f).mapsTo_ptsOfPeriod n, fun x hx y hy hxy => hx.eq_of_apply_eq_same hy hn hxy,
fun x hx =>
⟨f^[n.pred] x, hx.apply_iterate _, by
rw [← comp_apply (f := f), comp_iterate_pred_of_pos f hn, hx.eq]⟩⟩
#align function.bij_on_pts_of_period Function.bijOn_ptsOfPeriod
theorem directed_ptsOfPeriod_pNat (f : α → α) : Directed (· ⊆ ·) fun n : ℕ+ => ptsOfPeriod f n :=
fun m n => ⟨m * n, fun _ hx => hx.mul_const n, fun _ hx => hx.const_mul m⟩
#align function.directed_pts_of_period_pnat Function.directed_ptsOfPeriod_pNat
def periodicPts (f : α → α) : Set α :=
{ x : α | ∃ n > 0, IsPeriodicPt f n x }
#align function.periodic_pts Function.periodicPts
theorem mk_mem_periodicPts (hn : 0 < n) (hx : IsPeriodicPt f n x) : x ∈ periodicPts f :=
⟨n, hn, hx⟩
#align function.mk_mem_periodic_pts Function.mk_mem_periodicPts
theorem mem_periodicPts : x ∈ periodicPts f ↔ ∃ n > 0, IsPeriodicPt f n x :=
Iff.rfl
#align function.mem_periodic_pts Function.mem_periodicPts
theorem isPeriodicPt_of_mem_periodicPts_of_isPeriodicPt_iterate (hx : x ∈ periodicPts f)
(hm : IsPeriodicPt f m (f^[n] x)) : IsPeriodicPt f m x := by
rcases hx with ⟨r, hr, hr'⟩
suffices n ≤ (n / r + 1) * r by
-- Porting note: convert used to unfold IsPeriodicPt
change _ = _
convert (hm.apply_iterate ((n / r + 1) * r - n)).eq <;>
rw [← iterate_add_apply, Nat.sub_add_cancel this, iterate_mul, (hr'.iterate _).eq]
rw [add_mul, one_mul]
exact (Nat.lt_div_mul_add hr).le
#align function.is_periodic_pt_of_mem_periodic_pts_of_is_periodic_pt_iterate Function.isPeriodicPt_of_mem_periodicPts_of_isPeriodicPt_iterate
variable (f)
theorem bUnion_ptsOfPeriod : ⋃ n > 0, ptsOfPeriod f n = periodicPts f :=
Set.ext fun x => by simp [mem_periodicPts]
#align function.bUnion_pts_of_period Function.bUnion_ptsOfPeriod
theorem iUnion_pNat_ptsOfPeriod : ⋃ n : ℕ+, ptsOfPeriod f n = periodicPts f :=
iSup_subtype.trans <| bUnion_ptsOfPeriod f
#align function.Union_pnat_pts_of_period Function.iUnion_pNat_ptsOfPeriod
theorem bijOn_periodicPts : BijOn f (periodicPts f) (periodicPts f) :=
iUnion_pNat_ptsOfPeriod f ▸
bijOn_iUnion_of_directed (directed_ptsOfPeriod_pNat f) fun i => bijOn_ptsOfPeriod f i.pos
#align function.bij_on_periodic_pts Function.bijOn_periodicPts
variable {f}
theorem Semiconj.mapsTo_periodicPts {g : α → β} (h : Semiconj g fa fb) :
MapsTo g (periodicPts fa) (periodicPts fb) := fun _ ⟨n, hn, hx⟩ => ⟨n, hn, hx.map h⟩
#align function.semiconj.maps_to_periodic_pts Function.Semiconj.mapsTo_periodicPts
open scoped Classical
noncomputable section
def minimalPeriod (f : α → α) (x : α) :=
if h : x ∈ periodicPts f then Nat.find h else 0
#align function.minimal_period Function.minimalPeriod
theorem isPeriodicPt_minimalPeriod (f : α → α) (x : α) : IsPeriodicPt f (minimalPeriod f x) x := by
delta minimalPeriod
split_ifs with hx
· exact (Nat.find_spec hx).2
· exact isPeriodicPt_zero f x
#align function.is_periodic_pt_minimal_period Function.isPeriodicPt_minimalPeriod
@[simp]
theorem iterate_minimalPeriod : f^[minimalPeriod f x] x = x :=
isPeriodicPt_minimalPeriod f x
#align function.iterate_minimal_period Function.iterate_minimalPeriod
@[simp]
theorem iterate_add_minimalPeriod_eq : f^[n + minimalPeriod f x] x = f^[n] x := by
rw [iterate_add_apply]
congr
exact isPeriodicPt_minimalPeriod f x
#align function.iterate_add_minimal_period_eq Function.iterate_add_minimalPeriod_eq
@[simp]
theorem iterate_mod_minimalPeriod_eq : f^[n % minimalPeriod f x] x = f^[n] x :=
(isPeriodicPt_minimalPeriod f x).iterate_mod_apply n
#align function.iterate_mod_minimal_period_eq Function.iterate_mod_minimalPeriod_eq
theorem minimalPeriod_pos_of_mem_periodicPts (hx : x ∈ periodicPts f) : 0 < minimalPeriod f x := by
simp only [minimalPeriod, dif_pos hx, (Nat.find_spec hx).1.lt]
#align function.minimal_period_pos_of_mem_periodic_pts Function.minimalPeriod_pos_of_mem_periodicPts
theorem minimalPeriod_eq_zero_of_nmem_periodicPts (hx : x ∉ periodicPts f) :
minimalPeriod f x = 0 := by simp only [minimalPeriod, dif_neg hx]
#align function.minimal_period_eq_zero_of_nmem_periodic_pts Function.minimalPeriod_eq_zero_of_nmem_periodicPts
theorem IsPeriodicPt.minimalPeriod_pos (hn : 0 < n) (hx : IsPeriodicPt f n x) :
0 < minimalPeriod f x :=
minimalPeriod_pos_of_mem_periodicPts <| mk_mem_periodicPts hn hx
#align function.is_periodic_pt.minimal_period_pos Function.IsPeriodicPt.minimalPeriod_pos
theorem minimalPeriod_pos_iff_mem_periodicPts : 0 < minimalPeriod f x ↔ x ∈ periodicPts f :=
⟨not_imp_not.1 fun h => by simp only [minimalPeriod, dif_neg h, lt_irrefl 0, not_false_iff],
minimalPeriod_pos_of_mem_periodicPts⟩
#align function.minimal_period_pos_iff_mem_periodic_pts Function.minimalPeriod_pos_iff_mem_periodicPts
| Mathlib/Dynamics/PeriodicPts.lean | 321 | 322 | theorem minimalPeriod_eq_zero_iff_nmem_periodicPts : minimalPeriod f x = 0 ↔ x ∉ periodicPts f := by |
rw [← minimalPeriod_pos_iff_mem_periodicPts, not_lt, nonpos_iff_eq_zero]
|
import Mathlib.Analysis.Complex.Asymptotics
import Mathlib.Analysis.SpecificLimits.Normed
#align_import analysis.special_functions.exp from "leanprover-community/mathlib"@"ba5ff5ad5d120fb0ef094ad2994967e9bfaf5112"
noncomputable section
open Finset Filter Metric Asymptotics Set Function Bornology
open scoped Classical Topology Nat
namespace Complex
variable {z y x : ℝ}
theorem exp_bound_sq (x z : ℂ) (hz : ‖z‖ ≤ 1) :
‖exp (x + z) - exp x - z • exp x‖ ≤ ‖exp x‖ * ‖z‖ ^ 2 :=
calc
‖exp (x + z) - exp x - z * exp x‖ = ‖exp x * (exp z - 1 - z)‖ := by
congr
rw [exp_add]
ring
_ = ‖exp x‖ * ‖exp z - 1 - z‖ := norm_mul _ _
_ ≤ ‖exp x‖ * ‖z‖ ^ 2 :=
mul_le_mul_of_nonneg_left (abs_exp_sub_one_sub_id_le hz) (norm_nonneg _)
#align complex.exp_bound_sq Complex.exp_bound_sq
| Mathlib/Analysis/SpecialFunctions/Exp.lean | 45 | 61 | theorem locally_lipschitz_exp {r : ℝ} (hr_nonneg : 0 ≤ r) (hr_le : r ≤ 1) (x y : ℂ)
(hyx : ‖y - x‖ < r) : ‖exp y - exp x‖ ≤ (1 + r) * ‖exp x‖ * ‖y - x‖ := by |
have hy_eq : y = x + (y - x) := by abel
have hyx_sq_le : ‖y - x‖ ^ 2 ≤ r * ‖y - x‖ := by
rw [pow_two]
exact mul_le_mul hyx.le le_rfl (norm_nonneg _) hr_nonneg
have h_sq : ∀ z, ‖z‖ ≤ 1 → ‖exp (x + z) - exp x‖ ≤ ‖z‖ * ‖exp x‖ + ‖exp x‖ * ‖z‖ ^ 2 := by
intro z hz
have : ‖exp (x + z) - exp x - z • exp x‖ ≤ ‖exp x‖ * ‖z‖ ^ 2 := exp_bound_sq x z hz
rw [← sub_le_iff_le_add', ← norm_smul z]
exact (norm_sub_norm_le _ _).trans this
calc
‖exp y - exp x‖ = ‖exp (x + (y - x)) - exp x‖ := by nth_rw 1 [hy_eq]
_ ≤ ‖y - x‖ * ‖exp x‖ + ‖exp x‖ * ‖y - x‖ ^ 2 := h_sq (y - x) (hyx.le.trans hr_le)
_ ≤ ‖y - x‖ * ‖exp x‖ + ‖exp x‖ * (r * ‖y - x‖) :=
(add_le_add_left (mul_le_mul le_rfl hyx_sq_le (sq_nonneg _) (norm_nonneg _)) _)
_ = (1 + r) * ‖exp x‖ * ‖y - x‖ := by ring
|
import Mathlib.Init.ZeroOne
import Mathlib.Data.Set.Defs
import Mathlib.Order.Basic
import Mathlib.Order.SymmDiff
import Mathlib.Tactic.Tauto
import Mathlib.Tactic.ByContra
import Mathlib.Util.Delaborators
#align_import data.set.basic from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
open Function
universe u v w x
namespace Set
variable {α : Type u} {s t : Set α}
instance instBooleanAlgebraSet : BooleanAlgebra (Set α) :=
{ (inferInstance : BooleanAlgebra (α → Prop)) with
sup := (· ∪ ·),
le := (· ≤ ·),
lt := fun s t => s ⊆ t ∧ ¬t ⊆ s,
inf := (· ∩ ·),
bot := ∅,
compl := (·ᶜ),
top := univ,
sdiff := (· \ ·) }
instance : HasSSubset (Set α) :=
⟨(· < ·)⟩
@[simp]
theorem top_eq_univ : (⊤ : Set α) = univ :=
rfl
#align set.top_eq_univ Set.top_eq_univ
@[simp]
theorem bot_eq_empty : (⊥ : Set α) = ∅ :=
rfl
#align set.bot_eq_empty Set.bot_eq_empty
@[simp]
theorem sup_eq_union : ((· ⊔ ·) : Set α → Set α → Set α) = (· ∪ ·) :=
rfl
#align set.sup_eq_union Set.sup_eq_union
@[simp]
theorem inf_eq_inter : ((· ⊓ ·) : Set α → Set α → Set α) = (· ∩ ·) :=
rfl
#align set.inf_eq_inter Set.inf_eq_inter
@[simp]
theorem le_eq_subset : ((· ≤ ·) : Set α → Set α → Prop) = (· ⊆ ·) :=
rfl
#align set.le_eq_subset Set.le_eq_subset
@[simp]
theorem lt_eq_ssubset : ((· < ·) : Set α → Set α → Prop) = (· ⊂ ·) :=
rfl
#align set.lt_eq_ssubset Set.lt_eq_ssubset
theorem le_iff_subset : s ≤ t ↔ s ⊆ t :=
Iff.rfl
#align set.le_iff_subset Set.le_iff_subset
theorem lt_iff_ssubset : s < t ↔ s ⊂ t :=
Iff.rfl
#align set.lt_iff_ssubset Set.lt_iff_ssubset
alias ⟨_root_.LE.le.subset, _root_.HasSubset.Subset.le⟩ := le_iff_subset
#align has_subset.subset.le HasSubset.Subset.le
alias ⟨_root_.LT.lt.ssubset, _root_.HasSSubset.SSubset.lt⟩ := lt_iff_ssubset
#align has_ssubset.ssubset.lt HasSSubset.SSubset.lt
instance PiSetCoe.canLift (ι : Type u) (α : ι → Type v) [∀ i, Nonempty (α i)] (s : Set ι) :
CanLift (∀ i : s, α i) (∀ i, α i) (fun f i => f i) fun _ => True :=
PiSubtype.canLift ι α s
#align set.pi_set_coe.can_lift Set.PiSetCoe.canLift
instance PiSetCoe.canLift' (ι : Type u) (α : Type v) [Nonempty α] (s : Set ι) :
CanLift (s → α) (ι → α) (fun f i => f i) fun _ => True :=
PiSetCoe.canLift ι (fun _ => α) s
#align set.pi_set_coe.can_lift' Set.PiSetCoe.canLift'
end Set
theorem Subtype.mem {α : Type*} {s : Set α} (p : s) : (p : α) ∈ s :=
p.prop
#align subtype.mem Subtype.mem
theorem Eq.subset {α} {s t : Set α} : s = t → s ⊆ t :=
fun h₁ _ h₂ => by rw [← h₁]; exact h₂
#align eq.subset Eq.subset
namespace Set
variable {α : Type u} {β : Type v} {γ : Type w} {ι : Sort x} {a b : α} {s s₁ s₂ t t₁ t₂ u : Set α}
instance : Inhabited (Set α) :=
⟨∅⟩
theorem ext_iff {s t : Set α} : s = t ↔ ∀ x, x ∈ s ↔ x ∈ t :=
⟨fun h x => by rw [h], ext⟩
#align set.ext_iff Set.ext_iff
@[trans]
theorem mem_of_mem_of_subset {x : α} {s t : Set α} (hx : x ∈ s) (h : s ⊆ t) : x ∈ t :=
h hx
#align set.mem_of_mem_of_subset Set.mem_of_mem_of_subset
theorem forall_in_swap {p : α → β → Prop} : (∀ a ∈ s, ∀ (b), p a b) ↔ ∀ (b), ∀ a ∈ s, p a b := by
tauto
#align set.forall_in_swap Set.forall_in_swap
theorem mem_setOf {a : α} {p : α → Prop} : a ∈ { x | p x } ↔ p a :=
Iff.rfl
#align set.mem_set_of Set.mem_setOf
theorem _root_.Membership.mem.out {p : α → Prop} {a : α} (h : a ∈ { x | p x }) : p a :=
h
#align has_mem.mem.out Membership.mem.out
theorem nmem_setOf_iff {a : α} {p : α → Prop} : a ∉ { x | p x } ↔ ¬p a :=
Iff.rfl
#align set.nmem_set_of_iff Set.nmem_setOf_iff
@[simp]
theorem setOf_mem_eq {s : Set α} : { x | x ∈ s } = s :=
rfl
#align set.set_of_mem_eq Set.setOf_mem_eq
theorem setOf_set {s : Set α} : setOf s = s :=
rfl
#align set.set_of_set Set.setOf_set
theorem setOf_app_iff {p : α → Prop} {x : α} : { x | p x } x ↔ p x :=
Iff.rfl
#align set.set_of_app_iff Set.setOf_app_iff
theorem mem_def {a : α} {s : Set α} : a ∈ s ↔ s a :=
Iff.rfl
#align set.mem_def Set.mem_def
theorem setOf_bijective : Bijective (setOf : (α → Prop) → Set α) :=
bijective_id
#align set.set_of_bijective Set.setOf_bijective
theorem subset_setOf {p : α → Prop} {s : Set α} : s ⊆ setOf p ↔ ∀ x, x ∈ s → p x :=
Iff.rfl
theorem setOf_subset {p : α → Prop} {s : Set α} : setOf p ⊆ s ↔ ∀ x, p x → x ∈ s :=
Iff.rfl
@[simp]
theorem setOf_subset_setOf {p q : α → Prop} : { a | p a } ⊆ { a | q a } ↔ ∀ a, p a → q a :=
Iff.rfl
#align set.set_of_subset_set_of Set.setOf_subset_setOf
theorem setOf_and {p q : α → Prop} : { a | p a ∧ q a } = { a | p a } ∩ { a | q a } :=
rfl
#align set.set_of_and Set.setOf_and
theorem setOf_or {p q : α → Prop} : { a | p a ∨ q a } = { a | p a } ∪ { a | q a } :=
rfl
#align set.set_of_or Set.setOf_or
instance : IsRefl (Set α) (· ⊆ ·) :=
show IsRefl (Set α) (· ≤ ·) by infer_instance
instance : IsTrans (Set α) (· ⊆ ·) :=
show IsTrans (Set α) (· ≤ ·) by infer_instance
instance : Trans ((· ⊆ ·) : Set α → Set α → Prop) (· ⊆ ·) (· ⊆ ·) :=
show Trans (· ≤ ·) (· ≤ ·) (· ≤ ·) by infer_instance
instance : IsAntisymm (Set α) (· ⊆ ·) :=
show IsAntisymm (Set α) (· ≤ ·) by infer_instance
instance : IsIrrefl (Set α) (· ⊂ ·) :=
show IsIrrefl (Set α) (· < ·) by infer_instance
instance : IsTrans (Set α) (· ⊂ ·) :=
show IsTrans (Set α) (· < ·) by infer_instance
instance : Trans ((· ⊂ ·) : Set α → Set α → Prop) (· ⊂ ·) (· ⊂ ·) :=
show Trans (· < ·) (· < ·) (· < ·) by infer_instance
instance : Trans ((· ⊂ ·) : Set α → Set α → Prop) (· ⊆ ·) (· ⊂ ·) :=
show Trans (· < ·) (· ≤ ·) (· < ·) by infer_instance
instance : Trans ((· ⊆ ·) : Set α → Set α → Prop) (· ⊂ ·) (· ⊂ ·) :=
show Trans (· ≤ ·) (· < ·) (· < ·) by infer_instance
instance : IsAsymm (Set α) (· ⊂ ·) :=
show IsAsymm (Set α) (· < ·) by infer_instance
instance : IsNonstrictStrictOrder (Set α) (· ⊆ ·) (· ⊂ ·) :=
⟨fun _ _ => Iff.rfl⟩
-- TODO(Jeremy): write a tactic to unfold specific instances of generic notation?
theorem subset_def : (s ⊆ t) = ∀ x, x ∈ s → x ∈ t :=
rfl
#align set.subset_def Set.subset_def
theorem ssubset_def : (s ⊂ t) = (s ⊆ t ∧ ¬t ⊆ s) :=
rfl
#align set.ssubset_def Set.ssubset_def
@[refl]
theorem Subset.refl (a : Set α) : a ⊆ a := fun _ => id
#align set.subset.refl Set.Subset.refl
theorem Subset.rfl {s : Set α} : s ⊆ s :=
Subset.refl s
#align set.subset.rfl Set.Subset.rfl
@[trans]
theorem Subset.trans {a b c : Set α} (ab : a ⊆ b) (bc : b ⊆ c) : a ⊆ c := fun _ h => bc <| ab h
#align set.subset.trans Set.Subset.trans
@[trans]
theorem mem_of_eq_of_mem {x y : α} {s : Set α} (hx : x = y) (h : y ∈ s) : x ∈ s :=
hx.symm ▸ h
#align set.mem_of_eq_of_mem Set.mem_of_eq_of_mem
theorem Subset.antisymm {a b : Set α} (h₁ : a ⊆ b) (h₂ : b ⊆ a) : a = b :=
Set.ext fun _ => ⟨@h₁ _, @h₂ _⟩
#align set.subset.antisymm Set.Subset.antisymm
theorem Subset.antisymm_iff {a b : Set α} : a = b ↔ a ⊆ b ∧ b ⊆ a :=
⟨fun e => ⟨e.subset, e.symm.subset⟩, fun ⟨h₁, h₂⟩ => Subset.antisymm h₁ h₂⟩
#align set.subset.antisymm_iff Set.Subset.antisymm_iff
-- an alternative name
theorem eq_of_subset_of_subset {a b : Set α} : a ⊆ b → b ⊆ a → a = b :=
Subset.antisymm
#align set.eq_of_subset_of_subset Set.eq_of_subset_of_subset
theorem mem_of_subset_of_mem {s₁ s₂ : Set α} {a : α} (h : s₁ ⊆ s₂) : a ∈ s₁ → a ∈ s₂ :=
@h _
#align set.mem_of_subset_of_mem Set.mem_of_subset_of_mem
theorem not_mem_subset (h : s ⊆ t) : a ∉ t → a ∉ s :=
mt <| mem_of_subset_of_mem h
#align set.not_mem_subset Set.not_mem_subset
theorem not_subset : ¬s ⊆ t ↔ ∃ a ∈ s, a ∉ t := by
simp only [subset_def, not_forall, exists_prop]
#align set.not_subset Set.not_subset
lemma eq_of_forall_subset_iff (h : ∀ u, s ⊆ u ↔ t ⊆ u) : s = t := eq_of_forall_ge_iff h
protected theorem eq_or_ssubset_of_subset (h : s ⊆ t) : s = t ∨ s ⊂ t :=
eq_or_lt_of_le h
#align set.eq_or_ssubset_of_subset Set.eq_or_ssubset_of_subset
theorem exists_of_ssubset {s t : Set α} (h : s ⊂ t) : ∃ x ∈ t, x ∉ s :=
not_subset.1 h.2
#align set.exists_of_ssubset Set.exists_of_ssubset
protected theorem ssubset_iff_subset_ne {s t : Set α} : s ⊂ t ↔ s ⊆ t ∧ s ≠ t :=
@lt_iff_le_and_ne (Set α) _ s t
#align set.ssubset_iff_subset_ne Set.ssubset_iff_subset_ne
theorem ssubset_iff_of_subset {s t : Set α} (h : s ⊆ t) : s ⊂ t ↔ ∃ x ∈ t, x ∉ s :=
⟨exists_of_ssubset, fun ⟨_, hxt, hxs⟩ => ⟨h, fun h => hxs <| h hxt⟩⟩
#align set.ssubset_iff_of_subset Set.ssubset_iff_of_subset
protected theorem ssubset_of_ssubset_of_subset {s₁ s₂ s₃ : Set α} (hs₁s₂ : s₁ ⊂ s₂)
(hs₂s₃ : s₂ ⊆ s₃) : s₁ ⊂ s₃ :=
⟨Subset.trans hs₁s₂.1 hs₂s₃, fun hs₃s₁ => hs₁s₂.2 (Subset.trans hs₂s₃ hs₃s₁)⟩
#align set.ssubset_of_ssubset_of_subset Set.ssubset_of_ssubset_of_subset
protected theorem ssubset_of_subset_of_ssubset {s₁ s₂ s₃ : Set α} (hs₁s₂ : s₁ ⊆ s₂)
(hs₂s₃ : s₂ ⊂ s₃) : s₁ ⊂ s₃ :=
⟨Subset.trans hs₁s₂ hs₂s₃.1, fun hs₃s₁ => hs₂s₃.2 (Subset.trans hs₃s₁ hs₁s₂)⟩
#align set.ssubset_of_subset_of_ssubset Set.ssubset_of_subset_of_ssubset
theorem not_mem_empty (x : α) : ¬x ∈ (∅ : Set α) :=
id
#align set.not_mem_empty Set.not_mem_empty
-- Porting note (#10618): removed `simp` because `simp` can prove it
theorem not_not_mem : ¬a ∉ s ↔ a ∈ s :=
not_not
#align set.not_not_mem Set.not_not_mem
-- Porting note: we seem to need parentheses at `(↥s)`,
-- even if we increase the right precedence of `↥` in `Mathlib.Tactic.Coe`.
-- Porting note: removed `simp` as it is competing with `nonempty_subtype`.
-- @[simp]
theorem nonempty_coe_sort {s : Set α} : Nonempty (↥s) ↔ s.Nonempty :=
nonempty_subtype
#align set.nonempty_coe_sort Set.nonempty_coe_sort
alias ⟨_, Nonempty.coe_sort⟩ := nonempty_coe_sort
#align set.nonempty.coe_sort Set.Nonempty.coe_sort
theorem nonempty_def : s.Nonempty ↔ ∃ x, x ∈ s :=
Iff.rfl
#align set.nonempty_def Set.nonempty_def
theorem nonempty_of_mem {x} (h : x ∈ s) : s.Nonempty :=
⟨x, h⟩
#align set.nonempty_of_mem Set.nonempty_of_mem
theorem Nonempty.not_subset_empty : s.Nonempty → ¬s ⊆ ∅
| ⟨_, hx⟩, hs => hs hx
#align set.nonempty.not_subset_empty Set.Nonempty.not_subset_empty
protected noncomputable def Nonempty.some (h : s.Nonempty) : α :=
Classical.choose h
#align set.nonempty.some Set.Nonempty.some
protected theorem Nonempty.some_mem (h : s.Nonempty) : h.some ∈ s :=
Classical.choose_spec h
#align set.nonempty.some_mem Set.Nonempty.some_mem
theorem Nonempty.mono (ht : s ⊆ t) (hs : s.Nonempty) : t.Nonempty :=
hs.imp ht
#align set.nonempty.mono Set.Nonempty.mono
theorem nonempty_of_not_subset (h : ¬s ⊆ t) : (s \ t).Nonempty :=
let ⟨x, xs, xt⟩ := not_subset.1 h
⟨x, xs, xt⟩
#align set.nonempty_of_not_subset Set.nonempty_of_not_subset
theorem nonempty_of_ssubset (ht : s ⊂ t) : (t \ s).Nonempty :=
nonempty_of_not_subset ht.2
#align set.nonempty_of_ssubset Set.nonempty_of_ssubset
theorem Nonempty.of_diff (h : (s \ t).Nonempty) : s.Nonempty :=
h.imp fun _ => And.left
#align set.nonempty.of_diff Set.Nonempty.of_diff
theorem nonempty_of_ssubset' (ht : s ⊂ t) : t.Nonempty :=
(nonempty_of_ssubset ht).of_diff
#align set.nonempty_of_ssubset' Set.nonempty_of_ssubset'
theorem Nonempty.inl (hs : s.Nonempty) : (s ∪ t).Nonempty :=
hs.imp fun _ => Or.inl
#align set.nonempty.inl Set.Nonempty.inl
theorem Nonempty.inr (ht : t.Nonempty) : (s ∪ t).Nonempty :=
ht.imp fun _ => Or.inr
#align set.nonempty.inr Set.Nonempty.inr
@[simp]
theorem union_nonempty : (s ∪ t).Nonempty ↔ s.Nonempty ∨ t.Nonempty :=
exists_or
#align set.union_nonempty Set.union_nonempty
theorem Nonempty.left (h : (s ∩ t).Nonempty) : s.Nonempty :=
h.imp fun _ => And.left
#align set.nonempty.left Set.Nonempty.left
theorem Nonempty.right (h : (s ∩ t).Nonempty) : t.Nonempty :=
h.imp fun _ => And.right
#align set.nonempty.right Set.Nonempty.right
theorem inter_nonempty : (s ∩ t).Nonempty ↔ ∃ x, x ∈ s ∧ x ∈ t :=
Iff.rfl
#align set.inter_nonempty Set.inter_nonempty
theorem inter_nonempty_iff_exists_left : (s ∩ t).Nonempty ↔ ∃ x ∈ s, x ∈ t := by
simp_rw [inter_nonempty]
#align set.inter_nonempty_iff_exists_left Set.inter_nonempty_iff_exists_left
theorem inter_nonempty_iff_exists_right : (s ∩ t).Nonempty ↔ ∃ x ∈ t, x ∈ s := by
simp_rw [inter_nonempty, and_comm]
#align set.inter_nonempty_iff_exists_right Set.inter_nonempty_iff_exists_right
theorem nonempty_iff_univ_nonempty : Nonempty α ↔ (univ : Set α).Nonempty :=
⟨fun ⟨x⟩ => ⟨x, trivial⟩, fun ⟨x, _⟩ => ⟨x⟩⟩
#align set.nonempty_iff_univ_nonempty Set.nonempty_iff_univ_nonempty
@[simp]
theorem univ_nonempty : ∀ [Nonempty α], (univ : Set α).Nonempty
| ⟨x⟩ => ⟨x, trivial⟩
#align set.univ_nonempty Set.univ_nonempty
theorem Nonempty.to_subtype : s.Nonempty → Nonempty (↥s) :=
nonempty_subtype.2
#align set.nonempty.to_subtype Set.Nonempty.to_subtype
theorem Nonempty.to_type : s.Nonempty → Nonempty α := fun ⟨x, _⟩ => ⟨x⟩
#align set.nonempty.to_type Set.Nonempty.to_type
instance univ.nonempty [Nonempty α] : Nonempty (↥(Set.univ : Set α)) :=
Set.univ_nonempty.to_subtype
#align set.univ.nonempty Set.univ.nonempty
theorem nonempty_of_nonempty_subtype [Nonempty (↥s)] : s.Nonempty :=
nonempty_subtype.mp ‹_›
#align set.nonempty_of_nonempty_subtype Set.nonempty_of_nonempty_subtype
theorem empty_def : (∅ : Set α) = { _x : α | False } :=
rfl
#align set.empty_def Set.empty_def
@[simp]
theorem mem_empty_iff_false (x : α) : x ∈ (∅ : Set α) ↔ False :=
Iff.rfl
#align set.mem_empty_iff_false Set.mem_empty_iff_false
@[simp]
theorem setOf_false : { _a : α | False } = ∅ :=
rfl
#align set.set_of_false Set.setOf_false
@[simp] theorem setOf_bot : { _x : α | ⊥ } = ∅ := rfl
@[simp]
theorem empty_subset (s : Set α) : ∅ ⊆ s :=
nofun
#align set.empty_subset Set.empty_subset
theorem subset_empty_iff {s : Set α} : s ⊆ ∅ ↔ s = ∅ :=
(Subset.antisymm_iff.trans <| and_iff_left (empty_subset _)).symm
#align set.subset_empty_iff Set.subset_empty_iff
theorem eq_empty_iff_forall_not_mem {s : Set α} : s = ∅ ↔ ∀ x, x ∉ s :=
subset_empty_iff.symm
#align set.eq_empty_iff_forall_not_mem Set.eq_empty_iff_forall_not_mem
theorem eq_empty_of_forall_not_mem (h : ∀ x, x ∉ s) : s = ∅ :=
subset_empty_iff.1 h
#align set.eq_empty_of_forall_not_mem Set.eq_empty_of_forall_not_mem
theorem eq_empty_of_subset_empty {s : Set α} : s ⊆ ∅ → s = ∅ :=
subset_empty_iff.1
#align set.eq_empty_of_subset_empty Set.eq_empty_of_subset_empty
theorem eq_empty_of_isEmpty [IsEmpty α] (s : Set α) : s = ∅ :=
eq_empty_of_subset_empty fun x _ => isEmptyElim x
#align set.eq_empty_of_is_empty Set.eq_empty_of_isEmpty
instance uniqueEmpty [IsEmpty α] : Unique (Set α) where
default := ∅
uniq := eq_empty_of_isEmpty
#align set.unique_empty Set.uniqueEmpty
theorem not_nonempty_iff_eq_empty {s : Set α} : ¬s.Nonempty ↔ s = ∅ := by
simp only [Set.Nonempty, not_exists, eq_empty_iff_forall_not_mem]
#align set.not_nonempty_iff_eq_empty Set.not_nonempty_iff_eq_empty
theorem nonempty_iff_ne_empty : s.Nonempty ↔ s ≠ ∅ :=
not_nonempty_iff_eq_empty.not_right
#align set.nonempty_iff_ne_empty Set.nonempty_iff_ne_empty
theorem not_nonempty_iff_eq_empty' : ¬Nonempty s ↔ s = ∅ := by
rw [nonempty_subtype, not_exists, eq_empty_iff_forall_not_mem]
theorem nonempty_iff_ne_empty' : Nonempty s ↔ s ≠ ∅ :=
not_nonempty_iff_eq_empty'.not_right
alias ⟨Nonempty.ne_empty, _⟩ := nonempty_iff_ne_empty
#align set.nonempty.ne_empty Set.Nonempty.ne_empty
@[simp]
theorem not_nonempty_empty : ¬(∅ : Set α).Nonempty := fun ⟨_, hx⟩ => hx
#align set.not_nonempty_empty Set.not_nonempty_empty
-- Porting note: removing `@[simp]` as it is competing with `isEmpty_subtype`.
-- @[simp]
theorem isEmpty_coe_sort {s : Set α} : IsEmpty (↥s) ↔ s = ∅ :=
not_iff_not.1 <| by simpa using nonempty_iff_ne_empty
#align set.is_empty_coe_sort Set.isEmpty_coe_sort
theorem eq_empty_or_nonempty (s : Set α) : s = ∅ ∨ s.Nonempty :=
or_iff_not_imp_left.2 nonempty_iff_ne_empty.2
#align set.eq_empty_or_nonempty Set.eq_empty_or_nonempty
theorem subset_eq_empty {s t : Set α} (h : t ⊆ s) (e : s = ∅) : t = ∅ :=
subset_empty_iff.1 <| e ▸ h
#align set.subset_eq_empty Set.subset_eq_empty
theorem forall_mem_empty {p : α → Prop} : (∀ x ∈ (∅ : Set α), p x) ↔ True :=
iff_true_intro fun _ => False.elim
#align set.ball_empty_iff Set.forall_mem_empty
@[deprecated (since := "2024-03-23")] alias ball_empty_iff := forall_mem_empty
instance (α : Type u) : IsEmpty.{u + 1} (↥(∅ : Set α)) :=
⟨fun x => x.2⟩
@[simp]
theorem empty_ssubset : ∅ ⊂ s ↔ s.Nonempty :=
(@bot_lt_iff_ne_bot (Set α) _ _ _).trans nonempty_iff_ne_empty.symm
#align set.empty_ssubset Set.empty_ssubset
alias ⟨_, Nonempty.empty_ssubset⟩ := empty_ssubset
#align set.nonempty.empty_ssubset Set.Nonempty.empty_ssubset
@[simp]
theorem setOf_true : { _x : α | True } = univ :=
rfl
#align set.set_of_true Set.setOf_true
@[simp] theorem setOf_top : { _x : α | ⊤ } = univ := rfl
@[simp]
theorem univ_eq_empty_iff : (univ : Set α) = ∅ ↔ IsEmpty α :=
eq_empty_iff_forall_not_mem.trans
⟨fun H => ⟨fun x => H x trivial⟩, fun H x _ => @IsEmpty.false α H x⟩
#align set.univ_eq_empty_iff Set.univ_eq_empty_iff
theorem empty_ne_univ [Nonempty α] : (∅ : Set α) ≠ univ := fun e =>
not_isEmpty_of_nonempty α <| univ_eq_empty_iff.1 e.symm
#align set.empty_ne_univ Set.empty_ne_univ
@[simp]
theorem subset_univ (s : Set α) : s ⊆ univ := fun _ _ => trivial
#align set.subset_univ Set.subset_univ
@[simp]
theorem univ_subset_iff {s : Set α} : univ ⊆ s ↔ s = univ :=
@top_le_iff _ _ _ s
#align set.univ_subset_iff Set.univ_subset_iff
alias ⟨eq_univ_of_univ_subset, _⟩ := univ_subset_iff
#align set.eq_univ_of_univ_subset Set.eq_univ_of_univ_subset
theorem eq_univ_iff_forall {s : Set α} : s = univ ↔ ∀ x, x ∈ s :=
univ_subset_iff.symm.trans <| forall_congr' fun _ => imp_iff_right trivial
#align set.eq_univ_iff_forall Set.eq_univ_iff_forall
theorem eq_univ_of_forall {s : Set α} : (∀ x, x ∈ s) → s = univ :=
eq_univ_iff_forall.2
#align set.eq_univ_of_forall Set.eq_univ_of_forall
theorem Nonempty.eq_univ [Subsingleton α] : s.Nonempty → s = univ := by
rintro ⟨x, hx⟩
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align set.nonempty.eq_univ Set.Nonempty.eq_univ
theorem eq_univ_of_subset {s t : Set α} (h : s ⊆ t) (hs : s = univ) : t = univ :=
eq_univ_of_univ_subset <| (hs ▸ h : univ ⊆ t)
#align set.eq_univ_of_subset Set.eq_univ_of_subset
theorem exists_mem_of_nonempty (α) : ∀ [Nonempty α], ∃ x : α, x ∈ (univ : Set α)
| ⟨x⟩ => ⟨x, trivial⟩
#align set.exists_mem_of_nonempty Set.exists_mem_of_nonempty
theorem ne_univ_iff_exists_not_mem {α : Type*} (s : Set α) : s ≠ univ ↔ ∃ a, a ∉ s := by
rw [← not_forall, ← eq_univ_iff_forall]
#align set.ne_univ_iff_exists_not_mem Set.ne_univ_iff_exists_not_mem
theorem not_subset_iff_exists_mem_not_mem {α : Type*} {s t : Set α} :
¬s ⊆ t ↔ ∃ x, x ∈ s ∧ x ∉ t := by simp [subset_def]
#align set.not_subset_iff_exists_mem_not_mem Set.not_subset_iff_exists_mem_not_mem
theorem univ_unique [Unique α] : @Set.univ α = {default} :=
Set.ext fun x => iff_of_true trivial <| Subsingleton.elim x default
#align set.univ_unique Set.univ_unique
theorem ssubset_univ_iff : s ⊂ univ ↔ s ≠ univ :=
lt_top_iff_ne_top
#align set.ssubset_univ_iff Set.ssubset_univ_iff
instance nontrivial_of_nonempty [Nonempty α] : Nontrivial (Set α) :=
⟨⟨∅, univ, empty_ne_univ⟩⟩
#align set.nontrivial_of_nonempty Set.nontrivial_of_nonempty
theorem union_def {s₁ s₂ : Set α} : s₁ ∪ s₂ = { a | a ∈ s₁ ∨ a ∈ s₂ } :=
rfl
#align set.union_def Set.union_def
theorem mem_union_left {x : α} {a : Set α} (b : Set α) : x ∈ a → x ∈ a ∪ b :=
Or.inl
#align set.mem_union_left Set.mem_union_left
theorem mem_union_right {x : α} {b : Set α} (a : Set α) : x ∈ b → x ∈ a ∪ b :=
Or.inr
#align set.mem_union_right Set.mem_union_right
theorem mem_or_mem_of_mem_union {x : α} {a b : Set α} (H : x ∈ a ∪ b) : x ∈ a ∨ x ∈ b :=
H
#align set.mem_or_mem_of_mem_union Set.mem_or_mem_of_mem_union
theorem MemUnion.elim {x : α} {a b : Set α} {P : Prop} (H₁ : x ∈ a ∪ b) (H₂ : x ∈ a → P)
(H₃ : x ∈ b → P) : P :=
Or.elim H₁ H₂ H₃
#align set.mem_union.elim Set.MemUnion.elim
@[simp]
theorem mem_union (x : α) (a b : Set α) : x ∈ a ∪ b ↔ x ∈ a ∨ x ∈ b :=
Iff.rfl
#align set.mem_union Set.mem_union
@[simp]
theorem union_self (a : Set α) : a ∪ a = a :=
ext fun _ => or_self_iff
#align set.union_self Set.union_self
@[simp]
theorem union_empty (a : Set α) : a ∪ ∅ = a :=
ext fun _ => or_false_iff _
#align set.union_empty Set.union_empty
@[simp]
theorem empty_union (a : Set α) : ∅ ∪ a = a :=
ext fun _ => false_or_iff _
#align set.empty_union Set.empty_union
theorem union_comm (a b : Set α) : a ∪ b = b ∪ a :=
ext fun _ => or_comm
#align set.union_comm Set.union_comm
theorem union_assoc (a b c : Set α) : a ∪ b ∪ c = a ∪ (b ∪ c) :=
ext fun _ => or_assoc
#align set.union_assoc Set.union_assoc
instance union_isAssoc : Std.Associative (α := Set α) (· ∪ ·) :=
⟨union_assoc⟩
#align set.union_is_assoc Set.union_isAssoc
instance union_isComm : Std.Commutative (α := Set α) (· ∪ ·) :=
⟨union_comm⟩
#align set.union_is_comm Set.union_isComm
theorem union_left_comm (s₁ s₂ s₃ : Set α) : s₁ ∪ (s₂ ∪ s₃) = s₂ ∪ (s₁ ∪ s₃) :=
ext fun _ => or_left_comm
#align set.union_left_comm Set.union_left_comm
theorem union_right_comm (s₁ s₂ s₃ : Set α) : s₁ ∪ s₂ ∪ s₃ = s₁ ∪ s₃ ∪ s₂ :=
ext fun _ => or_right_comm
#align set.union_right_comm Set.union_right_comm
@[simp]
theorem union_eq_left {s t : Set α} : s ∪ t = s ↔ t ⊆ s :=
sup_eq_left
#align set.union_eq_left_iff_subset Set.union_eq_left
@[simp]
theorem union_eq_right {s t : Set α} : s ∪ t = t ↔ s ⊆ t :=
sup_eq_right
#align set.union_eq_right_iff_subset Set.union_eq_right
theorem union_eq_self_of_subset_left {s t : Set α} (h : s ⊆ t) : s ∪ t = t :=
union_eq_right.mpr h
#align set.union_eq_self_of_subset_left Set.union_eq_self_of_subset_left
theorem union_eq_self_of_subset_right {s t : Set α} (h : t ⊆ s) : s ∪ t = s :=
union_eq_left.mpr h
#align set.union_eq_self_of_subset_right Set.union_eq_self_of_subset_right
@[simp]
theorem subset_union_left {s t : Set α} : s ⊆ s ∪ t := fun _ => Or.inl
#align set.subset_union_left Set.subset_union_left
@[simp]
theorem subset_union_right {s t : Set α} : t ⊆ s ∪ t := fun _ => Or.inr
#align set.subset_union_right Set.subset_union_right
theorem union_subset {s t r : Set α} (sr : s ⊆ r) (tr : t ⊆ r) : s ∪ t ⊆ r := fun _ =>
Or.rec (@sr _) (@tr _)
#align set.union_subset Set.union_subset
@[simp]
theorem union_subset_iff {s t u : Set α} : s ∪ t ⊆ u ↔ s ⊆ u ∧ t ⊆ u :=
(forall_congr' fun _ => or_imp).trans forall_and
#align set.union_subset_iff Set.union_subset_iff
@[gcongr]
theorem union_subset_union {s₁ s₂ t₁ t₂ : Set α} (h₁ : s₁ ⊆ s₂) (h₂ : t₁ ⊆ t₂) :
s₁ ∪ t₁ ⊆ s₂ ∪ t₂ := fun _ => Or.imp (@h₁ _) (@h₂ _)
#align set.union_subset_union Set.union_subset_union
@[gcongr]
theorem union_subset_union_left {s₁ s₂ : Set α} (t) (h : s₁ ⊆ s₂) : s₁ ∪ t ⊆ s₂ ∪ t :=
union_subset_union h Subset.rfl
#align set.union_subset_union_left Set.union_subset_union_left
@[gcongr]
theorem union_subset_union_right (s) {t₁ t₂ : Set α} (h : t₁ ⊆ t₂) : s ∪ t₁ ⊆ s ∪ t₂ :=
union_subset_union Subset.rfl h
#align set.union_subset_union_right Set.union_subset_union_right
theorem subset_union_of_subset_left {s t : Set α} (h : s ⊆ t) (u : Set α) : s ⊆ t ∪ u :=
h.trans subset_union_left
#align set.subset_union_of_subset_left Set.subset_union_of_subset_left
theorem subset_union_of_subset_right {s u : Set α} (h : s ⊆ u) (t : Set α) : s ⊆ t ∪ u :=
h.trans subset_union_right
#align set.subset_union_of_subset_right Set.subset_union_of_subset_right
-- Porting note: replaced `⊔` in RHS
theorem union_congr_left (ht : t ⊆ s ∪ u) (hu : u ⊆ s ∪ t) : s ∪ t = s ∪ u :=
sup_congr_left ht hu
#align set.union_congr_left Set.union_congr_left
theorem union_congr_right (hs : s ⊆ t ∪ u) (ht : t ⊆ s ∪ u) : s ∪ u = t ∪ u :=
sup_congr_right hs ht
#align set.union_congr_right Set.union_congr_right
theorem union_eq_union_iff_left : s ∪ t = s ∪ u ↔ t ⊆ s ∪ u ∧ u ⊆ s ∪ t :=
sup_eq_sup_iff_left
#align set.union_eq_union_iff_left Set.union_eq_union_iff_left
theorem union_eq_union_iff_right : s ∪ u = t ∪ u ↔ s ⊆ t ∪ u ∧ t ⊆ s ∪ u :=
sup_eq_sup_iff_right
#align set.union_eq_union_iff_right Set.union_eq_union_iff_right
@[simp]
theorem union_empty_iff {s t : Set α} : s ∪ t = ∅ ↔ s = ∅ ∧ t = ∅ := by
simp only [← subset_empty_iff]
exact union_subset_iff
#align set.union_empty_iff Set.union_empty_iff
@[simp]
theorem union_univ (s : Set α) : s ∪ univ = univ := sup_top_eq _
#align set.union_univ Set.union_univ
@[simp]
theorem univ_union (s : Set α) : univ ∪ s = univ := top_sup_eq _
#align set.univ_union Set.univ_union
theorem inter_def {s₁ s₂ : Set α} : s₁ ∩ s₂ = { a | a ∈ s₁ ∧ a ∈ s₂ } :=
rfl
#align set.inter_def Set.inter_def
@[simp, mfld_simps]
theorem mem_inter_iff (x : α) (a b : Set α) : x ∈ a ∩ b ↔ x ∈ a ∧ x ∈ b :=
Iff.rfl
#align set.mem_inter_iff Set.mem_inter_iff
theorem mem_inter {x : α} {a b : Set α} (ha : x ∈ a) (hb : x ∈ b) : x ∈ a ∩ b :=
⟨ha, hb⟩
#align set.mem_inter Set.mem_inter
theorem mem_of_mem_inter_left {x : α} {a b : Set α} (h : x ∈ a ∩ b) : x ∈ a :=
h.left
#align set.mem_of_mem_inter_left Set.mem_of_mem_inter_left
theorem mem_of_mem_inter_right {x : α} {a b : Set α} (h : x ∈ a ∩ b) : x ∈ b :=
h.right
#align set.mem_of_mem_inter_right Set.mem_of_mem_inter_right
@[simp]
theorem inter_self (a : Set α) : a ∩ a = a :=
ext fun _ => and_self_iff
#align set.inter_self Set.inter_self
@[simp]
theorem inter_empty (a : Set α) : a ∩ ∅ = ∅ :=
ext fun _ => and_false_iff _
#align set.inter_empty Set.inter_empty
@[simp]
theorem empty_inter (a : Set α) : ∅ ∩ a = ∅ :=
ext fun _ => false_and_iff _
#align set.empty_inter Set.empty_inter
theorem inter_comm (a b : Set α) : a ∩ b = b ∩ a :=
ext fun _ => and_comm
#align set.inter_comm Set.inter_comm
theorem inter_assoc (a b c : Set α) : a ∩ b ∩ c = a ∩ (b ∩ c) :=
ext fun _ => and_assoc
#align set.inter_assoc Set.inter_assoc
instance inter_isAssoc : Std.Associative (α := Set α) (· ∩ ·) :=
⟨inter_assoc⟩
#align set.inter_is_assoc Set.inter_isAssoc
instance inter_isComm : Std.Commutative (α := Set α) (· ∩ ·) :=
⟨inter_comm⟩
#align set.inter_is_comm Set.inter_isComm
theorem inter_left_comm (s₁ s₂ s₃ : Set α) : s₁ ∩ (s₂ ∩ s₃) = s₂ ∩ (s₁ ∩ s₃) :=
ext fun _ => and_left_comm
#align set.inter_left_comm Set.inter_left_comm
theorem inter_right_comm (s₁ s₂ s₃ : Set α) : s₁ ∩ s₂ ∩ s₃ = s₁ ∩ s₃ ∩ s₂ :=
ext fun _ => and_right_comm
#align set.inter_right_comm Set.inter_right_comm
@[simp, mfld_simps]
theorem inter_subset_left {s t : Set α} : s ∩ t ⊆ s := fun _ => And.left
#align set.inter_subset_left Set.inter_subset_left
@[simp]
theorem inter_subset_right {s t : Set α} : s ∩ t ⊆ t := fun _ => And.right
#align set.inter_subset_right Set.inter_subset_right
theorem subset_inter {s t r : Set α} (rs : r ⊆ s) (rt : r ⊆ t) : r ⊆ s ∩ t := fun _ h =>
⟨rs h, rt h⟩
#align set.subset_inter Set.subset_inter
@[simp]
theorem subset_inter_iff {s t r : Set α} : r ⊆ s ∩ t ↔ r ⊆ s ∧ r ⊆ t :=
(forall_congr' fun _ => imp_and).trans forall_and
#align set.subset_inter_iff Set.subset_inter_iff
@[simp] lemma inter_eq_left : s ∩ t = s ↔ s ⊆ t := inf_eq_left
#align set.inter_eq_left_iff_subset Set.inter_eq_left
@[simp] lemma inter_eq_right : s ∩ t = t ↔ t ⊆ s := inf_eq_right
#align set.inter_eq_right_iff_subset Set.inter_eq_right
@[simp] lemma left_eq_inter : s = s ∩ t ↔ s ⊆ t := left_eq_inf
@[simp] lemma right_eq_inter : t = s ∩ t ↔ t ⊆ s := right_eq_inf
theorem inter_eq_self_of_subset_left {s t : Set α} : s ⊆ t → s ∩ t = s :=
inter_eq_left.mpr
#align set.inter_eq_self_of_subset_left Set.inter_eq_self_of_subset_left
theorem inter_eq_self_of_subset_right {s t : Set α} : t ⊆ s → s ∩ t = t :=
inter_eq_right.mpr
#align set.inter_eq_self_of_subset_right Set.inter_eq_self_of_subset_right
theorem inter_congr_left (ht : s ∩ u ⊆ t) (hu : s ∩ t ⊆ u) : s ∩ t = s ∩ u :=
inf_congr_left ht hu
#align set.inter_congr_left Set.inter_congr_left
theorem inter_congr_right (hs : t ∩ u ⊆ s) (ht : s ∩ u ⊆ t) : s ∩ u = t ∩ u :=
inf_congr_right hs ht
#align set.inter_congr_right Set.inter_congr_right
theorem inter_eq_inter_iff_left : s ∩ t = s ∩ u ↔ s ∩ u ⊆ t ∧ s ∩ t ⊆ u :=
inf_eq_inf_iff_left
#align set.inter_eq_inter_iff_left Set.inter_eq_inter_iff_left
theorem inter_eq_inter_iff_right : s ∩ u = t ∩ u ↔ t ∩ u ⊆ s ∧ s ∩ u ⊆ t :=
inf_eq_inf_iff_right
#align set.inter_eq_inter_iff_right Set.inter_eq_inter_iff_right
@[simp, mfld_simps]
theorem inter_univ (a : Set α) : a ∩ univ = a := inf_top_eq _
#align set.inter_univ Set.inter_univ
@[simp, mfld_simps]
theorem univ_inter (a : Set α) : univ ∩ a = a := top_inf_eq _
#align set.univ_inter Set.univ_inter
@[gcongr]
theorem inter_subset_inter {s₁ s₂ t₁ t₂ : Set α} (h₁ : s₁ ⊆ t₁) (h₂ : s₂ ⊆ t₂) :
s₁ ∩ s₂ ⊆ t₁ ∩ t₂ := fun _ => And.imp (@h₁ _) (@h₂ _)
#align set.inter_subset_inter Set.inter_subset_inter
@[gcongr]
theorem inter_subset_inter_left {s t : Set α} (u : Set α) (H : s ⊆ t) : s ∩ u ⊆ t ∩ u :=
inter_subset_inter H Subset.rfl
#align set.inter_subset_inter_left Set.inter_subset_inter_left
@[gcongr]
theorem inter_subset_inter_right {s t : Set α} (u : Set α) (H : s ⊆ t) : u ∩ s ⊆ u ∩ t :=
inter_subset_inter Subset.rfl H
#align set.inter_subset_inter_right Set.inter_subset_inter_right
theorem union_inter_cancel_left {s t : Set α} : (s ∪ t) ∩ s = s :=
inter_eq_self_of_subset_right subset_union_left
#align set.union_inter_cancel_left Set.union_inter_cancel_left
theorem union_inter_cancel_right {s t : Set α} : (s ∪ t) ∩ t = t :=
inter_eq_self_of_subset_right subset_union_right
#align set.union_inter_cancel_right Set.union_inter_cancel_right
theorem inter_setOf_eq_sep (s : Set α) (p : α → Prop) : s ∩ {a | p a} = {a ∈ s | p a} :=
rfl
#align set.inter_set_of_eq_sep Set.inter_setOf_eq_sep
theorem setOf_inter_eq_sep (p : α → Prop) (s : Set α) : {a | p a} ∩ s = {a ∈ s | p a} :=
inter_comm _ _
#align set.set_of_inter_eq_sep Set.setOf_inter_eq_sep
theorem inter_union_distrib_left (s t u : Set α) : s ∩ (t ∪ u) = s ∩ t ∪ s ∩ u :=
inf_sup_left _ _ _
#align set.inter_distrib_left Set.inter_union_distrib_left
theorem union_inter_distrib_right (s t u : Set α) : (s ∪ t) ∩ u = s ∩ u ∪ t ∩ u :=
inf_sup_right _ _ _
#align set.inter_distrib_right Set.union_inter_distrib_right
theorem union_inter_distrib_left (s t u : Set α) : s ∪ t ∩ u = (s ∪ t) ∩ (s ∪ u) :=
sup_inf_left _ _ _
#align set.union_distrib_left Set.union_inter_distrib_left
theorem inter_union_distrib_right (s t u : Set α) : s ∩ t ∪ u = (s ∪ u) ∩ (t ∪ u) :=
sup_inf_right _ _ _
#align set.union_distrib_right Set.inter_union_distrib_right
-- 2024-03-22
@[deprecated] alias inter_distrib_left := inter_union_distrib_left
@[deprecated] alias inter_distrib_right := union_inter_distrib_right
@[deprecated] alias union_distrib_left := union_inter_distrib_left
@[deprecated] alias union_distrib_right := inter_union_distrib_right
theorem union_union_distrib_left (s t u : Set α) : s ∪ (t ∪ u) = s ∪ t ∪ (s ∪ u) :=
sup_sup_distrib_left _ _ _
#align set.union_union_distrib_left Set.union_union_distrib_left
theorem union_union_distrib_right (s t u : Set α) : s ∪ t ∪ u = s ∪ u ∪ (t ∪ u) :=
sup_sup_distrib_right _ _ _
#align set.union_union_distrib_right Set.union_union_distrib_right
theorem inter_inter_distrib_left (s t u : Set α) : s ∩ (t ∩ u) = s ∩ t ∩ (s ∩ u) :=
inf_inf_distrib_left _ _ _
#align set.inter_inter_distrib_left Set.inter_inter_distrib_left
theorem inter_inter_distrib_right (s t u : Set α) : s ∩ t ∩ u = s ∩ u ∩ (t ∩ u) :=
inf_inf_distrib_right _ _ _
#align set.inter_inter_distrib_right Set.inter_inter_distrib_right
theorem union_union_union_comm (s t u v : Set α) : s ∪ t ∪ (u ∪ v) = s ∪ u ∪ (t ∪ v) :=
sup_sup_sup_comm _ _ _ _
#align set.union_union_union_comm Set.union_union_union_comm
theorem inter_inter_inter_comm (s t u v : Set α) : s ∩ t ∩ (u ∩ v) = s ∩ u ∩ (t ∩ v) :=
inf_inf_inf_comm _ _ _ _
#align set.inter_inter_inter_comm Set.inter_inter_inter_comm
theorem insert_def (x : α) (s : Set α) : insert x s = { y | y = x ∨ y ∈ s } :=
rfl
#align set.insert_def Set.insert_def
@[simp]
theorem subset_insert (x : α) (s : Set α) : s ⊆ insert x s := fun _ => Or.inr
#align set.subset_insert Set.subset_insert
theorem mem_insert (x : α) (s : Set α) : x ∈ insert x s :=
Or.inl rfl
#align set.mem_insert Set.mem_insert
theorem mem_insert_of_mem {x : α} {s : Set α} (y : α) : x ∈ s → x ∈ insert y s :=
Or.inr
#align set.mem_insert_of_mem Set.mem_insert_of_mem
theorem eq_or_mem_of_mem_insert {x a : α} {s : Set α} : x ∈ insert a s → x = a ∨ x ∈ s :=
id
#align set.eq_or_mem_of_mem_insert Set.eq_or_mem_of_mem_insert
theorem mem_of_mem_insert_of_ne : b ∈ insert a s → b ≠ a → b ∈ s :=
Or.resolve_left
#align set.mem_of_mem_insert_of_ne Set.mem_of_mem_insert_of_ne
theorem eq_of_not_mem_of_mem_insert : b ∈ insert a s → b ∉ s → b = a :=
Or.resolve_right
#align set.eq_of_not_mem_of_mem_insert Set.eq_of_not_mem_of_mem_insert
@[simp]
theorem mem_insert_iff {x a : α} {s : Set α} : x ∈ insert a s ↔ x = a ∨ x ∈ s :=
Iff.rfl
#align set.mem_insert_iff Set.mem_insert_iff
@[simp]
theorem insert_eq_of_mem {a : α} {s : Set α} (h : a ∈ s) : insert a s = s :=
ext fun _ => or_iff_right_of_imp fun e => e.symm ▸ h
#align set.insert_eq_of_mem Set.insert_eq_of_mem
theorem ne_insert_of_not_mem {s : Set α} (t : Set α) {a : α} : a ∉ s → s ≠ insert a t :=
mt fun e => e.symm ▸ mem_insert _ _
#align set.ne_insert_of_not_mem Set.ne_insert_of_not_mem
@[simp]
theorem insert_eq_self : insert a s = s ↔ a ∈ s :=
⟨fun h => h ▸ mem_insert _ _, insert_eq_of_mem⟩
#align set.insert_eq_self Set.insert_eq_self
theorem insert_ne_self : insert a s ≠ s ↔ a ∉ s :=
insert_eq_self.not
#align set.insert_ne_self Set.insert_ne_self
theorem insert_subset_iff : insert a s ⊆ t ↔ a ∈ t ∧ s ⊆ t := by
simp only [subset_def, mem_insert_iff, or_imp, forall_and, forall_eq]
#align set.insert_subset Set.insert_subset_iff
theorem insert_subset (ha : a ∈ t) (hs : s ⊆ t) : insert a s ⊆ t :=
insert_subset_iff.mpr ⟨ha, hs⟩
theorem insert_subset_insert (h : s ⊆ t) : insert a s ⊆ insert a t := fun _ => Or.imp_right (@h _)
#align set.insert_subset_insert Set.insert_subset_insert
@[simp] theorem insert_subset_insert_iff (ha : a ∉ s) : insert a s ⊆ insert a t ↔ s ⊆ t := by
refine ⟨fun h x hx => ?_, insert_subset_insert⟩
rcases h (subset_insert _ _ hx) with (rfl | hxt)
exacts [(ha hx).elim, hxt]
#align set.insert_subset_insert_iff Set.insert_subset_insert_iff
theorem subset_insert_iff_of_not_mem (ha : a ∉ s) : s ⊆ insert a t ↔ s ⊆ t :=
forall₂_congr fun _ hb => or_iff_right <| ne_of_mem_of_not_mem hb ha
#align set.subset_insert_iff_of_not_mem Set.subset_insert_iff_of_not_mem
theorem ssubset_iff_insert {s t : Set α} : s ⊂ t ↔ ∃ a ∉ s, insert a s ⊆ t := by
simp only [insert_subset_iff, exists_and_right, ssubset_def, not_subset]
aesop
#align set.ssubset_iff_insert Set.ssubset_iff_insert
theorem ssubset_insert {s : Set α} {a : α} (h : a ∉ s) : s ⊂ insert a s :=
ssubset_iff_insert.2 ⟨a, h, Subset.rfl⟩
#align set.ssubset_insert Set.ssubset_insert
theorem insert_comm (a b : α) (s : Set α) : insert a (insert b s) = insert b (insert a s) :=
ext fun _ => or_left_comm
#align set.insert_comm Set.insert_comm
-- Porting note (#10618): removing `simp` attribute because `simp` can prove it
theorem insert_idem (a : α) (s : Set α) : insert a (insert a s) = insert a s :=
insert_eq_of_mem <| mem_insert _ _
#align set.insert_idem Set.insert_idem
theorem insert_union : insert a s ∪ t = insert a (s ∪ t) :=
ext fun _ => or_assoc
#align set.insert_union Set.insert_union
@[simp]
theorem union_insert : s ∪ insert a t = insert a (s ∪ t) :=
ext fun _ => or_left_comm
#align set.union_insert Set.union_insert
@[simp]
theorem insert_nonempty (a : α) (s : Set α) : (insert a s).Nonempty :=
⟨a, mem_insert a s⟩
#align set.insert_nonempty Set.insert_nonempty
instance (a : α) (s : Set α) : Nonempty (insert a s : Set α) :=
(insert_nonempty a s).to_subtype
theorem insert_inter_distrib (a : α) (s t : Set α) : insert a (s ∩ t) = insert a s ∩ insert a t :=
ext fun _ => or_and_left
#align set.insert_inter_distrib Set.insert_inter_distrib
theorem insert_union_distrib (a : α) (s t : Set α) : insert a (s ∪ t) = insert a s ∪ insert a t :=
ext fun _ => or_or_distrib_left
#align set.insert_union_distrib Set.insert_union_distrib
theorem insert_inj (ha : a ∉ s) : insert a s = insert b s ↔ a = b :=
⟨fun h => eq_of_not_mem_of_mem_insert (h.subst <| mem_insert a s) ha,
congr_arg (fun x => insert x s)⟩
#align set.insert_inj Set.insert_inj
-- useful in proofs by induction
theorem forall_of_forall_insert {P : α → Prop} {a : α} {s : Set α} (H : ∀ x, x ∈ insert a s → P x)
(x) (h : x ∈ s) : P x :=
H _ (Or.inr h)
#align set.forall_of_forall_insert Set.forall_of_forall_insert
theorem forall_insert_of_forall {P : α → Prop} {a : α} {s : Set α} (H : ∀ x, x ∈ s → P x) (ha : P a)
(x) (h : x ∈ insert a s) : P x :=
h.elim (fun e => e.symm ▸ ha) (H _)
#align set.forall_insert_of_forall Set.forall_insert_of_forall
theorem exists_mem_insert {P : α → Prop} {a : α} {s : Set α} :
(∃ x ∈ insert a s, P x) ↔ (P a ∨ ∃ x ∈ s, P x) := by
simp [mem_insert_iff, or_and_right, exists_and_left, exists_or]
#align set.bex_insert_iff Set.exists_mem_insert
@[deprecated (since := "2024-03-23")] alias bex_insert_iff := exists_mem_insert
theorem forall_mem_insert {P : α → Prop} {a : α} {s : Set α} :
(∀ x ∈ insert a s, P x) ↔ P a ∧ ∀ x ∈ s, P x :=
forall₂_or_left.trans <| and_congr_left' forall_eq
#align set.ball_insert_iff Set.forall_mem_insert
@[deprecated (since := "2024-03-23")] alias ball_insert_iff := forall_mem_insert
instance : LawfulSingleton α (Set α) :=
⟨fun x => Set.ext fun a => by
simp only [mem_empty_iff_false, mem_insert_iff, or_false]
exact Iff.rfl⟩
theorem singleton_def (a : α) : ({a} : Set α) = insert a ∅ :=
(insert_emptyc_eq a).symm
#align set.singleton_def Set.singleton_def
@[simp]
theorem mem_singleton_iff {a b : α} : a ∈ ({b} : Set α) ↔ a = b :=
Iff.rfl
#align set.mem_singleton_iff Set.mem_singleton_iff
@[simp]
theorem setOf_eq_eq_singleton {a : α} : { n | n = a } = {a} :=
rfl
#align set.set_of_eq_eq_singleton Set.setOf_eq_eq_singleton
@[simp]
theorem setOf_eq_eq_singleton' {a : α} : { x | a = x } = {a} :=
ext fun _ => eq_comm
#align set.set_of_eq_eq_singleton' Set.setOf_eq_eq_singleton'
-- TODO: again, annotation needed
--Porting note (#11119): removed `simp` attribute
theorem mem_singleton (a : α) : a ∈ ({a} : Set α) :=
@rfl _ _
#align set.mem_singleton Set.mem_singleton
theorem eq_of_mem_singleton {x y : α} (h : x ∈ ({y} : Set α)) : x = y :=
h
#align set.eq_of_mem_singleton Set.eq_of_mem_singleton
@[simp]
theorem singleton_eq_singleton_iff {x y : α} : {x} = ({y} : Set α) ↔ x = y :=
ext_iff.trans eq_iff_eq_cancel_left
#align set.singleton_eq_singleton_iff Set.singleton_eq_singleton_iff
theorem singleton_injective : Injective (singleton : α → Set α) := fun _ _ =>
singleton_eq_singleton_iff.mp
#align set.singleton_injective Set.singleton_injective
theorem mem_singleton_of_eq {x y : α} (H : x = y) : x ∈ ({y} : Set α) :=
H
#align set.mem_singleton_of_eq Set.mem_singleton_of_eq
theorem insert_eq (x : α) (s : Set α) : insert x s = ({x} : Set α) ∪ s :=
rfl
#align set.insert_eq Set.insert_eq
@[simp]
theorem singleton_nonempty (a : α) : ({a} : Set α).Nonempty :=
⟨a, rfl⟩
#align set.singleton_nonempty Set.singleton_nonempty
@[simp]
theorem singleton_ne_empty (a : α) : ({a} : Set α) ≠ ∅ :=
(singleton_nonempty _).ne_empty
#align set.singleton_ne_empty Set.singleton_ne_empty
--Porting note (#10618): removed `simp` attribute because `simp` can prove it
theorem empty_ssubset_singleton : (∅ : Set α) ⊂ {a} :=
(singleton_nonempty _).empty_ssubset
#align set.empty_ssubset_singleton Set.empty_ssubset_singleton
@[simp]
theorem singleton_subset_iff {a : α} {s : Set α} : {a} ⊆ s ↔ a ∈ s :=
forall_eq
#align set.singleton_subset_iff Set.singleton_subset_iff
theorem singleton_subset_singleton : ({a} : Set α) ⊆ {b} ↔ a = b := by simp
#align set.singleton_subset_singleton Set.singleton_subset_singleton
theorem set_compr_eq_eq_singleton {a : α} : { b | b = a } = {a} :=
rfl
#align set.set_compr_eq_eq_singleton Set.set_compr_eq_eq_singleton
@[simp]
theorem singleton_union : {a} ∪ s = insert a s :=
rfl
#align set.singleton_union Set.singleton_union
@[simp]
theorem union_singleton : s ∪ {a} = insert a s :=
union_comm _ _
#align set.union_singleton Set.union_singleton
@[simp]
theorem singleton_inter_nonempty : ({a} ∩ s).Nonempty ↔ a ∈ s := by
simp only [Set.Nonempty, mem_inter_iff, mem_singleton_iff, exists_eq_left]
#align set.singleton_inter_nonempty Set.singleton_inter_nonempty
@[simp]
theorem inter_singleton_nonempty : (s ∩ {a}).Nonempty ↔ a ∈ s := by
rw [inter_comm, singleton_inter_nonempty]
#align set.inter_singleton_nonempty Set.inter_singleton_nonempty
@[simp]
theorem singleton_inter_eq_empty : {a} ∩ s = ∅ ↔ a ∉ s :=
not_nonempty_iff_eq_empty.symm.trans singleton_inter_nonempty.not
#align set.singleton_inter_eq_empty Set.singleton_inter_eq_empty
@[simp]
theorem inter_singleton_eq_empty : s ∩ {a} = ∅ ↔ a ∉ s := by
rw [inter_comm, singleton_inter_eq_empty]
#align set.inter_singleton_eq_empty Set.inter_singleton_eq_empty
theorem nmem_singleton_empty {s : Set α} : s ∉ ({∅} : Set (Set α)) ↔ s.Nonempty :=
nonempty_iff_ne_empty.symm
#align set.nmem_singleton_empty Set.nmem_singleton_empty
instance uniqueSingleton (a : α) : Unique (↥({a} : Set α)) :=
⟨⟨⟨a, mem_singleton a⟩⟩, fun ⟨_, h⟩ => Subtype.eq h⟩
#align set.unique_singleton Set.uniqueSingleton
theorem eq_singleton_iff_unique_mem : s = {a} ↔ a ∈ s ∧ ∀ x ∈ s, x = a :=
Subset.antisymm_iff.trans <| and_comm.trans <| and_congr_left' singleton_subset_iff
#align set.eq_singleton_iff_unique_mem Set.eq_singleton_iff_unique_mem
theorem eq_singleton_iff_nonempty_unique_mem : s = {a} ↔ s.Nonempty ∧ ∀ x ∈ s, x = a :=
eq_singleton_iff_unique_mem.trans <|
and_congr_left fun H => ⟨fun h' => ⟨_, h'⟩, fun ⟨x, h⟩ => H x h ▸ h⟩
#align set.eq_singleton_iff_nonempty_unique_mem Set.eq_singleton_iff_nonempty_unique_mem
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
-- while `simp` is capable of proving this, it is not capable of turning the LHS into the RHS.
@[simp]
theorem default_coe_singleton (x : α) : (default : ({x} : Set α)) = ⟨x, rfl⟩ :=
rfl
#align set.default_coe_singleton Set.default_coe_singleton
@[simp]
theorem subset_singleton_iff {α : Type*} {s : Set α} {x : α} : s ⊆ {x} ↔ ∀ y ∈ s, y = x :=
Iff.rfl
#align set.subset_singleton_iff Set.subset_singleton_iff
theorem subset_singleton_iff_eq {s : Set α} {x : α} : s ⊆ {x} ↔ s = ∅ ∨ s = {x} := by
obtain rfl | hs := s.eq_empty_or_nonempty
· exact ⟨fun _ => Or.inl rfl, fun _ => empty_subset _⟩
· simp [eq_singleton_iff_nonempty_unique_mem, hs, hs.ne_empty]
#align set.subset_singleton_iff_eq Set.subset_singleton_iff_eq
theorem Nonempty.subset_singleton_iff (h : s.Nonempty) : s ⊆ {a} ↔ s = {a} :=
subset_singleton_iff_eq.trans <| or_iff_right h.ne_empty
#align set.nonempty.subset_singleton_iff Set.Nonempty.subset_singleton_iff
theorem ssubset_singleton_iff {s : Set α} {x : α} : s ⊂ {x} ↔ s = ∅ := by
rw [ssubset_iff_subset_ne, subset_singleton_iff_eq, or_and_right, and_not_self_iff, or_false_iff,
and_iff_left_iff_imp]
exact fun h => h ▸ (singleton_ne_empty _).symm
#align set.ssubset_singleton_iff Set.ssubset_singleton_iff
theorem eq_empty_of_ssubset_singleton {s : Set α} {x : α} (hs : s ⊂ {x}) : s = ∅ :=
ssubset_singleton_iff.1 hs
#align set.eq_empty_of_ssubset_singleton Set.eq_empty_of_ssubset_singleton
theorem eq_of_nonempty_of_subsingleton {α} [Subsingleton α] (s t : Set α) [Nonempty s]
[Nonempty t] : s = t :=
nonempty_of_nonempty_subtype.eq_univ.trans nonempty_of_nonempty_subtype.eq_univ.symm
theorem eq_of_nonempty_of_subsingleton' {α} [Subsingleton α] {s : Set α} (t : Set α)
(hs : s.Nonempty) [Nonempty t] : s = t :=
have := hs.to_subtype; eq_of_nonempty_of_subsingleton s t
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem Nonempty.eq_zero [Subsingleton α] [Zero α] {s : Set α} (h : s.Nonempty) :
s = {0} := eq_of_nonempty_of_subsingleton' {0} h
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem Nonempty.eq_one [Subsingleton α] [One α] {s : Set α} (h : s.Nonempty) :
s = {1} := eq_of_nonempty_of_subsingleton' {1} h
protected theorem disjoint_iff : Disjoint s t ↔ s ∩ t ⊆ ∅ :=
disjoint_iff_inf_le
#align set.disjoint_iff Set.disjoint_iff
theorem disjoint_iff_inter_eq_empty : Disjoint s t ↔ s ∩ t = ∅ :=
disjoint_iff
#align set.disjoint_iff_inter_eq_empty Set.disjoint_iff_inter_eq_empty
theorem _root_.Disjoint.inter_eq : Disjoint s t → s ∩ t = ∅ :=
Disjoint.eq_bot
#align disjoint.inter_eq Disjoint.inter_eq
theorem disjoint_left : Disjoint s t ↔ ∀ ⦃a⦄, a ∈ s → a ∉ t :=
disjoint_iff_inf_le.trans <| forall_congr' fun _ => not_and
#align set.disjoint_left Set.disjoint_left
theorem disjoint_right : Disjoint s t ↔ ∀ ⦃a⦄, a ∈ t → a ∉ s := by rw [disjoint_comm, disjoint_left]
#align set.disjoint_right Set.disjoint_right
lemma not_disjoint_iff : ¬Disjoint s t ↔ ∃ x, x ∈ s ∧ x ∈ t :=
Set.disjoint_iff.not.trans <| not_forall.trans <| exists_congr fun _ ↦ not_not
#align set.not_disjoint_iff Set.not_disjoint_iff
lemma not_disjoint_iff_nonempty_inter : ¬ Disjoint s t ↔ (s ∩ t).Nonempty := not_disjoint_iff
#align set.not_disjoint_iff_nonempty_inter Set.not_disjoint_iff_nonempty_inter
alias ⟨_, Nonempty.not_disjoint⟩ := not_disjoint_iff_nonempty_inter
#align set.nonempty.not_disjoint Set.Nonempty.not_disjoint
lemma disjoint_or_nonempty_inter (s t : Set α) : Disjoint s t ∨ (s ∩ t).Nonempty :=
(em _).imp_right not_disjoint_iff_nonempty_inter.1
#align set.disjoint_or_nonempty_inter Set.disjoint_or_nonempty_inter
lemma disjoint_iff_forall_ne : Disjoint s t ↔ ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ t → a ≠ b := by
simp only [Ne, disjoint_left, @imp_not_comm _ (_ = _), forall_eq']
#align set.disjoint_iff_forall_ne Set.disjoint_iff_forall_ne
alias ⟨_root_.Disjoint.ne_of_mem, _⟩ := disjoint_iff_forall_ne
#align disjoint.ne_of_mem Disjoint.ne_of_mem
lemma disjoint_of_subset_left (h : s ⊆ u) (d : Disjoint u t) : Disjoint s t := d.mono_left h
#align set.disjoint_of_subset_left Set.disjoint_of_subset_left
lemma disjoint_of_subset_right (h : t ⊆ u) (d : Disjoint s u) : Disjoint s t := d.mono_right h
#align set.disjoint_of_subset_right Set.disjoint_of_subset_right
lemma disjoint_of_subset (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) (h : Disjoint s₂ t₂) : Disjoint s₁ t₁ :=
h.mono hs ht
#align set.disjoint_of_subset Set.disjoint_of_subset
@[simp]
lemma disjoint_union_left : Disjoint (s ∪ t) u ↔ Disjoint s u ∧ Disjoint t u := disjoint_sup_left
#align set.disjoint_union_left Set.disjoint_union_left
@[simp]
lemma disjoint_union_right : Disjoint s (t ∪ u) ↔ Disjoint s t ∧ Disjoint s u := disjoint_sup_right
#align set.disjoint_union_right Set.disjoint_union_right
@[simp] lemma disjoint_empty (s : Set α) : Disjoint s ∅ := disjoint_bot_right
#align set.disjoint_empty Set.disjoint_empty
@[simp] lemma empty_disjoint (s : Set α) : Disjoint ∅ s := disjoint_bot_left
#align set.empty_disjoint Set.empty_disjoint
@[simp] lemma univ_disjoint : Disjoint univ s ↔ s = ∅ := top_disjoint
#align set.univ_disjoint Set.univ_disjoint
@[simp] lemma disjoint_univ : Disjoint s univ ↔ s = ∅ := disjoint_top
#align set.disjoint_univ Set.disjoint_univ
lemma disjoint_sdiff_left : Disjoint (t \ s) s := disjoint_sdiff_self_left
#align set.disjoint_sdiff_left Set.disjoint_sdiff_left
lemma disjoint_sdiff_right : Disjoint s (t \ s) := disjoint_sdiff_self_right
#align set.disjoint_sdiff_right Set.disjoint_sdiff_right
-- TODO: prove this in terms of a lattice lemma
theorem disjoint_sdiff_inter : Disjoint (s \ t) (s ∩ t) :=
disjoint_of_subset_right inter_subset_right disjoint_sdiff_left
#align set.disjoint_sdiff_inter Set.disjoint_sdiff_inter
theorem diff_union_diff_cancel (hts : t ⊆ s) (hut : u ⊆ t) : s \ t ∪ t \ u = s \ u :=
sdiff_sup_sdiff_cancel hts hut
#align set.diff_union_diff_cancel Set.diff_union_diff_cancel
theorem diff_diff_eq_sdiff_union (h : u ⊆ s) : s \ (t \ u) = s \ t ∪ u := sdiff_sdiff_eq_sdiff_sup h
#align set.diff_diff_eq_sdiff_union Set.diff_diff_eq_sdiff_union
@[simp default+1]
lemma disjoint_singleton_left : Disjoint {a} s ↔ a ∉ s := by simp [Set.disjoint_iff, subset_def]
#align set.disjoint_singleton_left Set.disjoint_singleton_left
@[simp]
lemma disjoint_singleton_right : Disjoint s {a} ↔ a ∉ s :=
disjoint_comm.trans disjoint_singleton_left
#align set.disjoint_singleton_right Set.disjoint_singleton_right
lemma disjoint_singleton : Disjoint ({a} : Set α) {b} ↔ a ≠ b := by
simp
#align set.disjoint_singleton Set.disjoint_singleton
lemma subset_diff : s ⊆ t \ u ↔ s ⊆ t ∧ Disjoint s u := le_iff_subset.symm.trans le_sdiff
#align set.subset_diff Set.subset_diff
lemma ssubset_iff_sdiff_singleton : s ⊂ t ↔ ∃ a ∈ t, s ⊆ t \ {a} := by
simp [ssubset_iff_insert, subset_diff, insert_subset_iff]; aesop
theorem inter_diff_distrib_left (s t u : Set α) : s ∩ (t \ u) = (s ∩ t) \ (s ∩ u) :=
inf_sdiff_distrib_left _ _ _
#align set.inter_diff_distrib_left Set.inter_diff_distrib_left
theorem inter_diff_distrib_right (s t u : Set α) : s \ t ∩ u = (s ∩ u) \ (t ∩ u) :=
inf_sdiff_distrib_right _ _ _
#align set.inter_diff_distrib_right Set.inter_diff_distrib_right
theorem compl_def (s : Set α) : sᶜ = { x | x ∉ s } :=
rfl
#align set.compl_def Set.compl_def
theorem mem_compl {s : Set α} {x : α} (h : x ∉ s) : x ∈ sᶜ :=
h
#align set.mem_compl Set.mem_compl
theorem compl_setOf {α} (p : α → Prop) : { a | p a }ᶜ = { a | ¬p a } :=
rfl
#align set.compl_set_of Set.compl_setOf
theorem not_mem_of_mem_compl {s : Set α} {x : α} (h : x ∈ sᶜ) : x ∉ s :=
h
#align set.not_mem_of_mem_compl Set.not_mem_of_mem_compl
theorem not_mem_compl_iff {x : α} : x ∉ sᶜ ↔ x ∈ s :=
not_not
#align set.not_mem_compl_iff Set.not_mem_compl_iff
@[simp]
theorem inter_compl_self (s : Set α) : s ∩ sᶜ = ∅ :=
inf_compl_eq_bot
#align set.inter_compl_self Set.inter_compl_self
@[simp]
theorem compl_inter_self (s : Set α) : sᶜ ∩ s = ∅ :=
compl_inf_eq_bot
#align set.compl_inter_self Set.compl_inter_self
@[simp]
theorem compl_empty : (∅ : Set α)ᶜ = univ :=
compl_bot
#align set.compl_empty Set.compl_empty
@[simp]
theorem compl_union (s t : Set α) : (s ∪ t)ᶜ = sᶜ ∩ tᶜ :=
compl_sup
#align set.compl_union Set.compl_union
theorem compl_inter (s t : Set α) : (s ∩ t)ᶜ = sᶜ ∪ tᶜ :=
compl_inf
#align set.compl_inter Set.compl_inter
@[simp]
theorem compl_univ : (univ : Set α)ᶜ = ∅ :=
compl_top
#align set.compl_univ Set.compl_univ
@[simp]
theorem compl_empty_iff {s : Set α} : sᶜ = ∅ ↔ s = univ :=
compl_eq_bot
#align set.compl_empty_iff Set.compl_empty_iff
@[simp]
theorem compl_univ_iff {s : Set α} : sᶜ = univ ↔ s = ∅ :=
compl_eq_top
#align set.compl_univ_iff Set.compl_univ_iff
theorem compl_ne_univ : sᶜ ≠ univ ↔ s.Nonempty :=
compl_univ_iff.not.trans nonempty_iff_ne_empty.symm
#align set.compl_ne_univ Set.compl_ne_univ
theorem nonempty_compl : sᶜ.Nonempty ↔ s ≠ univ :=
(ne_univ_iff_exists_not_mem s).symm
#align set.nonempty_compl Set.nonempty_compl
@[simp] lemma nonempty_compl_of_nontrivial [Nontrivial α] (x : α) : Set.Nonempty {x}ᶜ := by
obtain ⟨y, hy⟩ := exists_ne x
exact ⟨y, by simp [hy]⟩
theorem mem_compl_singleton_iff {a x : α} : x ∈ ({a} : Set α)ᶜ ↔ x ≠ a :=
Iff.rfl
#align set.mem_compl_singleton_iff Set.mem_compl_singleton_iff
theorem compl_singleton_eq (a : α) : ({a} : Set α)ᶜ = { x | x ≠ a } :=
rfl
#align set.compl_singleton_eq Set.compl_singleton_eq
@[simp]
theorem compl_ne_eq_singleton (a : α) : ({ x | x ≠ a } : Set α)ᶜ = {a} :=
compl_compl _
#align set.compl_ne_eq_singleton Set.compl_ne_eq_singleton
theorem union_eq_compl_compl_inter_compl (s t : Set α) : s ∪ t = (sᶜ ∩ tᶜ)ᶜ :=
ext fun _ => or_iff_not_and_not
#align set.union_eq_compl_compl_inter_compl Set.union_eq_compl_compl_inter_compl
theorem inter_eq_compl_compl_union_compl (s t : Set α) : s ∩ t = (sᶜ ∪ tᶜ)ᶜ :=
ext fun _ => and_iff_not_or_not
#align set.inter_eq_compl_compl_union_compl Set.inter_eq_compl_compl_union_compl
@[simp]
theorem union_compl_self (s : Set α) : s ∪ sᶜ = univ :=
eq_univ_iff_forall.2 fun _ => em _
#align set.union_compl_self Set.union_compl_self
@[simp]
theorem compl_union_self (s : Set α) : sᶜ ∪ s = univ := by rw [union_comm, union_compl_self]
#align set.compl_union_self Set.compl_union_self
theorem compl_subset_comm : sᶜ ⊆ t ↔ tᶜ ⊆ s :=
@compl_le_iff_compl_le _ s _ _
#align set.compl_subset_comm Set.compl_subset_comm
theorem subset_compl_comm : s ⊆ tᶜ ↔ t ⊆ sᶜ :=
@le_compl_iff_le_compl _ _ _ t
#align set.subset_compl_comm Set.subset_compl_comm
@[simp]
theorem compl_subset_compl : sᶜ ⊆ tᶜ ↔ t ⊆ s :=
@compl_le_compl_iff_le (Set α) _ _ _
#align set.compl_subset_compl Set.compl_subset_compl
@[gcongr] theorem compl_subset_compl_of_subset (h : t ⊆ s) : sᶜ ⊆ tᶜ := compl_subset_compl.2 h
theorem subset_compl_iff_disjoint_left : s ⊆ tᶜ ↔ Disjoint t s :=
@le_compl_iff_disjoint_left (Set α) _ _ _
#align set.subset_compl_iff_disjoint_left Set.subset_compl_iff_disjoint_left
theorem subset_compl_iff_disjoint_right : s ⊆ tᶜ ↔ Disjoint s t :=
@le_compl_iff_disjoint_right (Set α) _ _ _
#align set.subset_compl_iff_disjoint_right Set.subset_compl_iff_disjoint_right
theorem disjoint_compl_left_iff_subset : Disjoint sᶜ t ↔ t ⊆ s :=
disjoint_compl_left_iff
#align set.disjoint_compl_left_iff_subset Set.disjoint_compl_left_iff_subset
theorem disjoint_compl_right_iff_subset : Disjoint s tᶜ ↔ s ⊆ t :=
disjoint_compl_right_iff
#align set.disjoint_compl_right_iff_subset Set.disjoint_compl_right_iff_subset
alias ⟨_, _root_.Disjoint.subset_compl_right⟩ := subset_compl_iff_disjoint_right
#align disjoint.subset_compl_right Disjoint.subset_compl_right
alias ⟨_, _root_.Disjoint.subset_compl_left⟩ := subset_compl_iff_disjoint_left
#align disjoint.subset_compl_left Disjoint.subset_compl_left
alias ⟨_, _root_.HasSubset.Subset.disjoint_compl_left⟩ := disjoint_compl_left_iff_subset
#align has_subset.subset.disjoint_compl_left HasSubset.Subset.disjoint_compl_left
alias ⟨_, _root_.HasSubset.Subset.disjoint_compl_right⟩ := disjoint_compl_right_iff_subset
#align has_subset.subset.disjoint_compl_right HasSubset.Subset.disjoint_compl_right
theorem subset_union_compl_iff_inter_subset {s t u : Set α} : s ⊆ t ∪ uᶜ ↔ s ∩ u ⊆ t :=
(@isCompl_compl _ u _).le_sup_right_iff_inf_left_le
#align set.subset_union_compl_iff_inter_subset Set.subset_union_compl_iff_inter_subset
theorem compl_subset_iff_union {s t : Set α} : sᶜ ⊆ t ↔ s ∪ t = univ :=
Iff.symm <| eq_univ_iff_forall.trans <| forall_congr' fun _ => or_iff_not_imp_left
#align set.compl_subset_iff_union Set.compl_subset_iff_union
@[simp]
theorem subset_compl_singleton_iff {a : α} {s : Set α} : s ⊆ {a}ᶜ ↔ a ∉ s :=
subset_compl_comm.trans singleton_subset_iff
#align set.subset_compl_singleton_iff Set.subset_compl_singleton_iff
theorem inter_subset (a b c : Set α) : a ∩ b ⊆ c ↔ a ⊆ bᶜ ∪ c :=
forall_congr' fun _ => and_imp.trans <| imp_congr_right fun _ => imp_iff_not_or
#align set.inter_subset Set.inter_subset
theorem inter_compl_nonempty_iff {s t : Set α} : (s ∩ tᶜ).Nonempty ↔ ¬s ⊆ t :=
(not_subset.trans <| exists_congr fun x => by simp [mem_compl]).symm
#align set.inter_compl_nonempty_iff Set.inter_compl_nonempty_iff
theorem not_mem_diff_of_mem {s t : Set α} {x : α} (hx : x ∈ t) : x ∉ s \ t := fun h => h.2 hx
#align set.not_mem_diff_of_mem Set.not_mem_diff_of_mem
theorem mem_of_mem_diff {s t : Set α} {x : α} (h : x ∈ s \ t) : x ∈ s :=
h.left
#align set.mem_of_mem_diff Set.mem_of_mem_diff
theorem not_mem_of_mem_diff {s t : Set α} {x : α} (h : x ∈ s \ t) : x ∉ t :=
h.right
#align set.not_mem_of_mem_diff Set.not_mem_of_mem_diff
theorem diff_eq_compl_inter {s t : Set α} : s \ t = tᶜ ∩ s := by rw [diff_eq, inter_comm]
#align set.diff_eq_compl_inter Set.diff_eq_compl_inter
theorem nonempty_diff {s t : Set α} : (s \ t).Nonempty ↔ ¬s ⊆ t :=
inter_compl_nonempty_iff
#align set.nonempty_diff Set.nonempty_diff
theorem diff_subset {s t : Set α} : s \ t ⊆ s := show s \ t ≤ s from sdiff_le
#align set.diff_subset Set.diff_subset
theorem diff_subset_compl (s t : Set α) : s \ t ⊆ tᶜ :=
diff_eq_compl_inter ▸ inter_subset_left
theorem union_diff_cancel' {s t u : Set α} (h₁ : s ⊆ t) (h₂ : t ⊆ u) : t ∪ u \ s = u :=
sup_sdiff_cancel' h₁ h₂
#align set.union_diff_cancel' Set.union_diff_cancel'
theorem union_diff_cancel {s t : Set α} (h : s ⊆ t) : s ∪ t \ s = t :=
sup_sdiff_cancel_right h
#align set.union_diff_cancel Set.union_diff_cancel
theorem union_diff_cancel_left {s t : Set α} (h : s ∩ t ⊆ ∅) : (s ∪ t) \ s = t :=
Disjoint.sup_sdiff_cancel_left <| disjoint_iff_inf_le.2 h
#align set.union_diff_cancel_left Set.union_diff_cancel_left
theorem union_diff_cancel_right {s t : Set α} (h : s ∩ t ⊆ ∅) : (s ∪ t) \ t = s :=
Disjoint.sup_sdiff_cancel_right <| disjoint_iff_inf_le.2 h
#align set.union_diff_cancel_right Set.union_diff_cancel_right
@[simp]
theorem union_diff_left {s t : Set α} : (s ∪ t) \ s = t \ s :=
sup_sdiff_left_self
#align set.union_diff_left Set.union_diff_left
@[simp]
theorem union_diff_right {s t : Set α} : (s ∪ t) \ t = s \ t :=
sup_sdiff_right_self
#align set.union_diff_right Set.union_diff_right
theorem union_diff_distrib {s t u : Set α} : (s ∪ t) \ u = s \ u ∪ t \ u :=
sup_sdiff
#align set.union_diff_distrib Set.union_diff_distrib
theorem inter_diff_assoc (a b c : Set α) : (a ∩ b) \ c = a ∩ (b \ c) :=
inf_sdiff_assoc
#align set.inter_diff_assoc Set.inter_diff_assoc
@[simp]
theorem inter_diff_self (a b : Set α) : a ∩ (b \ a) = ∅ :=
inf_sdiff_self_right
#align set.inter_diff_self Set.inter_diff_self
@[simp]
theorem inter_union_diff (s t : Set α) : s ∩ t ∪ s \ t = s :=
sup_inf_sdiff s t
#align set.inter_union_diff Set.inter_union_diff
@[simp]
theorem diff_union_inter (s t : Set α) : s \ t ∪ s ∩ t = s := by
rw [union_comm]
exact sup_inf_sdiff _ _
#align set.diff_union_inter Set.diff_union_inter
@[simp]
theorem inter_union_compl (s t : Set α) : s ∩ t ∪ s ∩ tᶜ = s :=
inter_union_diff _ _
#align set.inter_union_compl Set.inter_union_compl
@[gcongr]
theorem diff_subset_diff {s₁ s₂ t₁ t₂ : Set α} : s₁ ⊆ s₂ → t₂ ⊆ t₁ → s₁ \ t₁ ⊆ s₂ \ t₂ :=
show s₁ ≤ s₂ → t₂ ≤ t₁ → s₁ \ t₁ ≤ s₂ \ t₂ from sdiff_le_sdiff
#align set.diff_subset_diff Set.diff_subset_diff
@[gcongr]
theorem diff_subset_diff_left {s₁ s₂ t : Set α} (h : s₁ ⊆ s₂) : s₁ \ t ⊆ s₂ \ t :=
sdiff_le_sdiff_right ‹s₁ ≤ s₂›
#align set.diff_subset_diff_left Set.diff_subset_diff_left
@[gcongr]
theorem diff_subset_diff_right {s t u : Set α} (h : t ⊆ u) : s \ u ⊆ s \ t :=
sdiff_le_sdiff_left ‹t ≤ u›
#align set.diff_subset_diff_right Set.diff_subset_diff_right
theorem compl_eq_univ_diff (s : Set α) : sᶜ = univ \ s :=
top_sdiff.symm
#align set.compl_eq_univ_diff Set.compl_eq_univ_diff
@[simp]
theorem empty_diff (s : Set α) : (∅ \ s : Set α) = ∅ :=
bot_sdiff
#align set.empty_diff Set.empty_diff
theorem diff_eq_empty {s t : Set α} : s \ t = ∅ ↔ s ⊆ t :=
sdiff_eq_bot_iff
#align set.diff_eq_empty Set.diff_eq_empty
@[simp]
theorem diff_empty {s : Set α} : s \ ∅ = s :=
sdiff_bot
#align set.diff_empty Set.diff_empty
@[simp]
theorem diff_univ (s : Set α) : s \ univ = ∅ :=
diff_eq_empty.2 (subset_univ s)
#align set.diff_univ Set.diff_univ
theorem diff_diff {u : Set α} : (s \ t) \ u = s \ (t ∪ u) :=
sdiff_sdiff_left
#align set.diff_diff Set.diff_diff
-- the following statement contains parentheses to help the reader
theorem diff_diff_comm {s t u : Set α} : (s \ t) \ u = (s \ u) \ t :=
sdiff_sdiff_comm
#align set.diff_diff_comm Set.diff_diff_comm
theorem diff_subset_iff {s t u : Set α} : s \ t ⊆ u ↔ s ⊆ t ∪ u :=
show s \ t ≤ u ↔ s ≤ t ∪ u from sdiff_le_iff
#align set.diff_subset_iff Set.diff_subset_iff
theorem subset_diff_union (s t : Set α) : s ⊆ s \ t ∪ t :=
show s ≤ s \ t ∪ t from le_sdiff_sup
#align set.subset_diff_union Set.subset_diff_union
theorem diff_union_of_subset {s t : Set α} (h : t ⊆ s) : s \ t ∪ t = s :=
Subset.antisymm (union_subset diff_subset h) (subset_diff_union _ _)
#align set.diff_union_of_subset Set.diff_union_of_subset
@[simp]
theorem diff_singleton_subset_iff {x : α} {s t : Set α} : s \ {x} ⊆ t ↔ s ⊆ insert x t := by
rw [← union_singleton, union_comm]
apply diff_subset_iff
#align set.diff_singleton_subset_iff Set.diff_singleton_subset_iff
theorem subset_diff_singleton {x : α} {s t : Set α} (h : s ⊆ t) (hx : x ∉ s) : s ⊆ t \ {x} :=
subset_inter h <| subset_compl_comm.1 <| singleton_subset_iff.2 hx
#align set.subset_diff_singleton Set.subset_diff_singleton
theorem subset_insert_diff_singleton (x : α) (s : Set α) : s ⊆ insert x (s \ {x}) := by
rw [← diff_singleton_subset_iff]
#align set.subset_insert_diff_singleton Set.subset_insert_diff_singleton
theorem diff_subset_comm {s t u : Set α} : s \ t ⊆ u ↔ s \ u ⊆ t :=
show s \ t ≤ u ↔ s \ u ≤ t from sdiff_le_comm
#align set.diff_subset_comm Set.diff_subset_comm
theorem diff_inter {s t u : Set α} : s \ (t ∩ u) = s \ t ∪ s \ u :=
sdiff_inf
#align set.diff_inter Set.diff_inter
theorem diff_inter_diff {s t u : Set α} : s \ t ∩ (s \ u) = s \ (t ∪ u) :=
sdiff_sup.symm
#align set.diff_inter_diff Set.diff_inter_diff
theorem diff_compl : s \ tᶜ = s ∩ t :=
sdiff_compl
#align set.diff_compl Set.diff_compl
theorem diff_diff_right {s t u : Set α} : s \ (t \ u) = s \ t ∪ s ∩ u :=
sdiff_sdiff_right'
#align set.diff_diff_right Set.diff_diff_right
@[simp]
theorem insert_diff_of_mem (s) (h : a ∈ t) : insert a s \ t = s \ t := by
ext
constructor <;> simp (config := { contextual := true }) [or_imp, h]
#align set.insert_diff_of_mem Set.insert_diff_of_mem
theorem insert_diff_of_not_mem (s) (h : a ∉ t) : insert a s \ t = insert a (s \ t) := by
classical
ext x
by_cases h' : x ∈ t
· have : x ≠ a := by
intro H
rw [H] at h'
exact h h'
simp [h, h', this]
· simp [h, h']
#align set.insert_diff_of_not_mem Set.insert_diff_of_not_mem
theorem insert_diff_self_of_not_mem {a : α} {s : Set α} (h : a ∉ s) : insert a s \ {a} = s := by
ext x
simp [and_iff_left_of_imp fun hx : x ∈ s => show x ≠ a from fun hxa => h <| hxa ▸ hx]
#align set.insert_diff_self_of_not_mem Set.insert_diff_self_of_not_mem
@[simp]
theorem insert_diff_eq_singleton {a : α} {s : Set α} (h : a ∉ s) : insert a s \ s = {a} := by
ext
rw [Set.mem_diff, Set.mem_insert_iff, Set.mem_singleton_iff, or_and_right, and_not_self_iff,
or_false_iff, and_iff_left_iff_imp]
rintro rfl
exact h
#align set.insert_diff_eq_singleton Set.insert_diff_eq_singleton
theorem inter_insert_of_mem (h : a ∈ s) : s ∩ insert a t = insert a (s ∩ t) := by
rw [insert_inter_distrib, insert_eq_of_mem h]
#align set.inter_insert_of_mem Set.inter_insert_of_mem
theorem insert_inter_of_mem (h : a ∈ t) : insert a s ∩ t = insert a (s ∩ t) := by
rw [insert_inter_distrib, insert_eq_of_mem h]
#align set.insert_inter_of_mem Set.insert_inter_of_mem
theorem inter_insert_of_not_mem (h : a ∉ s) : s ∩ insert a t = s ∩ t :=
ext fun _ => and_congr_right fun hx => or_iff_right <| ne_of_mem_of_not_mem hx h
#align set.inter_insert_of_not_mem Set.inter_insert_of_not_mem
theorem insert_inter_of_not_mem (h : a ∉ t) : insert a s ∩ t = s ∩ t :=
ext fun _ => and_congr_left fun hx => or_iff_right <| ne_of_mem_of_not_mem hx h
#align set.insert_inter_of_not_mem Set.insert_inter_of_not_mem
@[simp]
theorem union_diff_self {s t : Set α} : s ∪ t \ s = s ∪ t :=
sup_sdiff_self _ _
#align set.union_diff_self Set.union_diff_self
@[simp]
theorem diff_union_self {s t : Set α} : s \ t ∪ t = s ∪ t :=
sdiff_sup_self _ _
#align set.diff_union_self Set.diff_union_self
@[simp]
theorem diff_inter_self {a b : Set α} : b \ a ∩ a = ∅ :=
inf_sdiff_self_left
#align set.diff_inter_self Set.diff_inter_self
@[simp]
theorem diff_inter_self_eq_diff {s t : Set α} : s \ (t ∩ s) = s \ t :=
sdiff_inf_self_right _ _
#align set.diff_inter_self_eq_diff Set.diff_inter_self_eq_diff
@[simp]
theorem diff_self_inter {s t : Set α} : s \ (s ∩ t) = s \ t :=
sdiff_inf_self_left _ _
#align set.diff_self_inter Set.diff_self_inter
@[simp]
theorem diff_singleton_eq_self {a : α} {s : Set α} (h : a ∉ s) : s \ {a} = s :=
sdiff_eq_self_iff_disjoint.2 <| by simp [h]
#align set.diff_singleton_eq_self Set.diff_singleton_eq_self
@[simp]
theorem diff_singleton_sSubset {s : Set α} {a : α} : s \ {a} ⊂ s ↔ a ∈ s :=
sdiff_le.lt_iff_ne.trans <| sdiff_eq_left.not.trans <| by simp
#align set.diff_singleton_ssubset Set.diff_singleton_sSubset
@[simp]
theorem insert_diff_singleton {a : α} {s : Set α} : insert a (s \ {a}) = insert a s := by
simp [insert_eq, union_diff_self, -union_singleton, -singleton_union]
#align set.insert_diff_singleton Set.insert_diff_singleton
theorem insert_diff_singleton_comm (hab : a ≠ b) (s : Set α) :
insert a (s \ {b}) = insert a s \ {b} := by
simp_rw [← union_singleton, union_diff_distrib,
diff_singleton_eq_self (mem_singleton_iff.not.2 hab.symm)]
#align set.insert_diff_singleton_comm Set.insert_diff_singleton_comm
--Porting note (#10618): removed `simp` attribute because `simp` can prove it
theorem diff_self {s : Set α} : s \ s = ∅ :=
sdiff_self
#align set.diff_self Set.diff_self
theorem diff_diff_right_self (s t : Set α) : s \ (s \ t) = s ∩ t :=
sdiff_sdiff_right_self
#align set.diff_diff_right_self Set.diff_diff_right_self
theorem diff_diff_cancel_left {s t : Set α} (h : s ⊆ t) : t \ (t \ s) = s :=
sdiff_sdiff_eq_self h
#align set.diff_diff_cancel_left Set.diff_diff_cancel_left
theorem mem_diff_singleton {x y : α} {s : Set α} : x ∈ s \ {y} ↔ x ∈ s ∧ x ≠ y :=
Iff.rfl
#align set.mem_diff_singleton Set.mem_diff_singleton
theorem mem_diff_singleton_empty {t : Set (Set α)} : s ∈ t \ {∅} ↔ s ∈ t ∧ s.Nonempty :=
mem_diff_singleton.trans <| and_congr_right' nonempty_iff_ne_empty.symm
#align set.mem_diff_singleton_empty Set.mem_diff_singleton_empty
theorem subset_insert_iff {s t : Set α} {x : α} :
s ⊆ insert x t ↔ s ⊆ t ∨ (x ∈ s ∧ s \ {x} ⊆ t) := by
rw [← diff_singleton_subset_iff]
by_cases hx : x ∈ s
· rw [and_iff_right hx, or_iff_right_of_imp diff_subset.trans]
rw [diff_singleton_eq_self hx, or_iff_left_of_imp And.right]
theorem union_eq_diff_union_diff_union_inter (s t : Set α) : s ∪ t = s \ t ∪ t \ s ∪ s ∩ t :=
sup_eq_sdiff_sup_sdiff_sup_inf
#align set.union_eq_diff_union_diff_union_inter Set.union_eq_diff_union_diff_union_inter
--Porting note (#10618): removed `simp` attribute because `simp` can prove it
theorem pair_eq_singleton (a : α) : ({a, a} : Set α) = {a} :=
union_self _
#align set.pair_eq_singleton Set.pair_eq_singleton
theorem pair_comm (a b : α) : ({a, b} : Set α) = {b, a} :=
union_comm _ _
#align set.pair_comm Set.pair_comm
theorem pair_eq_pair_iff {x y z w : α} :
({x, y} : Set α) = {z, w} ↔ x = z ∧ y = w ∨ x = w ∧ y = z := by
simp [subset_antisymm_iff, insert_subset_iff]; aesop
#align set.pair_eq_pair_iff Set.pair_eq_pair_iff
theorem pair_diff_left (hne : a ≠ b) : ({a, b} : Set α) \ {a} = {b} := by
rw [insert_diff_of_mem _ (mem_singleton a), diff_singleton_eq_self (by simpa)]
theorem pair_diff_right (hne : a ≠ b) : ({a, b} : Set α) \ {b} = {a} := by
rw [pair_comm, pair_diff_left hne.symm]
theorem pair_subset_iff : {a, b} ⊆ s ↔ a ∈ s ∧ b ∈ s := by
rw [insert_subset_iff, singleton_subset_iff]
theorem pair_subset (ha : a ∈ s) (hb : b ∈ s) : {a, b} ⊆ s :=
pair_subset_iff.2 ⟨ha,hb⟩
theorem subset_pair_iff : s ⊆ {a, b} ↔ ∀ x ∈ s, x = a ∨ x = b := by
simp [subset_def]
| Mathlib/Data/Set/Basic.lean | 2,097 | 2,102 | theorem subset_pair_iff_eq {x y : α} : s ⊆ {x, y} ↔ s = ∅ ∨ s = {x} ∨ s = {y} ∨ s = {x, y} := by |
refine ⟨?_, by rintro (rfl | rfl | rfl | rfl) <;> simp [pair_subset_iff]⟩
rw [subset_insert_iff, subset_singleton_iff_eq, subset_singleton_iff_eq,
← subset_empty_iff (s := s \ {x}), diff_subset_iff, union_empty, subset_singleton_iff_eq]
have h : x ∈ s → {y} = s \ {x} → s = {x,y} := fun h₁ h₂ ↦ by simp [h₁, h₂]
tauto
|
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⟩
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 ?_
rw [aeval_map_algebraMap, minpoly.aeval]
#align minpoly.dvd_map_of_is_scalar_tower minpoly.dvd_map_of_isScalarTower
theorem dvd_map_of_isScalarTower' (R : Type*) {S : Type*} (K L : Type*) [CommRing R]
[CommRing S] [Field K] [CommRing L] [Algebra R S] [Algebra R K] [Algebra S L] [Algebra K L]
[Algebra R L] [IsScalarTower R K L] [IsScalarTower R S L] (s : S) :
minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (minpoly R s) := by
apply minpoly.dvd K (algebraMap S L s)
rw [← map_aeval_eq_aeval_map, minpoly.aeval, map_zero]
rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
#align minpoly.dvd_map_of_is_scalar_tower' minpoly.dvd_map_of_isScalarTower'
theorem aeval_of_isScalarTower (R : Type*) {K T U : Type*} [CommRing R] [Field K] [CommRing T]
[Algebra R K] [Algebra K T] [Algebra R T] [IsScalarTower R K T] [CommSemiring U] [Algebra K U]
[Algebra R U] [IsScalarTower R K U] (x : T) (y : U)
(hy : Polynomial.aeval y (minpoly K x) = 0) : Polynomial.aeval y (minpoly R x) = 0 :=
aeval_map_algebraMap K y (minpoly R x) ▸
eval₂_eq_zero_of_dvd_of_eval₂_eq_zero (algebraMap K U) y
(minpoly.dvd_map_of_isScalarTower R K x) hy
#align minpoly.aeval_of_is_scalar_tower minpoly.aeval_of_isScalarTower
@[simp]
lemma ker_aeval_eq_span_minpoly :
RingHom.ker (Polynomial.aeval x) = A[X] ∙ minpoly A x := by
ext p
simp_rw [RingHom.mem_ker, ← minpoly.dvd_iff, Submodule.mem_span_singleton,
dvd_iff_exists_eq_mul_left, smul_eq_mul, eq_comm (a := p)]
variable {A x}
theorem eq_of_irreducible_of_monic [Nontrivial B] {p : A[X]} (hp1 : Irreducible p)
(hp2 : Polynomial.aeval x p = 0) (hp3 : p.Monic) : p = minpoly A x :=
let ⟨_, hq⟩ := dvd A x hp2
eq_of_monic_of_associated hp3 (monic ⟨p, ⟨hp3, hp2⟩⟩) <|
mul_one (minpoly A x) ▸ hq.symm ▸ Associated.mul_left _
(associated_one_iff_isUnit.2 <| (hp1.isUnit_or_isUnit hq).resolve_left <| not_isUnit A x)
#align minpoly.eq_of_irreducible_of_monic minpoly.eq_of_irreducible_of_monic
theorem eq_of_irreducible [Nontrivial B] {p : A[X]} (hp1 : Irreducible p)
(hp2 : Polynomial.aeval x p = 0) : p * C p.leadingCoeff⁻¹ = minpoly A x := by
have : p.leadingCoeff ≠ 0 := leadingCoeff_ne_zero.mpr hp1.ne_zero
apply eq_of_irreducible_of_monic
· exact Associated.irreducible ⟨⟨C p.leadingCoeff⁻¹, C p.leadingCoeff,
by rwa [← C_mul, inv_mul_cancel, C_1], by rwa [← C_mul, mul_inv_cancel, C_1]⟩, rfl⟩ hp1
· rw [aeval_mul, hp2, zero_mul]
· rwa [Polynomial.Monic, leadingCoeff_mul, leadingCoeff_C, mul_inv_cancel]
#align minpoly.eq_of_irreducible minpoly.eq_of_irreducible
theorem add_algebraMap {B : Type*} [CommRing B] [Algebra A B] {x : B} (hx : IsIntegral A x)
(a : A) : minpoly A (x + algebraMap A B a) = (minpoly A x).comp (X - C a) := by
refine (minpoly.unique _ _ ((minpoly.monic hx).comp_X_sub_C _) ?_ fun q qmo hq => ?_).symm
· simp [aeval_comp]
· have : (Polynomial.aeval x) (q.comp (X + C a)) = 0 := by simpa [aeval_comp] using hq
have H := minpoly.min A x (qmo.comp_X_add_C _) this
rw [degree_eq_natDegree qmo.ne_zero,
degree_eq_natDegree ((minpoly.monic hx).comp_X_sub_C _).ne_zero, natDegree_comp,
natDegree_X_sub_C, mul_one]
rwa [degree_eq_natDegree (minpoly.ne_zero hx),
degree_eq_natDegree (qmo.comp_X_add_C _).ne_zero, natDegree_comp,
natDegree_X_add_C, mul_one] at H
#align minpoly.add_algebra_map minpoly.add_algebraMap
theorem sub_algebraMap {B : Type*} [CommRing B] [Algebra A B] {x : B} (hx : IsIntegral A x)
(a : A) : minpoly A (x - algebraMap A B a) = (minpoly A x).comp (X + C a) := by
simpa [sub_eq_add_neg] using add_algebraMap hx (-a)
#align minpoly.sub_algebra_map minpoly.sub_algebraMap
section IsDomain
variable [Ring B] [IsDomain B] [Algebra A B]
variable {A} {x : B}
| Mathlib/FieldTheory/Minpoly/Field.lean | 238 | 243 | theorem prime (hx : IsIntegral A x) : Prime (minpoly A x) := by |
refine ⟨minpoly.ne_zero hx, not_isUnit A x, ?_⟩
rintro p q ⟨d, h⟩
have : Polynomial.aeval x (p * q) = 0 := by simp [h, aeval A x]
replace : Polynomial.aeval x p = 0 ∨ Polynomial.aeval x q = 0 := by simpa
exact Or.imp (dvd A x) (dvd A x) this
|
import Mathlib.Analysis.Normed.Group.Seminorm
import Mathlib.Order.LiminfLimsup
import Mathlib.Topology.Instances.Rat
import Mathlib.Topology.MetricSpace.Algebra
import Mathlib.Topology.MetricSpace.IsometricSMul
import Mathlib.Topology.Sequences
#align_import analysis.normed.group.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01"
variable {𝓕 𝕜 α ι κ E F G : Type*}
open Filter Function Metric Bornology
open ENNReal Filter NNReal Uniformity Pointwise Topology
@[notation_class]
class Norm (E : Type*) where
norm : E → ℝ
#align has_norm Norm
@[notation_class]
class NNNorm (E : Type*) where
nnnorm : E → ℝ≥0
#align has_nnnorm NNNorm
export Norm (norm)
export NNNorm (nnnorm)
@[inherit_doc]
notation "‖" e "‖" => norm e
@[inherit_doc]
notation "‖" e "‖₊" => nnnorm e
class SeminormedAddGroup (E : Type*) extends Norm E, AddGroup E, PseudoMetricSpace E where
dist := fun x y => ‖x - y‖
dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop
#align seminormed_add_group SeminormedAddGroup
@[to_additive]
class SeminormedGroup (E : Type*) extends Norm E, Group E, PseudoMetricSpace E where
dist := fun x y => ‖x / y‖
dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop
#align seminormed_group SeminormedGroup
class NormedAddGroup (E : Type*) extends Norm E, AddGroup E, MetricSpace E where
dist := fun x y => ‖x - y‖
dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop
#align normed_add_group NormedAddGroup
@[to_additive]
class NormedGroup (E : Type*) extends Norm E, Group E, MetricSpace E where
dist := fun x y => ‖x / y‖
dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop
#align normed_group NormedGroup
class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E,
PseudoMetricSpace E where
dist := fun x y => ‖x - y‖
dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop
#align seminormed_add_comm_group SeminormedAddCommGroup
@[to_additive]
class SeminormedCommGroup (E : Type*) extends Norm E, CommGroup E, PseudoMetricSpace E where
dist := fun x y => ‖x / y‖
dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop
#align seminormed_comm_group SeminormedCommGroup
class NormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, MetricSpace E where
dist := fun x y => ‖x - y‖
dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop
#align normed_add_comm_group NormedAddCommGroup
@[to_additive]
class NormedCommGroup (E : Type*) extends Norm E, CommGroup E, MetricSpace E where
dist := fun x y => ‖x / y‖
dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop
#align normed_comm_group NormedCommGroup
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedGroup.toSeminormedGroup [NormedGroup E] : SeminormedGroup E :=
{ ‹NormedGroup E› with }
#align normed_group.to_seminormed_group NormedGroup.toSeminormedGroup
#align normed_add_group.to_seminormed_add_group NormedAddGroup.toSeminormedAddGroup
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedCommGroup.toSeminormedCommGroup [NormedCommGroup E] :
SeminormedCommGroup E :=
{ ‹NormedCommGroup E› with }
#align normed_comm_group.to_seminormed_comm_group NormedCommGroup.toSeminormedCommGroup
#align normed_add_comm_group.to_seminormed_add_comm_group NormedAddCommGroup.toSeminormedAddCommGroup
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) SeminormedCommGroup.toSeminormedGroup [SeminormedCommGroup E] :
SeminormedGroup E :=
{ ‹SeminormedCommGroup E› with }
#align seminormed_comm_group.to_seminormed_group SeminormedCommGroup.toSeminormedGroup
#align seminormed_add_comm_group.to_seminormed_add_group SeminormedAddCommGroup.toSeminormedAddGroup
-- See note [lower instance priority]
@[to_additive]
instance (priority := 100) NormedCommGroup.toNormedGroup [NormedCommGroup E] : NormedGroup E :=
{ ‹NormedCommGroup E› with }
#align normed_comm_group.to_normed_group NormedCommGroup.toNormedGroup
#align normed_add_comm_group.to_normed_add_group NormedAddCommGroup.toNormedAddGroup
-- See note [reducible non-instances]
@[to_additive (attr := reducible) "Construct a `NormedAddGroup` from a `SeminormedAddGroup`
satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace`
level when declaring a `NormedAddGroup` instance as a special case of a more general
`SeminormedAddGroup` instance."]
def NormedGroup.ofSeparation [SeminormedGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) :
NormedGroup E where
dist_eq := ‹SeminormedGroup E›.dist_eq
toMetricSpace :=
{ eq_of_dist_eq_zero := fun hxy =>
div_eq_one.1 <| h _ <| by exact (‹SeminormedGroup E›.dist_eq _ _).symm.trans hxy }
-- Porting note: the `rwa` no longer worked, but it was easy enough to provide the term.
-- however, notice that if you make `x` and `y` accessible, then the following does work:
-- `have := ‹SeminormedGroup E›.dist_eq x y; rwa [← this]`, so I'm not sure why the `rwa`
-- was broken.
#align normed_group.of_separation NormedGroup.ofSeparation
#align normed_add_group.of_separation NormedAddGroup.ofSeparation
-- See note [reducible non-instances]
@[to_additive (attr := reducible) "Construct a `NormedAddCommGroup` from a
`SeminormedAddCommGroup` satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the
`(Pseudo)MetricSpace` level when declaring a `NormedAddCommGroup` instance as a special case
of a more general `SeminormedAddCommGroup` instance."]
def NormedCommGroup.ofSeparation [SeminormedCommGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) :
NormedCommGroup E :=
{ ‹SeminormedCommGroup E›, NormedGroup.ofSeparation h with }
#align normed_comm_group.of_separation NormedCommGroup.ofSeparation
#align normed_add_comm_group.of_separation NormedAddCommGroup.ofSeparation
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a translation-invariant distance."]
def SeminormedGroup.ofMulDist [Norm E] [Group E] [PseudoMetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) :
SeminormedGroup E where
dist_eq x y := by
rw [h₁]; apply le_antisymm
· simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _
· simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y
#align seminormed_group.of_mul_dist SeminormedGroup.ofMulDist
#align seminormed_add_group.of_add_dist SeminormedAddGroup.ofAddDist
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a translation-invariant pseudodistance."]
def SeminormedGroup.ofMulDist' [Norm E] [Group E] [PseudoMetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) :
SeminormedGroup E where
dist_eq x y := by
rw [h₁]; apply le_antisymm
· simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y
· simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _
#align seminormed_group.of_mul_dist' SeminormedGroup.ofMulDist'
#align seminormed_add_group.of_add_dist' SeminormedAddGroup.ofAddDist'
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a translation-invariant pseudodistance."]
def SeminormedCommGroup.ofMulDist [Norm E] [CommGroup E] [PseudoMetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) :
SeminormedCommGroup E :=
{ SeminormedGroup.ofMulDist h₁ h₂ with
mul_comm := mul_comm }
#align seminormed_comm_group.of_mul_dist SeminormedCommGroup.ofMulDist
#align seminormed_add_comm_group.of_add_dist SeminormedAddCommGroup.ofAddDist
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a translation-invariant pseudodistance."]
def SeminormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [PseudoMetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) :
SeminormedCommGroup E :=
{ SeminormedGroup.ofMulDist' h₁ h₂ with
mul_comm := mul_comm }
#align seminormed_comm_group.of_mul_dist' SeminormedCommGroup.ofMulDist'
#align seminormed_add_comm_group.of_add_dist' SeminormedAddCommGroup.ofAddDist'
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a translation-invariant distance."]
def NormedGroup.ofMulDist [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1)
(h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : NormedGroup E :=
{ SeminormedGroup.ofMulDist h₁ h₂ with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
#align normed_group.of_mul_dist NormedGroup.ofMulDist
#align normed_add_group.of_add_dist NormedAddGroup.ofAddDist
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a translation-invariant pseudodistance."]
def NormedGroup.ofMulDist' [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1)
(h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : NormedGroup E :=
{ SeminormedGroup.ofMulDist' h₁ h₂ with
eq_of_dist_eq_zero := eq_of_dist_eq_zero }
#align normed_group.of_mul_dist' NormedGroup.ofMulDist'
#align normed_add_group.of_add_dist' NormedAddGroup.ofAddDist'
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a translation-invariant pseudodistance."]
def NormedCommGroup.ofMulDist [Norm E] [CommGroup E] [MetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) :
NormedCommGroup E :=
{ NormedGroup.ofMulDist h₁ h₂ with
mul_comm := mul_comm }
#align normed_comm_group.of_mul_dist NormedCommGroup.ofMulDist
#align normed_add_comm_group.of_add_dist NormedAddCommGroup.ofAddDist
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a translation-invariant pseudodistance."]
def NormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [MetricSpace E]
(h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) :
NormedCommGroup E :=
{ NormedGroup.ofMulDist' h₁ h₂ with
mul_comm := mul_comm }
#align normed_comm_group.of_mul_dist' NormedCommGroup.ofMulDist'
#align normed_add_comm_group.of_add_dist' NormedAddCommGroup.ofAddDist'
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a seminorm, i.e., registering the pseudodistance
and the pseudometric space structure from the seminorm properties. Note that in most cases this
instance creates bad definitional equalities (e.g., it does not take into account a possibly
existing `UniformSpace` instance on `E`)."]
def GroupSeminorm.toSeminormedGroup [Group E] (f : GroupSeminorm E) : SeminormedGroup E where
dist x y := f (x / y)
norm := f
dist_eq x y := rfl
dist_self x := by simp only [div_self', map_one_eq_zero]
dist_triangle := le_map_div_add_map_div f
dist_comm := map_div_rev f
edist_dist x y := by exact ENNReal.coe_nnreal_eq _
-- Porting note: how did `mathlib3` solve this automatically?
#align group_seminorm.to_seminormed_group GroupSeminorm.toSeminormedGroup
#align add_group_seminorm.to_seminormed_add_group AddGroupSeminorm.toSeminormedAddGroup
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a seminormed group from a seminorm, i.e., registering the pseudodistance
and the pseudometric space structure from the seminorm properties. Note that in most cases this
instance creates bad definitional equalities (e.g., it does not take into account a possibly
existing `UniformSpace` instance on `E`)."]
def GroupSeminorm.toSeminormedCommGroup [CommGroup E] (f : GroupSeminorm E) :
SeminormedCommGroup E :=
{ f.toSeminormedGroup with
mul_comm := mul_comm }
#align group_seminorm.to_seminormed_comm_group GroupSeminorm.toSeminormedCommGroup
#align add_group_seminorm.to_seminormed_add_comm_group AddGroupSeminorm.toSeminormedAddCommGroup
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a norm, i.e., registering the distance and the metric
space structure from the norm properties. Note that in most cases this instance creates bad
definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace`
instance on `E`)."]
def GroupNorm.toNormedGroup [Group E] (f : GroupNorm E) : NormedGroup E :=
{ f.toGroupSeminorm.toSeminormedGroup with
eq_of_dist_eq_zero := fun h => div_eq_one.1 <| eq_one_of_map_eq_zero f h }
#align group_norm.to_normed_group GroupNorm.toNormedGroup
#align add_group_norm.to_normed_add_group AddGroupNorm.toNormedAddGroup
-- See note [reducible non-instances]
@[to_additive (attr := reducible)
"Construct a normed group from a norm, i.e., registering the distance and the metric
space structure from the norm properties. Note that in most cases this instance creates bad
definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace`
instance on `E`)."]
def GroupNorm.toNormedCommGroup [CommGroup E] (f : GroupNorm E) : NormedCommGroup E :=
{ f.toNormedGroup with
mul_comm := mul_comm }
#align group_norm.to_normed_comm_group GroupNorm.toNormedCommGroup
#align add_group_norm.to_normed_add_comm_group AddGroupNorm.toNormedAddCommGroup
instance PUnit.normedAddCommGroup : NormedAddCommGroup PUnit where
norm := Function.const _ 0
dist_eq _ _ := rfl
@[simp]
theorem PUnit.norm_eq_zero (r : PUnit) : ‖r‖ = 0 :=
rfl
#align punit.norm_eq_zero PUnit.norm_eq_zero
section SeminormedGroup
variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E}
{a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ}
@[to_additive]
theorem dist_eq_norm_div (a b : E) : dist a b = ‖a / b‖ :=
SeminormedGroup.dist_eq _ _
#align dist_eq_norm_div dist_eq_norm_div
#align dist_eq_norm_sub dist_eq_norm_sub
@[to_additive]
theorem dist_eq_norm_div' (a b : E) : dist a b = ‖b / a‖ := by rw [dist_comm, dist_eq_norm_div]
#align dist_eq_norm_div' dist_eq_norm_div'
#align dist_eq_norm_sub' dist_eq_norm_sub'
alias dist_eq_norm := dist_eq_norm_sub
#align dist_eq_norm dist_eq_norm
alias dist_eq_norm' := dist_eq_norm_sub'
#align dist_eq_norm' dist_eq_norm'
@[to_additive]
instance NormedGroup.to_isometricSMul_right : IsometricSMul Eᵐᵒᵖ E :=
⟨fun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]⟩
#align normed_group.to_has_isometric_smul_right NormedGroup.to_isometricSMul_right
#align normed_add_group.to_has_isometric_vadd_right NormedAddGroup.to_isometricVAdd_right
@[to_additive (attr := simp)]
theorem dist_one_right (a : E) : dist a 1 = ‖a‖ := by rw [dist_eq_norm_div, div_one]
#align dist_one_right dist_one_right
#align dist_zero_right dist_zero_right
@[to_additive]
theorem inseparable_one_iff_norm {a : E} : Inseparable a 1 ↔ ‖a‖ = 0 := by
rw [Metric.inseparable_iff, dist_one_right]
@[to_additive (attr := simp)]
theorem dist_one_left : dist (1 : E) = norm :=
funext fun a => by rw [dist_comm, dist_one_right]
#align dist_one_left dist_one_left
#align dist_zero_left dist_zero_left
@[to_additive]
theorem Isometry.norm_map_of_map_one {f : E → F} (hi : Isometry f) (h₁ : f 1 = 1) (x : E) :
‖f x‖ = ‖x‖ := by rw [← dist_one_right, ← h₁, hi.dist_eq, dist_one_right]
#align isometry.norm_map_of_map_one Isometry.norm_map_of_map_one
#align isometry.norm_map_of_map_zero Isometry.norm_map_of_map_zero
@[to_additive (attr := simp) comap_norm_atTop]
theorem comap_norm_atTop' : comap norm atTop = cobounded E := by
simpa only [dist_one_right] using comap_dist_right_atTop (1 : E)
@[to_additive Filter.HasBasis.cobounded_of_norm]
lemma Filter.HasBasis.cobounded_of_norm' {ι : Sort*} {p : ι → Prop} {s : ι → Set ℝ}
(h : HasBasis atTop p s) : HasBasis (cobounded E) p fun i ↦ norm ⁻¹' s i :=
comap_norm_atTop' (E := E) ▸ h.comap _
@[to_additive Filter.hasBasis_cobounded_norm]
lemma Filter.hasBasis_cobounded_norm' : HasBasis (cobounded E) (fun _ ↦ True) ({x | · ≤ ‖x‖}) :=
atTop_basis.cobounded_of_norm'
@[to_additive (attr := simp) tendsto_norm_atTop_iff_cobounded]
theorem tendsto_norm_atTop_iff_cobounded' {f : α → E} {l : Filter α} :
Tendsto (‖f ·‖) l atTop ↔ Tendsto f l (cobounded E) := by
rw [← comap_norm_atTop', tendsto_comap_iff]; rfl
@[to_additive tendsto_norm_cobounded_atTop]
theorem tendsto_norm_cobounded_atTop' : Tendsto norm (cobounded E) atTop :=
tendsto_norm_atTop_iff_cobounded'.2 tendsto_id
@[to_additive eventually_cobounded_le_norm]
lemma eventually_cobounded_le_norm' (a : ℝ) : ∀ᶠ x in cobounded E, a ≤ ‖x‖ :=
tendsto_norm_cobounded_atTop'.eventually_ge_atTop a
@[to_additive tendsto_norm_cocompact_atTop]
theorem tendsto_norm_cocompact_atTop' [ProperSpace E] : Tendsto norm (cocompact E) atTop :=
cobounded_eq_cocompact (α := E) ▸ tendsto_norm_cobounded_atTop'
#align tendsto_norm_cocompact_at_top' tendsto_norm_cocompact_atTop'
#align tendsto_norm_cocompact_at_top tendsto_norm_cocompact_atTop
@[to_additive]
theorem norm_div_rev (a b : E) : ‖a / b‖ = ‖b / a‖ := by
simpa only [dist_eq_norm_div] using dist_comm a b
#align norm_div_rev norm_div_rev
#align norm_sub_rev norm_sub_rev
@[to_additive (attr := simp) norm_neg]
theorem norm_inv' (a : E) : ‖a⁻¹‖ = ‖a‖ := by simpa using norm_div_rev 1 a
#align norm_inv' norm_inv'
#align norm_neg norm_neg
open scoped symmDiff in
@[to_additive]
theorem dist_mulIndicator (s t : Set α) (f : α → E) (x : α) :
dist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖ := by
rw [dist_eq_norm_div, Set.apply_mulIndicator_symmDiff norm_inv']
@[to_additive (attr := simp)]
theorem dist_mul_self_right (a b : E) : dist b (a * b) = ‖a‖ := by
rw [← dist_one_left, ← dist_mul_right 1 a b, one_mul]
#align dist_mul_self_right dist_mul_self_right
#align dist_add_self_right dist_add_self_right
@[to_additive (attr := simp)]
theorem dist_mul_self_left (a b : E) : dist (a * b) b = ‖a‖ := by
rw [dist_comm, dist_mul_self_right]
#align dist_mul_self_left dist_mul_self_left
#align dist_add_self_left dist_add_self_left
@[to_additive (attr := simp)]
theorem dist_div_eq_dist_mul_left (a b c : E) : dist (a / b) c = dist a (c * b) := by
rw [← dist_mul_right _ _ b, div_mul_cancel]
#align dist_div_eq_dist_mul_left dist_div_eq_dist_mul_left
#align dist_sub_eq_dist_add_left dist_sub_eq_dist_add_left
@[to_additive (attr := simp)]
theorem dist_div_eq_dist_mul_right (a b c : E) : dist a (b / c) = dist (a * c) b := by
rw [← dist_mul_right _ _ c, div_mul_cancel]
#align dist_div_eq_dist_mul_right dist_div_eq_dist_mul_right
#align dist_sub_eq_dist_add_right dist_sub_eq_dist_add_right
@[to_additive (attr := simp)]
lemma Filter.inv_cobounded : (cobounded E)⁻¹ = cobounded E := by
simp only [← comap_norm_atTop', ← Filter.comap_inv, comap_comap, (· ∘ ·), norm_inv']
@[to_additive "In a (semi)normed group, negation `x ↦ -x` tends to infinity at infinity."]
theorem Filter.tendsto_inv_cobounded : Tendsto Inv.inv (cobounded E) (cobounded E) :=
inv_cobounded.le
#align filter.tendsto_inv_cobounded Filter.tendsto_inv_cobounded
#align filter.tendsto_neg_cobounded Filter.tendsto_neg_cobounded
@[to_additive norm_add_le "**Triangle inequality** for the norm."]
theorem norm_mul_le' (a b : E) : ‖a * b‖ ≤ ‖a‖ + ‖b‖ := by
simpa [dist_eq_norm_div] using dist_triangle a 1 b⁻¹
#align norm_mul_le' norm_mul_le'
#align norm_add_le norm_add_le
@[to_additive]
theorem norm_mul_le_of_le (h₁ : ‖a₁‖ ≤ r₁) (h₂ : ‖a₂‖ ≤ r₂) : ‖a₁ * a₂‖ ≤ r₁ + r₂ :=
(norm_mul_le' a₁ a₂).trans <| add_le_add h₁ h₂
#align norm_mul_le_of_le norm_mul_le_of_le
#align norm_add_le_of_le norm_add_le_of_le
@[to_additive norm_add₃_le]
theorem norm_mul₃_le (a b c : E) : ‖a * b * c‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ :=
norm_mul_le_of_le (norm_mul_le' _ _) le_rfl
#align norm_mul₃_le norm_mul₃_le
#align norm_add₃_le norm_add₃_le
@[to_additive]
lemma norm_div_le_norm_div_add_norm_div (a b c : E) : ‖a / c‖ ≤ ‖a / b‖ + ‖b / c‖ := by
simpa only [dist_eq_norm_div] using dist_triangle a b c
@[to_additive (attr := simp) norm_nonneg]
theorem norm_nonneg' (a : E) : 0 ≤ ‖a‖ := by
rw [← dist_one_right]
exact dist_nonneg
#align norm_nonneg' norm_nonneg'
#align norm_nonneg norm_nonneg
@[to_additive (attr := simp) abs_norm]
theorem abs_norm' (z : E) : |‖z‖| = ‖z‖ := abs_of_nonneg <| norm_nonneg' _
#align abs_norm abs_norm
@[to_additive (attr := simp) norm_zero]
theorem norm_one' : ‖(1 : E)‖ = 0 := by rw [← dist_one_right, dist_self]
#align norm_one' norm_one'
#align norm_zero norm_zero
@[to_additive]
theorem ne_one_of_norm_ne_zero : ‖a‖ ≠ 0 → a ≠ 1 :=
mt <| by
rintro rfl
exact norm_one'
#align ne_one_of_norm_ne_zero ne_one_of_norm_ne_zero
#align ne_zero_of_norm_ne_zero ne_zero_of_norm_ne_zero
@[to_additive (attr := nontriviality) norm_of_subsingleton]
theorem norm_of_subsingleton' [Subsingleton E] (a : E) : ‖a‖ = 0 := by
rw [Subsingleton.elim a 1, norm_one']
#align norm_of_subsingleton' norm_of_subsingleton'
#align norm_of_subsingleton norm_of_subsingleton
@[to_additive zero_lt_one_add_norm_sq]
theorem zero_lt_one_add_norm_sq' (x : E) : 0 < 1 + ‖x‖ ^ 2 := by
positivity
#align zero_lt_one_add_norm_sq' zero_lt_one_add_norm_sq'
#align zero_lt_one_add_norm_sq zero_lt_one_add_norm_sq
@[to_additive]
theorem norm_div_le (a b : E) : ‖a / b‖ ≤ ‖a‖ + ‖b‖ := by
simpa [dist_eq_norm_div] using dist_triangle a 1 b
#align norm_div_le norm_div_le
#align norm_sub_le norm_sub_le
@[to_additive]
theorem norm_div_le_of_le {r₁ r₂ : ℝ} (H₁ : ‖a₁‖ ≤ r₁) (H₂ : ‖a₂‖ ≤ r₂) : ‖a₁ / a₂‖ ≤ r₁ + r₂ :=
(norm_div_le a₁ a₂).trans <| add_le_add H₁ H₂
#align norm_div_le_of_le norm_div_le_of_le
#align norm_sub_le_of_le norm_sub_le_of_le
@[to_additive dist_le_norm_add_norm]
theorem dist_le_norm_add_norm' (a b : E) : dist a b ≤ ‖a‖ + ‖b‖ := by
rw [dist_eq_norm_div]
apply norm_div_le
#align dist_le_norm_add_norm' dist_le_norm_add_norm'
#align dist_le_norm_add_norm dist_le_norm_add_norm
@[to_additive abs_norm_sub_norm_le]
theorem abs_norm_sub_norm_le' (a b : E) : |‖a‖ - ‖b‖| ≤ ‖a / b‖ := by
simpa [dist_eq_norm_div] using abs_dist_sub_le a b 1
#align abs_norm_sub_norm_le' abs_norm_sub_norm_le'
#align abs_norm_sub_norm_le abs_norm_sub_norm_le
@[to_additive norm_sub_norm_le]
theorem norm_sub_norm_le' (a b : E) : ‖a‖ - ‖b‖ ≤ ‖a / b‖ :=
(le_abs_self _).trans (abs_norm_sub_norm_le' a b)
#align norm_sub_norm_le' norm_sub_norm_le'
#align norm_sub_norm_le norm_sub_norm_le
@[to_additive dist_norm_norm_le]
theorem dist_norm_norm_le' (a b : E) : dist ‖a‖ ‖b‖ ≤ ‖a / b‖ :=
abs_norm_sub_norm_le' a b
#align dist_norm_norm_le' dist_norm_norm_le'
#align dist_norm_norm_le dist_norm_norm_le
@[to_additive]
theorem norm_le_norm_add_norm_div' (u v : E) : ‖u‖ ≤ ‖v‖ + ‖u / v‖ := by
rw [add_comm]
refine (norm_mul_le' _ _).trans_eq' ?_
rw [div_mul_cancel]
#align norm_le_norm_add_norm_div' norm_le_norm_add_norm_div'
#align norm_le_norm_add_norm_sub' norm_le_norm_add_norm_sub'
@[to_additive]
theorem norm_le_norm_add_norm_div (u v : E) : ‖v‖ ≤ ‖u‖ + ‖u / v‖ := by
rw [norm_div_rev]
exact norm_le_norm_add_norm_div' v u
#align norm_le_norm_add_norm_div norm_le_norm_add_norm_div
#align norm_le_norm_add_norm_sub norm_le_norm_add_norm_sub
alias norm_le_insert' := norm_le_norm_add_norm_sub'
#align norm_le_insert' norm_le_insert'
alias norm_le_insert := norm_le_norm_add_norm_sub
#align norm_le_insert norm_le_insert
@[to_additive]
theorem norm_le_mul_norm_add (u v : E) : ‖u‖ ≤ ‖u * v‖ + ‖v‖ :=
calc
‖u‖ = ‖u * v / v‖ := by rw [mul_div_cancel_right]
_ ≤ ‖u * v‖ + ‖v‖ := norm_div_le _ _
#align norm_le_mul_norm_add norm_le_mul_norm_add
#align norm_le_add_norm_add norm_le_add_norm_add
@[to_additive ball_eq]
theorem ball_eq' (y : E) (ε : ℝ) : ball y ε = { x | ‖x / y‖ < ε } :=
Set.ext fun a => by simp [dist_eq_norm_div]
#align ball_eq' ball_eq'
#align ball_eq ball_eq
@[to_additive]
theorem ball_one_eq (r : ℝ) : ball (1 : E) r = { x | ‖x‖ < r } :=
Set.ext fun a => by simp
#align ball_one_eq ball_one_eq
#align ball_zero_eq ball_zero_eq
@[to_additive mem_ball_iff_norm]
theorem mem_ball_iff_norm'' : b ∈ ball a r ↔ ‖b / a‖ < r := by rw [mem_ball, dist_eq_norm_div]
#align mem_ball_iff_norm'' mem_ball_iff_norm''
#align mem_ball_iff_norm mem_ball_iff_norm
@[to_additive mem_ball_iff_norm']
theorem mem_ball_iff_norm''' : b ∈ ball a r ↔ ‖a / b‖ < r := by rw [mem_ball', dist_eq_norm_div]
#align mem_ball_iff_norm''' mem_ball_iff_norm'''
#align mem_ball_iff_norm' mem_ball_iff_norm'
@[to_additive] -- Porting note (#10618): `simp` can prove it
theorem mem_ball_one_iff : a ∈ ball (1 : E) r ↔ ‖a‖ < r := by rw [mem_ball, dist_one_right]
#align mem_ball_one_iff mem_ball_one_iff
#align mem_ball_zero_iff mem_ball_zero_iff
@[to_additive mem_closedBall_iff_norm]
theorem mem_closedBall_iff_norm'' : b ∈ closedBall a r ↔ ‖b / a‖ ≤ r := by
rw [mem_closedBall, dist_eq_norm_div]
#align mem_closed_ball_iff_norm'' mem_closedBall_iff_norm''
#align mem_closed_ball_iff_norm mem_closedBall_iff_norm
@[to_additive] -- Porting note (#10618): `simp` can prove it
theorem mem_closedBall_one_iff : a ∈ closedBall (1 : E) r ↔ ‖a‖ ≤ r := by
rw [mem_closedBall, dist_one_right]
#align mem_closed_ball_one_iff mem_closedBall_one_iff
#align mem_closed_ball_zero_iff mem_closedBall_zero_iff
@[to_additive mem_closedBall_iff_norm']
theorem mem_closedBall_iff_norm''' : b ∈ closedBall a r ↔ ‖a / b‖ ≤ r := by
rw [mem_closedBall', dist_eq_norm_div]
#align mem_closed_ball_iff_norm''' mem_closedBall_iff_norm'''
#align mem_closed_ball_iff_norm' mem_closedBall_iff_norm'
@[to_additive norm_le_of_mem_closedBall]
theorem norm_le_of_mem_closedBall' (h : b ∈ closedBall a r) : ‖b‖ ≤ ‖a‖ + r :=
(norm_le_norm_add_norm_div' _ _).trans <| add_le_add_left (by rwa [← dist_eq_norm_div]) _
#align norm_le_of_mem_closed_ball' norm_le_of_mem_closedBall'
#align norm_le_of_mem_closed_ball norm_le_of_mem_closedBall
@[to_additive norm_le_norm_add_const_of_dist_le]
theorem norm_le_norm_add_const_of_dist_le' : dist a b ≤ r → ‖a‖ ≤ ‖b‖ + r :=
norm_le_of_mem_closedBall'
#align norm_le_norm_add_const_of_dist_le' norm_le_norm_add_const_of_dist_le'
#align norm_le_norm_add_const_of_dist_le norm_le_norm_add_const_of_dist_le
@[to_additive norm_lt_of_mem_ball]
theorem norm_lt_of_mem_ball' (h : b ∈ ball a r) : ‖b‖ < ‖a‖ + r :=
(norm_le_norm_add_norm_div' _ _).trans_lt <| add_lt_add_left (by rwa [← dist_eq_norm_div]) _
#align norm_lt_of_mem_ball' norm_lt_of_mem_ball'
#align norm_lt_of_mem_ball norm_lt_of_mem_ball
@[to_additive]
theorem norm_div_sub_norm_div_le_norm_div (u v w : E) : ‖u / w‖ - ‖v / w‖ ≤ ‖u / v‖ := by
simpa only [div_div_div_cancel_right'] using norm_sub_norm_le' (u / w) (v / w)
#align norm_div_sub_norm_div_le_norm_div norm_div_sub_norm_div_le_norm_div
#align norm_sub_sub_norm_sub_le_norm_sub norm_sub_sub_norm_sub_le_norm_sub
@[to_additive isBounded_iff_forall_norm_le]
theorem isBounded_iff_forall_norm_le' : Bornology.IsBounded s ↔ ∃ C, ∀ x ∈ s, ‖x‖ ≤ C := by
simpa only [Set.subset_def, mem_closedBall_one_iff] using isBounded_iff_subset_closedBall (1 : E)
#align bounded_iff_forall_norm_le' isBounded_iff_forall_norm_le'
#align bounded_iff_forall_norm_le isBounded_iff_forall_norm_le
alias ⟨Bornology.IsBounded.exists_norm_le', _⟩ := isBounded_iff_forall_norm_le'
#align metric.bounded.exists_norm_le' Bornology.IsBounded.exists_norm_le'
alias ⟨Bornology.IsBounded.exists_norm_le, _⟩ := isBounded_iff_forall_norm_le
#align metric.bounded.exists_norm_le Bornology.IsBounded.exists_norm_le
attribute [to_additive existing exists_norm_le] Bornology.IsBounded.exists_norm_le'
@[to_additive exists_pos_norm_le]
theorem Bornology.IsBounded.exists_pos_norm_le' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ ≤ R :=
let ⟨R₀, hR₀⟩ := hs.exists_norm_le'
⟨max R₀ 1, by positivity, fun x hx => (hR₀ x hx).trans <| le_max_left _ _⟩
#align metric.bounded.exists_pos_norm_le' Bornology.IsBounded.exists_pos_norm_le'
#align metric.bounded.exists_pos_norm_le Bornology.IsBounded.exists_pos_norm_le
@[to_additive Bornology.IsBounded.exists_pos_norm_lt]
theorem Bornology.IsBounded.exists_pos_norm_lt' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ < R :=
let ⟨R, hR₀, hR⟩ := hs.exists_pos_norm_le'
⟨R + 1, by positivity, fun x hx ↦ (hR x hx).trans_lt (lt_add_one _)⟩
@[to_additive (attr := simp 1001) mem_sphere_iff_norm]
-- Porting note: increase priority so the left-hand side doesn't reduce
theorem mem_sphere_iff_norm' : b ∈ sphere a r ↔ ‖b / a‖ = r := by simp [dist_eq_norm_div]
#align mem_sphere_iff_norm' mem_sphere_iff_norm'
#align mem_sphere_iff_norm mem_sphere_iff_norm
@[to_additive] -- `simp` can prove this
theorem mem_sphere_one_iff_norm : a ∈ sphere (1 : E) r ↔ ‖a‖ = r := by simp [dist_eq_norm_div]
#align mem_sphere_one_iff_norm mem_sphere_one_iff_norm
#align mem_sphere_zero_iff_norm mem_sphere_zero_iff_norm
@[to_additive (attr := simp) norm_eq_of_mem_sphere]
theorem norm_eq_of_mem_sphere' (x : sphere (1 : E) r) : ‖(x : E)‖ = r :=
mem_sphere_one_iff_norm.mp x.2
#align norm_eq_of_mem_sphere' norm_eq_of_mem_sphere'
#align norm_eq_of_mem_sphere norm_eq_of_mem_sphere
@[to_additive]
theorem ne_one_of_mem_sphere (hr : r ≠ 0) (x : sphere (1 : E) r) : (x : E) ≠ 1 :=
ne_one_of_norm_ne_zero <| by rwa [norm_eq_of_mem_sphere' x]
#align ne_one_of_mem_sphere ne_one_of_mem_sphere
#align ne_zero_of_mem_sphere ne_zero_of_mem_sphere
@[to_additive ne_zero_of_mem_unit_sphere]
theorem ne_one_of_mem_unit_sphere (x : sphere (1 : E) 1) : (x : E) ≠ 1 :=
ne_one_of_mem_sphere one_ne_zero _
#align ne_one_of_mem_unit_sphere ne_one_of_mem_unit_sphere
#align ne_zero_of_mem_unit_sphere ne_zero_of_mem_unit_sphere
variable (E)
@[to_additive "The norm of a seminormed group as an additive group seminorm."]
def normGroupSeminorm : GroupSeminorm E :=
⟨norm, norm_one', norm_mul_le', norm_inv'⟩
#align norm_group_seminorm normGroupSeminorm
#align norm_add_group_seminorm normAddGroupSeminorm
@[to_additive (attr := simp)]
theorem coe_normGroupSeminorm : ⇑(normGroupSeminorm E) = norm :=
rfl
#align coe_norm_group_seminorm coe_normGroupSeminorm
#align coe_norm_add_group_seminorm coe_normAddGroupSeminorm
variable {E}
@[to_additive]
theorem NormedCommGroup.tendsto_nhds_one {f : α → E} {l : Filter α} :
Tendsto f l (𝓝 1) ↔ ∀ ε > 0, ∀ᶠ x in l, ‖f x‖ < ε :=
Metric.tendsto_nhds.trans <| by simp only [dist_one_right]
#align normed_comm_group.tendsto_nhds_one NormedCommGroup.tendsto_nhds_one
#align normed_add_comm_group.tendsto_nhds_zero NormedAddCommGroup.tendsto_nhds_zero
@[to_additive]
theorem NormedCommGroup.tendsto_nhds_nhds {f : E → F} {x : E} {y : F} :
Tendsto f (𝓝 x) (𝓝 y) ↔ ∀ ε > 0, ∃ δ > 0, ∀ x', ‖x' / x‖ < δ → ‖f x' / y‖ < ε := by
simp_rw [Metric.tendsto_nhds_nhds, dist_eq_norm_div]
#align normed_comm_group.tendsto_nhds_nhds NormedCommGroup.tendsto_nhds_nhds
#align normed_add_comm_group.tendsto_nhds_nhds NormedAddCommGroup.tendsto_nhds_nhds
@[to_additive]
theorem NormedCommGroup.cauchySeq_iff [Nonempty α] [SemilatticeSup α] {u : α → E} :
CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m, N ≤ m → ∀ n, N ≤ n → ‖u m / u n‖ < ε := by
simp [Metric.cauchySeq_iff, dist_eq_norm_div]
#align normed_comm_group.cauchy_seq_iff NormedCommGroup.cauchySeq_iff
#align normed_add_comm_group.cauchy_seq_iff NormedAddCommGroup.cauchySeq_iff
@[to_additive]
theorem NormedCommGroup.nhds_basis_norm_lt (x : E) :
(𝓝 x).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y / x‖ < ε } := by
simp_rw [← ball_eq']
exact Metric.nhds_basis_ball
#align normed_comm_group.nhds_basis_norm_lt NormedCommGroup.nhds_basis_norm_lt
#align normed_add_comm_group.nhds_basis_norm_lt NormedAddCommGroup.nhds_basis_norm_lt
@[to_additive]
theorem NormedCommGroup.nhds_one_basis_norm_lt :
(𝓝 (1 : E)).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y‖ < ε } := by
convert NormedCommGroup.nhds_basis_norm_lt (1 : E)
simp
#align normed_comm_group.nhds_one_basis_norm_lt NormedCommGroup.nhds_one_basis_norm_lt
#align normed_add_comm_group.nhds_zero_basis_norm_lt NormedAddCommGroup.nhds_zero_basis_norm_lt
@[to_additive]
theorem NormedCommGroup.uniformity_basis_dist :
(𝓤 E).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { p : E × E | ‖p.fst / p.snd‖ < ε } := by
convert Metric.uniformity_basis_dist (α := E) using 1
simp [dist_eq_norm_div]
#align normed_comm_group.uniformity_basis_dist NormedCommGroup.uniformity_basis_dist
#align normed_add_comm_group.uniformity_basis_dist NormedAddCommGroup.uniformity_basis_dist
open Finset
variable [FunLike 𝓕 E F]
@[to_additive "A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant
`C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`. The analogous condition for a linear map of
(semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`."]
theorem MonoidHomClass.lipschitz_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ)
(h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : LipschitzWith (Real.toNNReal C) f :=
LipschitzWith.of_dist_le' fun x y => by simpa only [dist_eq_norm_div, map_div] using h (x / y)
#align monoid_hom_class.lipschitz_of_bound MonoidHomClass.lipschitz_of_bound
#align add_monoid_hom_class.lipschitz_of_bound AddMonoidHomClass.lipschitz_of_bound
@[to_additive]
theorem lipschitzOnWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} :
LipschitzOnWith C f s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ‖f x / f y‖ ≤ C * ‖x / y‖ := by
simp only [lipschitzOnWith_iff_dist_le_mul, dist_eq_norm_div]
#align lipschitz_on_with_iff_norm_div_le lipschitzOnWith_iff_norm_div_le
#align lipschitz_on_with_iff_norm_sub_le lipschitzOnWith_iff_norm_sub_le
alias ⟨LipschitzOnWith.norm_div_le, _⟩ := lipschitzOnWith_iff_norm_div_le
#align lipschitz_on_with.norm_div_le LipschitzOnWith.norm_div_le
attribute [to_additive] LipschitzOnWith.norm_div_le
@[to_additive]
theorem LipschitzOnWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzOnWith C f s)
(ha : a ∈ s) (hb : b ∈ s) (hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r :=
(h.norm_div_le ha hb).trans <| by gcongr
#align lipschitz_on_with.norm_div_le_of_le LipschitzOnWith.norm_div_le_of_le
#align lipschitz_on_with.norm_sub_le_of_le LipschitzOnWith.norm_sub_le_of_le
@[to_additive]
theorem lipschitzWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} :
LipschitzWith C f ↔ ∀ x y, ‖f x / f y‖ ≤ C * ‖x / y‖ := by
simp only [lipschitzWith_iff_dist_le_mul, dist_eq_norm_div]
#align lipschitz_with_iff_norm_div_le lipschitzWith_iff_norm_div_le
#align lipschitz_with_iff_norm_sub_le lipschitzWith_iff_norm_sub_le
alias ⟨LipschitzWith.norm_div_le, _⟩ := lipschitzWith_iff_norm_div_le
#align lipschitz_with.norm_div_le LipschitzWith.norm_div_le
attribute [to_additive] LipschitzWith.norm_div_le
@[to_additive]
theorem LipschitzWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzWith C f)
(hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r :=
(h.norm_div_le _ _).trans <| by gcongr
#align lipschitz_with.norm_div_le_of_le LipschitzWith.norm_div_le_of_le
#align lipschitz_with.norm_sub_le_of_le LipschitzWith.norm_sub_le_of_le
@[to_additive "A homomorphism `f` of seminormed groups is continuous, if there exists a constant `C`
such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`"]
theorem MonoidHomClass.continuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ)
(h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : Continuous f :=
(MonoidHomClass.lipschitz_of_bound f C h).continuous
#align monoid_hom_class.continuous_of_bound MonoidHomClass.continuous_of_bound
#align add_monoid_hom_class.continuous_of_bound AddMonoidHomClass.continuous_of_bound
@[to_additive]
theorem MonoidHomClass.uniformContinuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ)
(h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : UniformContinuous f :=
(MonoidHomClass.lipschitz_of_bound f C h).uniformContinuous
#align monoid_hom_class.uniform_continuous_of_bound MonoidHomClass.uniformContinuous_of_bound
#align add_monoid_hom_class.uniform_continuous_of_bound AddMonoidHomClass.uniformContinuous_of_bound
@[to_additive IsCompact.exists_bound_of_continuousOn]
theorem IsCompact.exists_bound_of_continuousOn' [TopologicalSpace α] {s : Set α} (hs : IsCompact s)
{f : α → E} (hf : ContinuousOn f s) : ∃ C, ∀ x ∈ s, ‖f x‖ ≤ C :=
(isBounded_iff_forall_norm_le'.1 (hs.image_of_continuousOn hf).isBounded).imp fun _C hC _x hx =>
hC _ <| Set.mem_image_of_mem _ hx
#align is_compact.exists_bound_of_continuous_on' IsCompact.exists_bound_of_continuousOn'
#align is_compact.exists_bound_of_continuous_on IsCompact.exists_bound_of_continuousOn
@[to_additive]
| Mathlib/Analysis/Normed/Group/Basic.lean | 946 | 948 | theorem HasCompactMulSupport.exists_bound_of_continuous [TopologicalSpace α]
{f : α → E} (hf : HasCompactMulSupport f) (h'f : Continuous f) : ∃ C, ∀ x, ‖f x‖ ≤ C := by |
simpa using (hf.isCompact_range h'f).isBounded.exists_norm_le'
|
import Mathlib.Data.Finsupp.Encodable
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Span
import Mathlib.Data.Set.Countable
#align_import linear_algebra.finsupp from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Set LinearMap Submodule
namespace Finsupp
section LinearEquiv.finsuppUnique
variable (R : Type*) {S : Type*} (M : Type*)
variable [AddCommMonoid M] [Semiring R] [Module R M]
variable (α : Type*) [Unique α]
noncomputable def LinearEquiv.finsuppUnique : (α →₀ M) ≃ₗ[R] M :=
{ Finsupp.equivFunOnFinite.trans (Equiv.funUnique α M) with
map_add' := fun _ _ => rfl
map_smul' := fun _ _ => rfl }
#align finsupp.linear_equiv.finsupp_unique Finsupp.LinearEquiv.finsuppUnique
variable {R M}
@[simp]
theorem LinearEquiv.finsuppUnique_apply (f : α →₀ M) :
LinearEquiv.finsuppUnique R M α f = f default :=
rfl
#align finsupp.linear_equiv.finsupp_unique_apply Finsupp.LinearEquiv.finsuppUnique_apply
variable {α}
@[simp]
| Mathlib/LinearAlgebra/Finsupp.lean | 133 | 136 | theorem LinearEquiv.finsuppUnique_symm_apply [Unique α] (m : M) :
(LinearEquiv.finsuppUnique R M α).symm m = Finsupp.single default m := by |
ext; simp [LinearEquiv.finsuppUnique, Equiv.funUnique, single, Pi.single,
equivFunOnFinite, Function.update]
|
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set Function Filter
open scoped NNReal Topology
instance Real.punctured_nhds_module_neBot {E : Type*} [AddCommGroup E] [TopologicalSpace E]
[ContinuousAdd E] [Nontrivial E] [Module ℝ E] [ContinuousSMul ℝ E] (x : E) : NeBot (𝓝[≠] x) :=
Module.punctured_nhds_neBot ℝ E x
#align real.punctured_nhds_module_ne_bot Real.punctured_nhds_module_neBot
section Seminormed
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
theorem inv_norm_smul_mem_closed_unit_ball (x : E) :
‖x‖⁻¹ • x ∈ closedBall (0 : E) 1 := by
simp only [mem_closedBall_zero_iff, norm_smul, norm_inv, norm_norm, ← div_eq_inv_mul,
div_self_le_one]
#align inv_norm_smul_mem_closed_unit_ball inv_norm_smul_mem_closed_unit_ball
theorem norm_smul_of_nonneg {t : ℝ} (ht : 0 ≤ t) (x : E) : ‖t • x‖ = t * ‖x‖ := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht]
#align norm_smul_of_nonneg norm_smul_of_nonneg
| Mathlib/Analysis/NormedSpace/Real.lean | 50 | 59 | theorem dist_smul_add_one_sub_smul_le {r : ℝ} {x y : E} (h : r ∈ Icc 0 1) :
dist (r • x + (1 - r) • y) x ≤ dist y x :=
calc
dist (r • x + (1 - r) • y) x = ‖1 - r‖ * ‖x - y‖ := by |
simp_rw [dist_eq_norm', ← norm_smul, sub_smul, one_smul, smul_sub, ← sub_sub, ← sub_add,
sub_right_comm]
_ = (1 - r) * dist y x := by
rw [Real.norm_eq_abs, abs_eq_self.mpr (sub_nonneg.mpr h.2), dist_eq_norm']
_ ≤ (1 - 0) * dist y x := by gcongr; exact h.1
_ = dist y x := by rw [sub_zero, one_mul]
|
import Mathlib.Logic.Equiv.PartialEquiv
import Mathlib.Topology.Sets.Opens
#align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db"
open Function Set Filter Topology
variable {X X' : Type*} {Y Y' : Type*} {Z Z' : Type*}
[TopologicalSpace X] [TopologicalSpace X'] [TopologicalSpace Y] [TopologicalSpace Y']
[TopologicalSpace Z] [TopologicalSpace Z']
-- Porting note(#5171): this linter isn't ported yet. @[nolint has_nonempty_instance]
structure PartialHomeomorph (X : Type*) (Y : Type*) [TopologicalSpace X]
[TopologicalSpace Y] extends PartialEquiv X Y where
open_source : IsOpen source
open_target : IsOpen target
continuousOn_toFun : ContinuousOn toFun source
continuousOn_invFun : ContinuousOn invFun target
#align local_homeomorph PartialHomeomorph
namespace PartialHomeomorph
variable (e : PartialHomeomorph X Y)
@[simps! (config := .asFn) apply symm_apply toPartialEquiv,
simps! (config := .lemmasOnly) source target]
def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : X ≃ₜ Y) (s : Set X) (hs : IsOpen s)
(t : Set Y) (h : e '' s = t) : PartialHomeomorph X Y where
toPartialEquiv := e.toPartialEquivOfImageEq s t h
open_source := hs
open_target := by simpa [← h]
continuousOn_toFun := e.continuous.continuousOn
continuousOn_invFun := e.symm.continuous.continuousOn
@[simps! (config := mfld_cfg)]
def _root_.Homeomorph.toPartialHomeomorph (e : X ≃ₜ Y) : PartialHomeomorph X Y :=
e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq]
#align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph
def replaceEquiv (e : PartialHomeomorph X Y) (e' : PartialEquiv X Y) (h : e.toPartialEquiv = e') :
PartialHomeomorph X Y where
toPartialEquiv := e'
open_source := h ▸ e.open_source
open_target := h ▸ e.open_target
continuousOn_toFun := h ▸ e.continuousOn_toFun
continuousOn_invFun := h ▸ e.continuousOn_invFun
#align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv
theorem replaceEquiv_eq_self (e' : PartialEquiv X Y)
(h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by
cases e
subst e'
rfl
#align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self
theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target :=
e.mapsTo
#align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target
@[deprecated toPartialEquiv_injective (since := "2023-02-18")]
theorem eq_of_partialEquiv_eq {e e' : PartialHomeomorph X Y}
(h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' :=
toPartialEquiv_injective h
#align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_partialEquiv_eq
theorem eventually_left_inverse {x} (hx : x ∈ e.source) :
∀ᶠ y in 𝓝 x, e.symm (e y) = y :=
(e.open_source.eventually_mem hx).mono e.left_inv'
#align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse
theorem eventually_left_inverse' {x} (hx : x ∈ e.target) :
∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y :=
e.eventually_left_inverse (e.map_target hx)
#align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse'
theorem eventually_right_inverse {x} (hx : x ∈ e.target) :
∀ᶠ y in 𝓝 x, e (e.symm y) = y :=
(e.open_target.eventually_mem hx).mono e.right_inv'
#align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse
theorem eventually_right_inverse' {x} (hx : x ∈ e.source) :
∀ᶠ y in 𝓝 (e x), e (e.symm y) = y :=
e.eventually_right_inverse (e.map_source hx)
#align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse'
theorem eventually_ne_nhdsWithin {x} (hx : x ∈ e.source) :
∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x :=
eventually_nhdsWithin_iff.2 <|
(e.eventually_left_inverse hx).mono fun x' hx' =>
mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx']
#align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin
theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set X) : 𝓝[e.source ∩ s] x = 𝓝[s] x :=
nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx)
#align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter
theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set Y) : 𝓝[e.target ∩ s] x = 𝓝[s] x :=
e.symm.nhdsWithin_source_inter hx s
#align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter
theorem image_eq_target_inter_inv_preimage {s : Set X} (h : s ⊆ e.source) :
e '' s = e.target ∩ e.symm ⁻¹' s :=
e.toPartialEquiv.image_eq_target_inter_inv_preimage h
#align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage
theorem image_source_inter_eq' (s : Set X) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s :=
e.toPartialEquiv.image_source_inter_eq' s
#align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq'
theorem image_source_inter_eq (s : Set X) :
e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) :=
e.toPartialEquiv.image_source_inter_eq s
#align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq
theorem symm_image_eq_source_inter_preimage {s : Set Y} (h : s ⊆ e.target) :
e.symm '' s = e.source ∩ e ⁻¹' s :=
e.symm.image_eq_target_inter_inv_preimage h
#align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage
theorem symm_image_target_inter_eq (s : Set Y) :
e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) :=
e.symm.image_source_inter_eq _
#align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq
theorem source_inter_preimage_inv_preimage (s : Set X) :
e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s :=
e.toPartialEquiv.source_inter_preimage_inv_preimage s
#align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage
theorem target_inter_inv_preimage_preimage (s : Set Y) :
e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s :=
e.symm.source_inter_preimage_inv_preimage _
#align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage
theorem source_inter_preimage_target_inter (s : Set Y) :
e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s :=
e.toPartialEquiv.source_inter_preimage_target_inter s
#align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter
theorem image_source_eq_target : e '' e.source = e.target :=
e.toPartialEquiv.image_source_eq_target
#align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target
theorem symm_image_target_eq_source : e.symm '' e.target = e.source :=
e.symm.image_source_eq_target
#align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source
@[ext]
protected theorem ext (e' : PartialHomeomorph X Y) (h : ∀ x, e x = e' x)
(hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' :=
toPartialEquiv_injective (PartialEquiv.ext h hinv hs)
#align local_homeomorph.ext PartialHomeomorph.ext
protected theorem ext_iff {e e' : PartialHomeomorph X Y} :
e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source :=
⟨by
rintro rfl
exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩
#align local_homeomorph.ext_iff PartialHomeomorph.ext_iff
@[simp, mfld_simps]
theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm :=
rfl
#align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv
-- The following lemmas are already simp via `PartialEquiv`
theorem symm_source : e.symm.source = e.target :=
rfl
#align local_homeomorph.symm_source PartialHomeomorph.symm_source
theorem symm_target : e.symm.target = e.source :=
rfl
#align local_homeomorph.symm_target PartialHomeomorph.symm_target
@[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl
#align local_homeomorph.symm_symm PartialHomeomorph.symm_symm
theorem symm_bijective : Function.Bijective
(PartialHomeomorph.symm : PartialHomeomorph X Y → PartialHomeomorph Y X) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
protected theorem continuousAt {x : X} (h : x ∈ e.source) : ContinuousAt e x :=
(e.continuousOn x h).continuousAt (e.open_source.mem_nhds h)
#align local_homeomorph.continuous_at PartialHomeomorph.continuousAt
theorem continuousAt_symm {x : Y} (h : x ∈ e.target) : ContinuousAt e.symm x :=
e.symm.continuousAt h
#align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm
| Mathlib/Topology/PartialHomeomorph.lean | 381 | 382 | theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by |
simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx)
|
import Mathlib.RingTheory.Valuation.Basic
import Mathlib.NumberTheory.Padics.PadicNorm
import Mathlib.Analysis.Normed.Field.Basic
#align_import number_theory.padics.padic_numbers from "leanprover-community/mathlib"@"b9b2114f7711fec1c1e055d507f082f8ceb2c3b7"
noncomputable section
open scoped Classical
open Nat multiplicity padicNorm CauSeq CauSeq.Completion Metric
abbrev PadicSeq (p : ℕ) :=
CauSeq _ (padicNorm p)
#align padic_seq PadicSeq
namespace PadicSeq
section
variable {p : ℕ} [Fact p.Prime]
theorem stationary {f : CauSeq ℚ (padicNorm p)} (hf : ¬f ≈ 0) :
∃ N, ∀ m n, N ≤ m → N ≤ n → padicNorm p (f n) = padicNorm p (f m) :=
have : ∃ ε > 0, ∃ N1, ∀ j ≥ N1, ε ≤ padicNorm p (f j) :=
CauSeq.abv_pos_of_not_limZero <| not_limZero_of_not_congr_zero hf
let ⟨ε, hε, N1, hN1⟩ := this
let ⟨N2, hN2⟩ := CauSeq.cauchy₂ f hε
⟨max N1 N2, fun n m hn hm ↦ by
have : padicNorm p (f n - f m) < ε := hN2 _ (max_le_iff.1 hn).2 _ (max_le_iff.1 hm).2
have : padicNorm p (f n - f m) < padicNorm p (f n) :=
lt_of_lt_of_le this <| hN1 _ (max_le_iff.1 hn).1
have : padicNorm p (f n - f m) < max (padicNorm p (f n)) (padicNorm p (f m)) :=
lt_max_iff.2 (Or.inl this)
by_contra hne
rw [← padicNorm.neg (f m)] at hne
have hnam := add_eq_max_of_ne hne
rw [padicNorm.neg, max_comm] at hnam
rw [← hnam, sub_eq_add_neg, add_comm] at this
apply _root_.lt_irrefl _ this⟩
#align padic_seq.stationary PadicSeq.stationary
def stationaryPoint {f : PadicSeq p} (hf : ¬f ≈ 0) : ℕ :=
Classical.choose <| stationary hf
#align padic_seq.stationary_point PadicSeq.stationaryPoint
theorem stationaryPoint_spec {f : PadicSeq p} (hf : ¬f ≈ 0) :
∀ {m n},
stationaryPoint hf ≤ m → stationaryPoint hf ≤ n → padicNorm p (f n) = padicNorm p (f m) :=
@(Classical.choose_spec <| stationary hf)
#align padic_seq.stationary_point_spec PadicSeq.stationaryPoint_spec
def norm (f : PadicSeq p) : ℚ :=
if hf : f ≈ 0 then 0 else padicNorm p (f (stationaryPoint hf))
#align padic_seq.norm PadicSeq.norm
theorem norm_zero_iff (f : PadicSeq p) : f.norm = 0 ↔ f ≈ 0 := by
constructor
· intro h
by_contra hf
unfold norm at h
split_ifs at h
· contradiction
apply hf
intro ε hε
exists stationaryPoint hf
intro j hj
have heq := stationaryPoint_spec hf le_rfl hj
simpa [h, heq]
· intro h
simp [norm, h]
#align padic_seq.norm_zero_iff PadicSeq.norm_zero_iff
end
def Padic (p : ℕ) [Fact p.Prime] :=
CauSeq.Completion.Cauchy (padicNorm p)
#align padic Padic
notation "ℚ_[" p "]" => Padic p
namespace Padic
namespace Padic
namespace padicNormE
section NormedSpace
variable {p : ℕ} [hp : Fact p.Prime]
-- Porting note: Linter thinks this is a duplicate simp lemma, so `priority` is assigned
@[simp (high)]
protected theorem mul (q r : ℚ_[p]) : ‖q * r‖ = ‖q‖ * ‖r‖ := by simp [Norm.norm, map_mul]
#align padic_norm_e.mul padicNormE.mul
protected theorem is_norm (q : ℚ_[p]) : ↑(padicNormE q) = ‖q‖ := rfl
#align padic_norm_e.is_norm padicNormE.is_norm
theorem nonarchimedean (q r : ℚ_[p]) : ‖q + r‖ ≤ max ‖q‖ ‖r‖ := by
dsimp [norm]
exact mod_cast nonarchimedean' _ _
#align padic_norm_e.nonarchimedean padicNormE.nonarchimedean
theorem add_eq_max_of_ne {q r : ℚ_[p]} (h : ‖q‖ ≠ ‖r‖) : ‖q + r‖ = max ‖q‖ ‖r‖ := by
dsimp [norm] at h ⊢
have : padicNormE q ≠ padicNormE r := mod_cast h
exact mod_cast add_eq_max_of_ne' this
#align padic_norm_e.add_eq_max_of_ne padicNormE.add_eq_max_of_ne
@[simp]
theorem eq_padicNorm (q : ℚ) : ‖(q : ℚ_[p])‖ = padicNorm p q := by
dsimp [norm]
rw [← padicNormE.eq_padic_norm']
#align padic_norm_e.eq_padic_norm padicNormE.eq_padicNorm
@[simp]
theorem norm_p : ‖(p : ℚ_[p])‖ = (p : ℝ)⁻¹ := by
rw [← @Rat.cast_natCast ℝ _ p]
rw [← @Rat.cast_natCast ℚ_[p] _ p]
simp [hp.1.ne_zero, hp.1.ne_one, norm, padicNorm, padicValRat, padicValInt, zpow_neg,
-Rat.cast_natCast]
#align padic_norm_e.norm_p padicNormE.norm_p
theorem norm_p_lt_one : ‖(p : ℚ_[p])‖ < 1 := by
rw [norm_p]
apply inv_lt_one
exact mod_cast hp.1.one_lt
#align padic_norm_e.norm_p_lt_one padicNormE.norm_p_lt_one
-- Porting note: Linter thinks this is a duplicate simp lemma, so `priority` is assigned
@[simp (high)]
theorem norm_p_zpow (n : ℤ) : ‖(p : ℚ_[p]) ^ n‖ = (p : ℝ) ^ (-n) := by
rw [norm_zpow, norm_p, zpow_neg, inv_zpow]
#align padic_norm_e.norm_p_zpow padicNormE.norm_p_zpow
-- Porting note: Linter thinks this is a duplicate simp lemma, so `priority` is assigned
@[simp (high)]
theorem norm_p_pow (n : ℕ) : ‖(p : ℚ_[p]) ^ n‖ = (p : ℝ) ^ (-n : ℤ) := by
rw [← norm_p_zpow, zpow_natCast]
#align padic_norm_e.norm_p_pow padicNormE.norm_p_pow
instance : NontriviallyNormedField ℚ_[p] :=
{ Padic.normedField p with
non_trivial :=
⟨p⁻¹, by
rw [norm_inv, norm_p, inv_inv]
exact mod_cast hp.1.one_lt⟩ }
protected theorem image {q : ℚ_[p]} : q ≠ 0 → ∃ n : ℤ, ‖q‖ = ↑((p : ℚ) ^ (-n)) :=
Quotient.inductionOn q fun f hf ↦
have : ¬f ≈ 0 := (PadicSeq.ne_zero_iff_nequiv_zero f).1 hf
let ⟨n, hn⟩ := PadicSeq.norm_values_discrete f this
⟨n, by rw [← hn]; rfl⟩
#align padic_norm_e.image padicNormE.image
protected theorem is_rat (q : ℚ_[p]) : ∃ q' : ℚ, ‖q‖ = q' :=
if h : q = 0 then ⟨0, by simp [h]⟩
else
let ⟨n, hn⟩ := padicNormE.image h
⟨_, hn⟩
#align padic_norm_e.is_rat padicNormE.is_rat
def ratNorm (q : ℚ_[p]) : ℚ :=
Classical.choose (padicNormE.is_rat q)
#align padic_norm_e.rat_norm padicNormE.ratNorm
theorem eq_ratNorm (q : ℚ_[p]) : ‖q‖ = ratNorm q :=
Classical.choose_spec (padicNormE.is_rat q)
#align padic_norm_e.eq_rat_norm padicNormE.eq_ratNorm
theorem norm_rat_le_one : ∀ {q : ℚ} (_ : ¬p ∣ q.den), ‖(q : ℚ_[p])‖ ≤ 1
| ⟨n, d, hn, hd⟩ => fun hq : ¬p ∣ d ↦
if hnz : n = 0 then by
have : (⟨n, d, hn, hd⟩ : ℚ) = 0 := Rat.zero_iff_num_zero.mpr hnz
set_option tactic.skipAssignedInstances false in norm_num [this]
else by
have hnz' : (⟨n, d, hn, hd⟩ : ℚ) ≠ 0 := mt Rat.zero_iff_num_zero.1 hnz
rw [padicNormE.eq_padicNorm]
norm_cast
-- Porting note: `Nat.cast_zero` instead of another `norm_cast` call
rw [padicNorm.eq_zpow_of_nonzero hnz', padicValRat, neg_sub,
padicValNat.eq_zero_of_not_dvd hq, Nat.cast_zero, zero_sub, zpow_neg, zpow_natCast]
apply inv_le_one
norm_cast
apply one_le_pow
exact hp.1.pos
#align padic_norm_e.norm_rat_le_one padicNormE.norm_rat_le_one
theorem norm_int_le_one (z : ℤ) : ‖(z : ℚ_[p])‖ ≤ 1 :=
suffices ‖((z : ℚ) : ℚ_[p])‖ ≤ 1 by simpa
norm_rat_le_one <| by simp [hp.1.ne_one]
#align padic_norm_e.norm_int_le_one padicNormE.norm_int_le_one
| Mathlib/NumberTheory/Padics/PadicNumbers.lean | 918 | 937 | theorem norm_int_lt_one_iff_dvd (k : ℤ) : ‖(k : ℚ_[p])‖ < 1 ↔ ↑p ∣ k := by |
constructor
· intro h
contrapose! h
apply le_of_eq
rw [eq_comm]
calc
‖(k : ℚ_[p])‖ = ‖((k : ℚ) : ℚ_[p])‖ := by norm_cast
_ = padicNorm p k := padicNormE.eq_padicNorm _
_ = 1 := mod_cast (int_eq_one_iff k).mpr h
· rintro ⟨x, rfl⟩
push_cast
rw [padicNormE.mul]
calc
_ ≤ ‖(p : ℚ_[p])‖ * 1 :=
mul_le_mul le_rfl (by simpa using norm_int_le_one _) (norm_nonneg _) (norm_nonneg _)
_ < 1 := by
rw [mul_one, padicNormE.norm_p]
apply inv_lt_one
exact mod_cast hp.1.one_lt
|
import Mathlib.Order.WellFounded
import Mathlib.Tactic.Common
#align_import data.pi.lex from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
assert_not_exists Monoid
variable {ι : Type*} {β : ι → Type*} (r : ι → ι → Prop) (s : ∀ {i}, β i → β i → Prop)
namespace Pi
protected def Lex (x y : ∀ i, β i) : Prop :=
∃ i, (∀ j, r j i → x j = y j) ∧ s (x i) (y i)
#align pi.lex Pi.Lex
notation3 (prettyPrint := false) "Πₗ "(...)", "r:(scoped p => Lex (∀ i, p i)) => r
@[simp]
theorem toLex_apply (x : ∀ i, β i) (i : ι) : toLex x i = x i :=
rfl
#align pi.to_lex_apply Pi.toLex_apply
@[simp]
theorem ofLex_apply (x : Lex (∀ i, β i)) (i : ι) : ofLex x i = x i :=
rfl
#align pi.of_lex_apply Pi.ofLex_apply
theorem lex_lt_of_lt_of_preorder [∀ i, Preorder (β i)] {r} (hwf : WellFounded r) {x y : ∀ i, β i}
(hlt : x < y) : ∃ i, (∀ j, r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i :=
let h' := Pi.lt_def.1 hlt
let ⟨i, hi, hl⟩ := hwf.has_min _ h'.2
⟨i, fun j hj => ⟨h'.1 j, not_not.1 fun h => hl j (lt_of_le_not_le (h'.1 j) h) hj⟩, hi⟩
#align pi.lex_lt_of_lt_of_preorder Pi.lex_lt_of_lt_of_preorder
| Mathlib/Order/PiLex.lean | 65 | 68 | theorem lex_lt_of_lt [∀ i, PartialOrder (β i)] {r} (hwf : WellFounded r) {x y : ∀ i, β i}
(hlt : x < y) : Pi.Lex r (@fun i => (· < ·)) x y := by |
simp_rw [Pi.Lex, le_antisymm_iff]
exact lex_lt_of_lt_of_preorder hwf hlt
|
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SimpleGraph.Clique
import Mathlib.Data.Finset.Sym
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Positivity.Finset
#align_import combinatorics.simple_graph.triangle.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Finset Nat
open Fintype (card)
namespace SimpleGraph
variable {α β 𝕜 : Type*} [LinearOrderedField 𝕜] {G H : SimpleGraph α} {ε δ : 𝕜} {n : ℕ}
{s : Finset α}
variable (G ε)
variable [Fintype α] [DecidableEq α] [DecidableRel G.Adj] [DecidableRel H.Adj]
def FarFromTriangleFree : Prop := G.DeleteFar (fun H ↦ H.CliqueFree 3) <| ε * (card α ^ 2 : ℕ)
#align simple_graph.far_from_triangle_free SimpleGraph.FarFromTriangleFree
variable {G ε}
theorem farFromTriangleFree_iff :
G.FarFromTriangleFree ε ↔ ∀ ⦃H : SimpleGraph α⦄, [DecidableRel H.Adj] → H ≤ G → H.CliqueFree 3 →
ε * (card α ^ 2 : ℕ) ≤ G.edgeFinset.card - H.edgeFinset.card := deleteFar_iff
#align simple_graph.far_from_triangle_free_iff SimpleGraph.farFromTriangleFree_iff
alias ⟨farFromTriangleFree.le_card_sub_card, _⟩ := farFromTriangleFree_iff
#align simple_graph.far_from_triangle_free.le_card_sub_card SimpleGraph.farFromTriangleFree.le_card_sub_card
nonrec theorem FarFromTriangleFree.mono (hε : G.FarFromTriangleFree ε) (h : δ ≤ ε) :
G.FarFromTriangleFree δ := hε.mono <| by gcongr
#align simple_graph.far_from_triangle_free.mono SimpleGraph.FarFromTriangleFree.mono
theorem FarFromTriangleFree.cliqueFinset_nonempty' (hH : H ≤ G) (hG : G.FarFromTriangleFree ε)
(hcard : G.edgeFinset.card - H.edgeFinset.card < ε * (card α ^ 2 : ℕ)) :
(H.cliqueFinset 3).Nonempty :=
nonempty_of_ne_empty <|
cliqueFinset_eq_empty_iff.not.2 fun hH' => (hG.le_card_sub_card hH hH').not_lt hcard
#align simple_graph.far_from_triangle_free.clique_finset_nonempty' SimpleGraph.FarFromTriangleFree.cliqueFinset_nonempty'
private lemma farFromTriangleFree_of_disjoint_triangles_aux {tris : Finset (Finset α)}
(htris : tris ⊆ G.cliqueFinset 3)
(pd : (tris : Set (Finset α)).Pairwise fun x y ↦ (x ∩ y : Set α).Subsingleton) (hHG : H ≤ G)
(hH : H.CliqueFree 3) : tris.card ≤ G.edgeFinset.card - H.edgeFinset.card := by
rw [← card_sdiff (edgeFinset_mono hHG), ← card_attach]
by_contra! hG
have ⦃t⦄ (ht : t ∈ tris) :
∃ x y, x ∈ t ∧ y ∈ t ∧ x ≠ y ∧ s(x, y) ∈ G.edgeFinset \ H.edgeFinset := by
by_contra! h
refine hH t ?_
simp only [not_and, mem_sdiff, not_not, mem_edgeFinset, mem_edgeSet] at h
obtain ⟨x, y, z, xy, xz, yz, rfl⟩ := is3Clique_iff.1 (mem_cliqueFinset_iff.1 $ htris ht)
rw [is3Clique_triple_iff]
refine ⟨h _ _ ?_ ?_ xy.ne xy, h _ _ ?_ ?_ xz.ne xz, h _ _ ?_ ?_ yz.ne yz⟩ <;> simp
choose fx fy hfx hfy hfne fmem using this
let f (t : {x // x ∈ tris}) : Sym2 α := s(fx t.2, fy t.2)
have hf (x) (_ : x ∈ tris.attach) : f x ∈ G.edgeFinset \ H.edgeFinset := fmem _
obtain ⟨⟨t₁, ht₁⟩, -, ⟨t₂, ht₂⟩, -, tne, t : s(_, _) = s(_, _)⟩ :=
exists_ne_map_eq_of_card_lt_of_maps_to hG hf
dsimp at t
have i := pd ht₁ ht₂ (Subtype.val_injective.ne tne)
rw [Sym2.eq_iff] at t
obtain t | t := t
· exact hfne _ (i ⟨hfx ht₁, t.1.symm ▸ hfx ht₂⟩ ⟨hfy ht₁, t.2.symm ▸ hfy ht₂⟩)
· exact hfne _ (i ⟨hfx ht₁, t.1.symm ▸ hfy ht₂⟩ ⟨hfy ht₁, t.2.symm ▸ hfx ht₂⟩)
lemma farFromTriangleFree_of_disjoint_triangles (tris : Finset (Finset α))
(htris : tris ⊆ G.cliqueFinset 3)
(pd : (tris : Set (Finset α)).Pairwise fun x y ↦ (x ∩ y : Set α).Subsingleton)
(tris_big : ε * (card α ^ 2 : ℕ) ≤ tris.card) :
G.FarFromTriangleFree ε := by
rw [farFromTriangleFree_iff]
intros H _ hG hH
rw [← Nat.cast_sub (card_le_card $ edgeFinset_mono hG)]
exact tris_big.trans
(Nat.cast_le.2 $ farFromTriangleFree_of_disjoint_triangles_aux htris pd hG hH)
protected lemma EdgeDisjointTriangles.farFromTriangleFree (hG : G.EdgeDisjointTriangles)
(tris_big : ε * (card α ^ 2 : ℕ) ≤ (G.cliqueFinset 3).card) : G.FarFromTriangleFree ε :=
farFromTriangleFree_of_disjoint_triangles _ Subset.rfl (by simpa using hG) tris_big
variable [Nonempty α]
lemma FarFromTriangleFree.lt_half (hG : G.FarFromTriangleFree ε) : ε < 2⁻¹ := by
by_contra! hε
refine lt_irrefl (ε * card α ^ 2) ?_
have hε₀ : 0 < ε := hε.trans_lt' (by norm_num)
rw [inv_pos_le_iff_one_le_mul (zero_lt_two' 𝕜)] at hε
calc
_ ≤ (G.edgeFinset.card : 𝕜) := by
simpa using hG.le_card_sub_card bot_le (cliqueFree_bot (le_succ _))
_ ≤ ε * 2 * (edgeFinset G).card := le_mul_of_one_le_left (by positivity) (by assumption)
_ < ε * card α ^ 2 := ?_
rw [mul_assoc, mul_lt_mul_left hε₀]
norm_cast
calc
_ ≤ 2 * (⊤ : SimpleGraph α).edgeFinset.card := by gcongr; exact le_top
_ < card α ^ 2 := ?_
rw [edgeFinset_top, filter_not, card_sdiff (subset_univ _), card_univ, Sym2.card,]
simp_rw [choose_two_right, Nat.add_sub_cancel, Nat.mul_comm _ (card α),
Sym2.isDiag_iff_mem_range_diag, univ_filter_mem_range, mul_tsub,
Nat.mul_div_cancel' (card α).even_mul_succ_self.two_dvd]
rw [card_image_of_injective _ Sym2.diag_injective, card_univ, mul_add_one (α := ℕ), two_mul, sq,
add_tsub_add_eq_tsub_right]
apply tsub_lt_self <;> positivity
lemma FarFromTriangleFree.lt_one (hG : G.FarFromTriangleFree ε) : ε < 1 :=
hG.lt_half.trans $ inv_lt_one one_lt_two
| Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean | 279 | 283 | theorem FarFromTriangleFree.nonpos (h₀ : G.FarFromTriangleFree ε) (h₁ : G.CliqueFree 3) :
ε ≤ 0 := by |
have := h₀ (empty_subset _)
rw [coe_empty, Finset.card_empty, cast_zero, deleteEdges_empty] at this
exact nonpos_of_mul_nonpos_left (this h₁) (cast_pos.2 <| sq_pos_of_pos Fintype.card_pos)
|
import Mathlib.NumberTheory.BernoulliPolynomials
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.Fourier.AddCircle
import Mathlib.Analysis.PSeries
#align_import number_theory.zeta_values from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open scoped Nat Real Interval
open Complex MeasureTheory Set intervalIntegral
local notation "𝕌" => UnitAddCircle
section BernoulliFunProps
def bernoulliFun (k : ℕ) (x : ℝ) : ℝ :=
(Polynomial.map (algebraMap ℚ ℝ) (Polynomial.bernoulli k)).eval x
#align bernoulli_fun bernoulliFun
theorem bernoulliFun_eval_zero (k : ℕ) : bernoulliFun k 0 = bernoulli k := by
rw [bernoulliFun, Polynomial.eval_zero_map, Polynomial.bernoulli_eval_zero, eq_ratCast]
#align bernoulli_fun_eval_zero bernoulliFun_eval_zero
theorem bernoulliFun_endpoints_eq_of_ne_one {k : ℕ} (hk : k ≠ 1) :
bernoulliFun k 1 = bernoulliFun k 0 := by
rw [bernoulliFun_eval_zero, bernoulliFun, Polynomial.eval_one_map, Polynomial.bernoulli_eval_one,
bernoulli_eq_bernoulli'_of_ne_one hk, eq_ratCast]
#align bernoulli_fun_endpoints_eq_of_ne_one bernoulliFun_endpoints_eq_of_ne_one
| Mathlib/NumberTheory/ZetaValues.lean | 59 | 64 | theorem bernoulliFun_eval_one (k : ℕ) : bernoulliFun k 1 = bernoulliFun k 0 + ite (k = 1) 1 0 := by |
rw [bernoulliFun, bernoulliFun_eval_zero, Polynomial.eval_one_map, Polynomial.bernoulli_eval_one]
split_ifs with h
· rw [h, bernoulli_one, bernoulli'_one, eq_ratCast]
push_cast; ring
· rw [bernoulli_eq_bernoulli'_of_ne_one h, add_zero, eq_ratCast]
|
import Mathlib.Order.Atoms
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.RelIso.Set
import Mathlib.Order.SupClosed
import Mathlib.Order.SupIndep
import Mathlib.Order.Zorn
import Mathlib.Data.Finset.Order
import Mathlib.Order.Interval.Set.OrderIso
import Mathlib.Data.Finite.Set
import Mathlib.Tactic.TFAE
#align_import order.compactly_generated from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f"
open Set
variable {ι : Sort*} {α : Type*} [CompleteLattice α] {f : ι → α}
class IsCompactlyGenerated (α : Type*) [CompleteLattice α] : Prop where
exists_sSup_eq : ∀ x : α, ∃ s : Set α, (∀ x ∈ s, CompleteLattice.IsCompactElement x) ∧ sSup s = x
#align is_compactly_generated IsCompactlyGenerated
section
variable [CompleteLattice α] [IsCompactlyGenerated α] {a b : α} {s : Set α}
@[simp]
theorem sSup_compact_le_eq (b) :
sSup { c : α | CompleteLattice.IsCompactElement c ∧ c ≤ b } = b := by
rcases IsCompactlyGenerated.exists_sSup_eq b with ⟨s, hs, rfl⟩
exact le_antisymm (sSup_le fun c hc => hc.2) (sSup_le_sSup fun c cs => ⟨hs c cs, le_sSup cs⟩)
#align Sup_compact_le_eq sSup_compact_le_eq
@[simp]
theorem sSup_compact_eq_top : sSup { a : α | CompleteLattice.IsCompactElement a } = ⊤ := by
refine Eq.trans (congr rfl (Set.ext fun x => ?_)) (sSup_compact_le_eq ⊤)
exact (and_iff_left le_top).symm
#align Sup_compact_eq_top sSup_compact_eq_top
theorem le_iff_compact_le_imp {a b : α} :
a ≤ b ↔ ∀ c : α, CompleteLattice.IsCompactElement c → c ≤ a → c ≤ b :=
⟨fun ab c _ ca => le_trans ca ab, fun h => by
rw [← sSup_compact_le_eq a, ← sSup_compact_le_eq b]
exact sSup_le_sSup fun c hc => ⟨hc.1, h c hc.1 hc.2⟩⟩
#align le_iff_compact_le_imp le_iff_compact_le_imp
theorem DirectedOn.inf_sSup_eq (h : DirectedOn (· ≤ ·) s) : a ⊓ sSup s = ⨆ b ∈ s, a ⊓ b :=
le_antisymm
(by
rw [le_iff_compact_le_imp]
by_cases hs : s.Nonempty
· intro c hc hcinf
rw [le_inf_iff] at hcinf
rw [CompleteLattice.isCompactElement_iff_le_of_directed_sSup_le] at hc
rcases hc s hs h hcinf.2 with ⟨d, ds, cd⟩
refine (le_inf hcinf.1 cd).trans (le_trans ?_ (le_iSup₂ d ds))
rfl
· rw [Set.not_nonempty_iff_eq_empty] at hs
simp [hs])
iSup_inf_le_inf_sSup
#align directed_on.inf_Sup_eq DirectedOn.inf_sSup_eq
protected theorem DirectedOn.sSup_inf_eq (h : DirectedOn (· ≤ ·) s) :
sSup s ⊓ a = ⨆ b ∈ s, b ⊓ a := by
simp_rw [inf_comm _ a, h.inf_sSup_eq]
#align directed_on.Sup_inf_eq DirectedOn.sSup_inf_eq
protected theorem Directed.inf_iSup_eq (h : Directed (· ≤ ·) f) :
(a ⊓ ⨆ i, f i) = ⨆ i, a ⊓ f i := by
rw [iSup, h.directedOn_range.inf_sSup_eq, iSup_range]
#align directed.inf_supr_eq Directed.inf_iSup_eq
protected theorem Directed.iSup_inf_eq (h : Directed (· ≤ ·) f) :
(⨆ i, f i) ⊓ a = ⨆ i, f i ⊓ a := by
rw [iSup, h.directedOn_range.sSup_inf_eq, iSup_range]
#align directed.supr_inf_eq Directed.iSup_inf_eq
protected theorem DirectedOn.disjoint_sSup_right (h : DirectedOn (· ≤ ·) s) :
Disjoint a (sSup s) ↔ ∀ ⦃b⦄, b ∈ s → Disjoint a b := by
simp_rw [disjoint_iff, h.inf_sSup_eq, iSup_eq_bot]
#align directed_on.disjoint_Sup_right DirectedOn.disjoint_sSup_right
protected theorem DirectedOn.disjoint_sSup_left (h : DirectedOn (· ≤ ·) s) :
Disjoint (sSup s) a ↔ ∀ ⦃b⦄, b ∈ s → Disjoint b a := by
simp_rw [disjoint_iff, h.sSup_inf_eq, iSup_eq_bot]
#align directed_on.disjoint_Sup_left DirectedOn.disjoint_sSup_left
protected theorem Directed.disjoint_iSup_right (h : Directed (· ≤ ·) f) :
Disjoint a (⨆ i, f i) ↔ ∀ i, Disjoint a (f i) := by
simp_rw [disjoint_iff, h.inf_iSup_eq, iSup_eq_bot]
#align directed.disjoint_supr_right Directed.disjoint_iSup_right
protected theorem Directed.disjoint_iSup_left (h : Directed (· ≤ ·) f) :
Disjoint (⨆ i, f i) a ↔ ∀ i, Disjoint (f i) a := by
simp_rw [disjoint_iff, h.iSup_inf_eq, iSup_eq_bot]
#align directed.disjoint_supr_left Directed.disjoint_iSup_left
theorem inf_sSup_eq_iSup_inf_sup_finset :
a ⊓ sSup s = ⨆ (t : Finset α) (_ : ↑t ⊆ s), a ⊓ t.sup id :=
le_antisymm
(by
rw [le_iff_compact_le_imp]
intro c hc hcinf
rw [le_inf_iff] at hcinf
rcases hc s hcinf.2 with ⟨t, ht1, ht2⟩
refine (le_inf hcinf.1 ht2).trans (le_trans ?_ (le_iSup₂ t ht1))
rfl)
(iSup_le fun t =>
iSup_le fun h => inf_le_inf_left _ ((Finset.sup_id_eq_sSup t).symm ▸ sSup_le_sSup h))
#align inf_Sup_eq_supr_inf_sup_finset inf_sSup_eq_iSup_inf_sup_finset
theorem CompleteLattice.setIndependent_iff_finite {s : Set α} :
CompleteLattice.SetIndependent s ↔
∀ t : Finset α, ↑t ⊆ s → CompleteLattice.SetIndependent (↑t : Set α) :=
⟨fun hs t ht => hs.mono ht, fun h a ha => by
rw [disjoint_iff, inf_sSup_eq_iSup_inf_sup_finset, iSup_eq_bot]
intro t
rw [iSup_eq_bot, Finset.sup_id_eq_sSup]
intro ht
classical
have h' := (h (insert a t) ?_ (t.mem_insert_self a)).eq_bot
· rwa [Finset.coe_insert, Set.insert_diff_self_of_not_mem] at h'
exact fun con => ((Set.mem_diff a).1 (ht con)).2 (Set.mem_singleton a)
· rw [Finset.coe_insert, Set.insert_subset_iff]
exact ⟨ha, Set.Subset.trans ht diff_subset⟩⟩
#align complete_lattice.set_independent_iff_finite CompleteLattice.setIndependent_iff_finite
lemma CompleteLattice.independent_iff_supIndep_of_injOn {ι : Type*} {f : ι → α}
(hf : InjOn f {i | f i ≠ ⊥}) :
CompleteLattice.Independent f ↔ ∀ (s : Finset ι), s.SupIndep f := by
refine ⟨fun h ↦ h.supIndep', fun h ↦ CompleteLattice.independent_def'.mpr fun i ↦ ?_⟩
simp_rw [disjoint_iff, inf_sSup_eq_iSup_inf_sup_finset, iSup_eq_bot, ← disjoint_iff]
intro s hs
classical
rw [← Finset.sup_erase_bot]
set t := s.erase ⊥
replace hf : InjOn f (f ⁻¹' t) := fun i hi j _ hij ↦ by
refine hf ?_ ?_ hij <;> aesop (add norm simp [t])
have : (Finset.erase (insert i (t.preimage _ hf)) i).image f = t := by
ext a
simp only [Finset.mem_preimage, Finset.mem_erase, ne_eq, Finset.mem_insert, true_or, not_true,
Finset.erase_insert_eq_erase, not_and, Finset.mem_image, t]
refine ⟨by aesop, fun ⟨ha, has⟩ ↦ ?_⟩
obtain ⟨j, hj, rfl⟩ := hs has
exact ⟨j, ⟨hj, ha, has⟩, rfl⟩
rw [← this, Finset.sup_image]
specialize h (insert i (t.preimage _ hf))
rw [Finset.supIndep_iff_disjoint_erase] at h
exact h i (Finset.mem_insert_self i _)
theorem CompleteLattice.setIndependent_iUnion_of_directed {η : Type*} {s : η → Set α}
(hs : Directed (· ⊆ ·) s) (h : ∀ i, CompleteLattice.SetIndependent (s i)) :
CompleteLattice.SetIndependent (⋃ i, s i) := by
by_cases hη : Nonempty η
· rw [CompleteLattice.setIndependent_iff_finite]
intro t ht
obtain ⟨I, fi, hI⟩ := Set.finite_subset_iUnion t.finite_toSet ht
obtain ⟨i, hi⟩ := hs.finset_le fi.toFinset
exact (h i).mono
(Set.Subset.trans hI <| Set.iUnion₂_subset fun j hj => hi j (fi.mem_toFinset.2 hj))
· rintro a ⟨_, ⟨i, _⟩, _⟩
exfalso
exact hη ⟨i⟩
#align complete_lattice.set_independent_Union_of_directed CompleteLattice.setIndependent_iUnion_of_directed
theorem CompleteLattice.independent_sUnion_of_directed {s : Set (Set α)} (hs : DirectedOn (· ⊆ ·) s)
(h : ∀ a ∈ s, CompleteLattice.SetIndependent a) : CompleteLattice.SetIndependent (⋃₀ s) := by
rw [Set.sUnion_eq_iUnion]
exact CompleteLattice.setIndependent_iUnion_of_directed hs.directed_val (by simpa using h)
#align complete_lattice.independent_sUnion_of_directed CompleteLattice.independent_sUnion_of_directed
end
namespace CompleteLattice
| Mathlib/Order/CompactlyGenerated/Basic.lean | 498 | 502 | theorem isCompactlyGenerated_of_wellFounded (h : WellFounded ((· > ·) : α → α → Prop)) :
IsCompactlyGenerated α := by |
rw [wellFounded_iff_isSupFiniteCompact, isSupFiniteCompact_iff_all_elements_compact] at h
-- x is the join of the set of compact elements {x}
exact ⟨fun x => ⟨{x}, ⟨fun x _ => h x, sSup_singleton⟩⟩⟩
|
import Mathlib.MeasureTheory.Measure.MeasureSpace
open scoped ENNReal NNReal Topology
open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function
variable {R α β δ γ ι : Type*}
namespace MeasureTheory
variable {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ]
variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α}
namespace Measure
noncomputable def restrictₗ {m0 : MeasurableSpace α} (s : Set α) : Measure α →ₗ[ℝ≥0∞] Measure α :=
liftLinear (OuterMeasure.restrict s) fun μ s' hs' t => by
suffices μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \ s') by
simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc]
exact le_toOuterMeasure_caratheodory _ _ hs' _
#align measure_theory.measure.restrictₗ MeasureTheory.Measure.restrictₗ
noncomputable def restrict {_m0 : MeasurableSpace α} (μ : Measure α) (s : Set α) : Measure α :=
restrictₗ s μ
#align measure_theory.measure.restrict MeasureTheory.Measure.restrict
@[simp]
theorem restrictₗ_apply {_m0 : MeasurableSpace α} (s : Set α) (μ : Measure α) :
restrictₗ s μ = μ.restrict s :=
rfl
#align measure_theory.measure.restrictₗ_apply MeasureTheory.Measure.restrictₗ_apply
theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) :
(μ.restrict s).toOuterMeasure = OuterMeasure.restrict s μ.toOuterMeasure := by
simp_rw [restrict, restrictₗ, liftLinear, LinearMap.coe_mk, AddHom.coe_mk,
toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, μ.trimmed]
#align measure_theory.measure.restrict_to_outer_measure_eq_to_outer_measure_restrict MeasureTheory.Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict
theorem restrict_apply₀ (ht : NullMeasurableSet t (μ.restrict s)) : μ.restrict s t = μ (t ∩ s) := by
rw [← restrictₗ_apply, restrictₗ, liftLinear_apply₀ _ ht, OuterMeasure.restrict_apply,
coe_toOuterMeasure]
#align measure_theory.measure.restrict_apply₀ MeasureTheory.Measure.restrict_apply₀
@[simp]
theorem restrict_apply (ht : MeasurableSet t) : μ.restrict s t = μ (t ∩ s) :=
restrict_apply₀ ht.nullMeasurableSet
#align measure_theory.measure.restrict_apply MeasureTheory.Measure.restrict_apply
theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s')
(hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' :=
Measure.le_iff.2 fun t ht => calc
μ.restrict s t = μ (t ∩ s) := restrict_apply ht
_ ≤ μ (t ∩ s') := (measure_mono_ae <| hs.mono fun _x hx ⟨hxt, hxs⟩ => ⟨hxt, hx hxs⟩)
_ ≤ ν (t ∩ s') := le_iff'.1 hμν (t ∩ s')
_ = ν.restrict s' t := (restrict_apply ht).symm
#align measure_theory.measure.restrict_mono' MeasureTheory.Measure.restrict_mono'
@[mono]
theorem restrict_mono {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ (hs : s ⊆ s') ⦃μ ν : Measure α⦄
(hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' :=
restrict_mono' (ae_of_all _ hs) hμν
#align measure_theory.measure.restrict_mono MeasureTheory.Measure.restrict_mono
theorem restrict_mono_ae (h : s ≤ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t :=
restrict_mono' h (le_refl μ)
#align measure_theory.measure.restrict_mono_ae MeasureTheory.Measure.restrict_mono_ae
theorem restrict_congr_set (h : s =ᵐ[μ] t) : μ.restrict s = μ.restrict t :=
le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le)
#align measure_theory.measure.restrict_congr_set MeasureTheory.Measure.restrict_congr_set
@[simp]
theorem restrict_apply' (hs : MeasurableSet s) : μ.restrict s t = μ (t ∩ s) := by
rw [← toOuterMeasure_apply,
Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict hs,
OuterMeasure.restrict_apply s t _, toOuterMeasure_apply]
#align measure_theory.measure.restrict_apply' MeasureTheory.Measure.restrict_apply'
theorem restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by
rw [← restrict_congr_set hs.toMeasurable_ae_eq,
restrict_apply' (measurableSet_toMeasurable _ _),
measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)]
#align measure_theory.measure.restrict_apply₀' MeasureTheory.Measure.restrict_apply₀'
theorem restrict_le_self : μ.restrict s ≤ μ :=
Measure.le_iff.2 fun t ht => calc
μ.restrict s t = μ (t ∩ s) := restrict_apply ht
_ ≤ μ t := measure_mono inter_subset_left
#align measure_theory.measure.restrict_le_self MeasureTheory.Measure.restrict_le_self
variable (μ)
theorem restrict_eq_self (h : s ⊆ t) : μ.restrict t s = μ s :=
(le_iff'.1 restrict_le_self s).antisymm <|
calc
μ s ≤ μ (toMeasurable (μ.restrict t) s ∩ t) :=
measure_mono (subset_inter (subset_toMeasurable _ _) h)
_ = μ.restrict t s := by
rw [← restrict_apply (measurableSet_toMeasurable _ _), measure_toMeasurable]
#align measure_theory.measure.restrict_eq_self MeasureTheory.Measure.restrict_eq_self
@[simp]
theorem restrict_apply_self (s : Set α) : (μ.restrict s) s = μ s :=
restrict_eq_self μ Subset.rfl
#align measure_theory.measure.restrict_apply_self MeasureTheory.Measure.restrict_apply_self
variable {μ}
theorem restrict_apply_univ (s : Set α) : μ.restrict s univ = μ s := by
rw [restrict_apply MeasurableSet.univ, Set.univ_inter]
#align measure_theory.measure.restrict_apply_univ MeasureTheory.Measure.restrict_apply_univ
theorem le_restrict_apply (s t : Set α) : μ (t ∩ s) ≤ μ.restrict s t :=
calc
μ (t ∩ s) = μ.restrict s (t ∩ s) := (restrict_eq_self μ inter_subset_right).symm
_ ≤ μ.restrict s t := measure_mono inter_subset_left
#align measure_theory.measure.le_restrict_apply MeasureTheory.Measure.le_restrict_apply
theorem restrict_apply_le (s t : Set α) : μ.restrict s t ≤ μ t :=
Measure.le_iff'.1 restrict_le_self _
theorem restrict_apply_superset (h : s ⊆ t) : μ.restrict s t = μ s :=
((measure_mono (subset_univ _)).trans_eq <| restrict_apply_univ _).antisymm
((restrict_apply_self μ s).symm.trans_le <| measure_mono h)
#align measure_theory.measure.restrict_apply_superset MeasureTheory.Measure.restrict_apply_superset
@[simp]
theorem restrict_add {_m0 : MeasurableSpace α} (μ ν : Measure α) (s : Set α) :
(μ + ν).restrict s = μ.restrict s + ν.restrict s :=
(restrictₗ s).map_add μ ν
#align measure_theory.measure.restrict_add MeasureTheory.Measure.restrict_add
@[simp]
theorem restrict_zero {_m0 : MeasurableSpace α} (s : Set α) : (0 : Measure α).restrict s = 0 :=
(restrictₗ s).map_zero
#align measure_theory.measure.restrict_zero MeasureTheory.Measure.restrict_zero
@[simp]
theorem restrict_smul {_m0 : MeasurableSpace α} (c : ℝ≥0∞) (μ : Measure α) (s : Set α) :
(c • μ).restrict s = c • μ.restrict s :=
(restrictₗ s).map_smul c μ
#align measure_theory.measure.restrict_smul MeasureTheory.Measure.restrict_smul
theorem restrict_restrict₀ (hs : NullMeasurableSet s (μ.restrict t)) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
ext fun u hu => by
simp only [Set.inter_assoc, restrict_apply hu,
restrict_apply₀ (hu.nullMeasurableSet.inter hs)]
#align measure_theory.measure.restrict_restrict₀ MeasureTheory.Measure.restrict_restrict₀
@[simp]
theorem restrict_restrict (hs : MeasurableSet s) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
restrict_restrict₀ hs.nullMeasurableSet
#align measure_theory.measure.restrict_restrict MeasureTheory.Measure.restrict_restrict
theorem restrict_restrict_of_subset (h : s ⊆ t) : (μ.restrict t).restrict s = μ.restrict s := by
ext1 u hu
rw [restrict_apply hu, restrict_apply hu, restrict_eq_self]
exact inter_subset_right.trans h
#align measure_theory.measure.restrict_restrict_of_subset MeasureTheory.Measure.restrict_restrict_of_subset
theorem restrict_restrict₀' (ht : NullMeasurableSet t μ) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
ext fun u hu => by simp only [restrict_apply hu, restrict_apply₀' ht, inter_assoc]
#align measure_theory.measure.restrict_restrict₀' MeasureTheory.Measure.restrict_restrict₀'
theorem restrict_restrict' (ht : MeasurableSet t) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
restrict_restrict₀' ht.nullMeasurableSet
#align measure_theory.measure.restrict_restrict' MeasureTheory.Measure.restrict_restrict'
theorem restrict_comm (hs : MeasurableSet s) :
(μ.restrict t).restrict s = (μ.restrict s).restrict t := by
rw [restrict_restrict hs, restrict_restrict' hs, inter_comm]
#align measure_theory.measure.restrict_comm MeasureTheory.Measure.restrict_comm
theorem restrict_apply_eq_zero (ht : MeasurableSet t) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by
rw [restrict_apply ht]
#align measure_theory.measure.restrict_apply_eq_zero MeasureTheory.Measure.restrict_apply_eq_zero
theorem measure_inter_eq_zero_of_restrict (h : μ.restrict s t = 0) : μ (t ∩ s) = 0 :=
nonpos_iff_eq_zero.1 (h ▸ le_restrict_apply _ _)
#align measure_theory.measure.measure_inter_eq_zero_of_restrict MeasureTheory.Measure.measure_inter_eq_zero_of_restrict
theorem restrict_apply_eq_zero' (hs : MeasurableSet s) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by
rw [restrict_apply' hs]
#align measure_theory.measure.restrict_apply_eq_zero' MeasureTheory.Measure.restrict_apply_eq_zero'
@[simp]
theorem restrict_eq_zero : μ.restrict s = 0 ↔ μ s = 0 := by
rw [← measure_univ_eq_zero, restrict_apply_univ]
#align measure_theory.measure.restrict_eq_zero MeasureTheory.Measure.restrict_eq_zero
instance restrict.neZero [NeZero (μ s)] : NeZero (μ.restrict s) :=
⟨mt restrict_eq_zero.mp <| NeZero.ne _⟩
theorem restrict_zero_set {s : Set α} (h : μ s = 0) : μ.restrict s = 0 :=
restrict_eq_zero.2 h
#align measure_theory.measure.restrict_zero_set MeasureTheory.Measure.restrict_zero_set
@[simp]
theorem restrict_empty : μ.restrict ∅ = 0 :=
restrict_zero_set measure_empty
#align measure_theory.measure.restrict_empty MeasureTheory.Measure.restrict_empty
@[simp]
theorem restrict_univ : μ.restrict univ = μ :=
ext fun s hs => by simp [hs]
#align measure_theory.measure.restrict_univ MeasureTheory.Measure.restrict_univ
theorem restrict_inter_add_diff₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s := by
ext1 u hu
simp only [add_apply, restrict_apply hu, ← inter_assoc, diff_eq]
exact measure_inter_add_diff₀ (u ∩ s) ht
#align measure_theory.measure.restrict_inter_add_diff₀ MeasureTheory.Measure.restrict_inter_add_diff₀
theorem restrict_inter_add_diff (s : Set α) (ht : MeasurableSet t) :
μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s :=
restrict_inter_add_diff₀ s ht.nullMeasurableSet
#align measure_theory.measure.restrict_inter_add_diff MeasureTheory.Measure.restrict_inter_add_diff
theorem restrict_union_add_inter₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by
rw [← restrict_inter_add_diff₀ (s ∪ t) ht, union_inter_cancel_right, union_diff_right, ←
restrict_inter_add_diff₀ s ht, add_comm, ← add_assoc, add_right_comm]
#align measure_theory.measure.restrict_union_add_inter₀ MeasureTheory.Measure.restrict_union_add_inter₀
theorem restrict_union_add_inter (s : Set α) (ht : MeasurableSet t) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t :=
restrict_union_add_inter₀ s ht.nullMeasurableSet
#align measure_theory.measure.restrict_union_add_inter MeasureTheory.Measure.restrict_union_add_inter
theorem restrict_union_add_inter' (hs : MeasurableSet s) (t : Set α) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by
simpa only [union_comm, inter_comm, add_comm] using restrict_union_add_inter t hs
#align measure_theory.measure.restrict_union_add_inter' MeasureTheory.Measure.restrict_union_add_inter'
theorem restrict_union₀ (h : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by
simp [← restrict_union_add_inter₀ s ht, restrict_zero_set h]
#align measure_theory.measure.restrict_union₀ MeasureTheory.Measure.restrict_union₀
theorem restrict_union (h : Disjoint s t) (ht : MeasurableSet t) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t :=
restrict_union₀ h.aedisjoint ht.nullMeasurableSet
#align measure_theory.measure.restrict_union MeasureTheory.Measure.restrict_union
theorem restrict_union' (h : Disjoint s t) (hs : MeasurableSet s) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by
rw [union_comm, restrict_union h.symm hs, add_comm]
#align measure_theory.measure.restrict_union' MeasureTheory.Measure.restrict_union'
@[simp]
| Mathlib/MeasureTheory/Measure/Restrict.lean | 287 | 290 | theorem restrict_add_restrict_compl (hs : MeasurableSet s) :
μ.restrict s + μ.restrict sᶜ = μ := by |
rw [← restrict_union (@disjoint_compl_right (Set α) _ _) hs.compl, union_compl_self,
restrict_univ]
|
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped Classical NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*}
section SemiNormed
open Metric ContinuousLinearMap
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eₗ] [SeminormedAddCommGroup F]
[SeminormedAddCommGroup Fₗ] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G]
[NormedSpace 𝕜 Gₗ] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [FunLike 𝓕 E F]
namespace ContinuousLinearMap
section OpNorm
open Set Real
section
variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E →SL[σ₁₂] F) (h : F →SL[σ₂₃] G)
(x : E)
theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by
ext
rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image]
simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk,
exists_prop]
#align continuous_linear_map.nnnorm_def ContinuousLinearMap.nnnorm_def
theorem opNNNorm_le_bound (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖f x‖₊ ≤ M * ‖x‖₊) : ‖f‖₊ ≤ M :=
opNorm_le_bound f (zero_le M) hM
#align continuous_linear_map.op_nnnorm_le_bound ContinuousLinearMap.opNNNorm_le_bound
@[deprecated (since := "2024-02-02")] alias op_nnnorm_le_bound := opNNNorm_le_bound
theorem opNNNorm_le_bound' (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖x‖₊ ≠ 0 → ‖f x‖₊ ≤ M * ‖x‖₊) :
‖f‖₊ ≤ M :=
opNorm_le_bound' f (zero_le M) fun x hx => hM x <| by rwa [← NNReal.coe_ne_zero]
#align continuous_linear_map.op_nnnorm_le_bound' ContinuousLinearMap.opNNNorm_le_bound'
@[deprecated (since := "2024-02-02")] alias op_nnnorm_le_bound' := opNNNorm_le_bound'
theorem opNNNorm_le_of_unit_nnnorm [NormedSpace ℝ E] [NormedSpace ℝ F] {f : E →L[ℝ] F} {C : ℝ≥0}
(hf : ∀ x, ‖x‖₊ = 1 → ‖f x‖₊ ≤ C) : ‖f‖₊ ≤ C :=
opNorm_le_of_unit_norm C.coe_nonneg fun x hx => hf x <| by rwa [← NNReal.coe_eq_one]
#align continuous_linear_map.op_nnnorm_le_of_unit_nnnorm ContinuousLinearMap.opNNNorm_le_of_unit_nnnorm
@[deprecated (since := "2024-02-02")]
alias op_nnnorm_le_of_unit_nnnorm := opNNNorm_le_of_unit_nnnorm
theorem opNNNorm_le_of_lipschitz {f : E →SL[σ₁₂] F} {K : ℝ≥0} (hf : LipschitzWith K f) :
‖f‖₊ ≤ K :=
opNorm_le_of_lipschitz hf
#align continuous_linear_map.op_nnnorm_le_of_lipschitz ContinuousLinearMap.opNNNorm_le_of_lipschitz
@[deprecated (since := "2024-02-02")] alias op_nnnorm_le_of_lipschitz := opNNNorm_le_of_lipschitz
theorem opNNNorm_eq_of_bounds {φ : E →SL[σ₁₂] F} (M : ℝ≥0) (h_above : ∀ x, ‖φ x‖₊ ≤ M * ‖x‖₊)
(h_below : ∀ N, (∀ x, ‖φ x‖₊ ≤ N * ‖x‖₊) → M ≤ N) : ‖φ‖₊ = M :=
Subtype.ext <| opNorm_eq_of_bounds (zero_le M) h_above <| Subtype.forall'.mpr h_below
#align continuous_linear_map.op_nnnorm_eq_of_bounds ContinuousLinearMap.opNNNorm_eq_of_bounds
@[deprecated (since := "2024-02-02")] alias op_nnnorm_eq_of_bounds := opNNNorm_eq_of_bounds
theorem opNNNorm_le_iff {f : E →SL[σ₁₂] F} {C : ℝ≥0} : ‖f‖₊ ≤ C ↔ ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊ :=
opNorm_le_iff C.2
@[deprecated (since := "2024-02-02")] alias op_nnnorm_le_iff := opNNNorm_le_iff
theorem isLeast_opNNNorm : IsLeast {C : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊} ‖f‖₊ := by
simpa only [← opNNNorm_le_iff] using isLeast_Ici
@[deprecated (since := "2024-02-02")] alias isLeast_op_nnnorm := isLeast_opNNNorm
theorem opNNNorm_comp_le [RingHomIsometric σ₁₃] (f : E →SL[σ₁₂] F) : ‖h.comp f‖₊ ≤ ‖h‖₊ * ‖f‖₊ :=
opNorm_comp_le h f
#align continuous_linear_map.op_nnnorm_comp_le ContinuousLinearMap.opNNNorm_comp_le
@[deprecated (since := "2024-02-02")] alias op_nnnorm_comp_le := opNNNorm_comp_le
theorem le_opNNNorm : ‖f x‖₊ ≤ ‖f‖₊ * ‖x‖₊ :=
f.le_opNorm x
#align continuous_linear_map.le_op_nnnorm ContinuousLinearMap.le_opNNNorm
@[deprecated (since := "2024-02-02")] alias le_op_nnnorm := le_opNNNorm
theorem nndist_le_opNNNorm (x y : E) : nndist (f x) (f y) ≤ ‖f‖₊ * nndist x y :=
dist_le_opNorm f x y
#align continuous_linear_map.nndist_le_op_nnnorm ContinuousLinearMap.nndist_le_opNNNorm
@[deprecated (since := "2024-02-02")] alias nndist_le_op_nnnorm := nndist_le_opNNNorm
theorem lipschitz : LipschitzWith ‖f‖₊ f :=
AddMonoidHomClass.lipschitz_of_bound_nnnorm f _ f.le_opNNNorm
#align continuous_linear_map.lipschitz ContinuousLinearMap.lipschitz
theorem lipschitz_apply (x : E) : LipschitzWith ‖x‖₊ fun f : E →SL[σ₁₂] F => f x :=
lipschitzWith_iff_norm_sub_le.2 fun f g => ((f - g).le_opNorm x).trans_eq (mul_comm _ _)
#align continuous_linear_map.lipschitz_apply ContinuousLinearMap.lipschitz_apply
end
section Sup
variable [RingHomIsometric σ₁₂]
theorem exists_mul_lt_apply_of_lt_opNNNorm (f : E →SL[σ₁₂] F) {r : ℝ≥0} (hr : r < ‖f‖₊) :
∃ x, r * ‖x‖₊ < ‖f x‖₊ := by
simpa only [not_forall, not_le, Set.mem_setOf] using
not_mem_of_lt_csInf (nnnorm_def f ▸ hr : r < sInf { c : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ })
(OrderBot.bddBelow _)
#align continuous_linear_map.exists_mul_lt_apply_of_lt_op_nnnorm ContinuousLinearMap.exists_mul_lt_apply_of_lt_opNNNorm
@[deprecated (since := "2024-02-02")]
alias exists_mul_lt_apply_of_lt_op_nnnorm := exists_mul_lt_apply_of_lt_opNNNorm
theorem exists_mul_lt_of_lt_opNorm (f : E →SL[σ₁₂] F) {r : ℝ} (hr₀ : 0 ≤ r) (hr : r < ‖f‖) :
∃ x, r * ‖x‖ < ‖f x‖ := by
lift r to ℝ≥0 using hr₀
exact f.exists_mul_lt_apply_of_lt_opNNNorm hr
#align continuous_linear_map.exists_mul_lt_of_lt_op_norm ContinuousLinearMap.exists_mul_lt_of_lt_opNorm
@[deprecated (since := "2024-02-02")]
alias exists_mul_lt_of_lt_op_norm := exists_mul_lt_of_lt_opNorm
| Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean | 158 | 172 | theorem exists_lt_apply_of_lt_opNNNorm {𝕜 𝕜₂ E F : Type*} [NormedAddCommGroup E]
[SeminormedAddCommGroup F] [DenselyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] {σ₁₂ : 𝕜 →+* 𝕜₂}
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) {r : ℝ≥0}
(hr : r < ‖f‖₊) : ∃ x : E, ‖x‖₊ < 1 ∧ r < ‖f x‖₊ := by |
obtain ⟨y, hy⟩ := f.exists_mul_lt_apply_of_lt_opNNNorm hr
have hy' : ‖y‖₊ ≠ 0 :=
nnnorm_ne_zero_iff.2 fun heq => by
simp [heq, nnnorm_zero, map_zero, not_lt_zero'] at hy
have hfy : ‖f y‖₊ ≠ 0 := (zero_le'.trans_lt hy).ne'
rw [← inv_inv ‖f y‖₊, NNReal.lt_inv_iff_mul_lt (inv_ne_zero hfy), mul_assoc, mul_comm ‖y‖₊, ←
mul_assoc, ← NNReal.lt_inv_iff_mul_lt hy'] at hy
obtain ⟨k, hk₁, hk₂⟩ := NormedField.exists_lt_nnnorm_lt 𝕜 hy
refine ⟨k • y, (nnnorm_smul k y).symm ▸ (NNReal.lt_inv_iff_mul_lt hy').1 hk₂, ?_⟩
have : ‖σ₁₂ k‖₊ = ‖k‖₊ := Subtype.ext RingHomIsometric.is_iso
rwa [map_smulₛₗ f, nnnorm_smul, ← NNReal.div_lt_iff hfy, div_eq_mul_inv, this]
|
import Mathlib.Data.Complex.Basic
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.circle_transform from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open Set MeasureTheory Metric Filter Function
open scoped Interval Real
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] (R : ℝ) (z w : ℂ)
namespace Complex
def circleTransform (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • (circleMap z R θ - w)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform Complex.circleTransform
def circleTransformDeriv (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ - w) ^ 2)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform_deriv Complex.circleTransformDeriv
theorem circleTransformDeriv_periodic (f : ℂ → E) :
Periodic (circleTransformDeriv R z w f) (2 * π) := by
have := periodic_circleMap
simp_rw [Periodic] at *
intro x
simp_rw [circleTransformDeriv, this]
congr 2
simp [this]
#align complex.circle_transform_deriv_periodic Complex.circleTransformDeriv_periodic
| Mathlib/MeasureTheory/Integral/CircleTransform.lean | 58 | 65 | theorem circleTransformDeriv_eq (f : ℂ → E) : circleTransformDeriv R z w f =
fun θ => (circleMap z R θ - w)⁻¹ • circleTransform R z w f θ := by |
ext
simp_rw [circleTransformDeriv, circleTransform, ← mul_smul, ← mul_assoc]
ring_nf
rw [inv_pow]
congr
ring
|
import Mathlib.Algebra.Algebra.Subalgebra.Directed
import Mathlib.FieldTheory.IntermediateField
import Mathlib.FieldTheory.Separable
import Mathlib.FieldTheory.SplittingField.IsSplittingField
import Mathlib.RingTheory.TensorProduct.Basic
#align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87"
set_option autoImplicit true
open FiniteDimensional Polynomial
open scoped Classical Polynomial
namespace IntermediateField
section AdjoinDef
variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E)
theorem adjoin_eq_range_algebraMap_adjoin :
(adjoin F S : Set E) = Set.range (algebraMap (adjoin F S) E) :=
Subtype.range_coe.symm
#align intermediate_field.adjoin_eq_range_algebra_map_adjoin IntermediateField.adjoin_eq_range_algebraMap_adjoin
theorem adjoin.algebraMap_mem (x : F) : algebraMap F E x ∈ adjoin F S :=
IntermediateField.algebraMap_mem (adjoin F S) x
#align intermediate_field.adjoin.algebra_map_mem IntermediateField.adjoin.algebraMap_mem
theorem adjoin.range_algebraMap_subset : Set.range (algebraMap F E) ⊆ adjoin F S := by
intro x hx
cases' hx with f hf
rw [← hf]
exact adjoin.algebraMap_mem F S f
#align intermediate_field.adjoin.range_algebra_map_subset IntermediateField.adjoin.range_algebraMap_subset
instance adjoin.fieldCoe : CoeTC F (adjoin F S) where
coe x := ⟨algebraMap F E x, adjoin.algebraMap_mem F S x⟩
#align intermediate_field.adjoin.field_coe IntermediateField.adjoin.fieldCoe
theorem subset_adjoin : S ⊆ adjoin F S := fun _ hx => Subfield.subset_closure (Or.inr hx)
#align intermediate_field.subset_adjoin IntermediateField.subset_adjoin
instance adjoin.setCoe : CoeTC S (adjoin F S) where coe x := ⟨x, subset_adjoin F S (Subtype.mem x)⟩
#align intermediate_field.adjoin.set_coe IntermediateField.adjoin.setCoe
@[mono]
theorem adjoin.mono (T : Set E) (h : S ⊆ T) : adjoin F S ≤ adjoin F T :=
GaloisConnection.monotone_l gc h
#align intermediate_field.adjoin.mono IntermediateField.adjoin.mono
theorem adjoin_contains_field_as_subfield (F : Subfield E) : (F : Set E) ⊆ adjoin F S := fun x hx =>
adjoin.algebraMap_mem F S ⟨x, hx⟩
#align intermediate_field.adjoin_contains_field_as_subfield IntermediateField.adjoin_contains_field_as_subfield
theorem subset_adjoin_of_subset_left {F : Subfield E} {T : Set E} (HT : T ⊆ F) : T ⊆ adjoin F S :=
fun x hx => (adjoin F S).algebraMap_mem ⟨x, HT hx⟩
#align intermediate_field.subset_adjoin_of_subset_left IntermediateField.subset_adjoin_of_subset_left
theorem subset_adjoin_of_subset_right {T : Set E} (H : T ⊆ S) : T ⊆ adjoin F S := fun _ hx =>
subset_adjoin F S (H hx)
#align intermediate_field.subset_adjoin_of_subset_right IntermediateField.subset_adjoin_of_subset_right
@[simp]
theorem adjoin_empty (F E : Type*) [Field F] [Field E] [Algebra F E] : adjoin F (∅ : Set E) = ⊥ :=
eq_bot_iff.mpr (adjoin_le_iff.mpr (Set.empty_subset _))
#align intermediate_field.adjoin_empty IntermediateField.adjoin_empty
@[simp]
theorem adjoin_univ (F E : Type*) [Field F] [Field E] [Algebra F E] :
adjoin F (Set.univ : Set E) = ⊤ :=
eq_top_iff.mpr <| subset_adjoin _ _
#align intermediate_field.adjoin_univ IntermediateField.adjoin_univ
theorem adjoin_le_subfield {K : Subfield E} (HF : Set.range (algebraMap F E) ⊆ K) (HS : S ⊆ K) :
(adjoin F S).toSubfield ≤ K := by
apply Subfield.closure_le.mpr
rw [Set.union_subset_iff]
exact ⟨HF, HS⟩
#align intermediate_field.adjoin_le_subfield IntermediateField.adjoin_le_subfield
theorem adjoin_subset_adjoin_iff {F' : Type*} [Field F'] [Algebra F' E] {S S' : Set E} :
(adjoin F S : Set E) ⊆ adjoin F' S' ↔
Set.range (algebraMap F E) ⊆ adjoin F' S' ∧ S ⊆ adjoin F' S' :=
⟨fun h => ⟨(adjoin.range_algebraMap_subset _ _).trans h,
(subset_adjoin _ _).trans h⟩, fun ⟨hF, hS⟩ =>
(Subfield.closure_le (t := (adjoin F' S').toSubfield)).mpr (Set.union_subset hF hS)⟩
#align intermediate_field.adjoin_subset_adjoin_iff IntermediateField.adjoin_subset_adjoin_iff
theorem adjoin_adjoin_left (T : Set E) :
(adjoin (adjoin F S) T).restrictScalars _ = adjoin F (S ∪ T) := by
rw [SetLike.ext'_iff]
change (↑(adjoin (adjoin F S) T) : Set E) = _
apply Set.eq_of_subset_of_subset <;> rw [adjoin_subset_adjoin_iff] <;> constructor
· rintro _ ⟨⟨x, hx⟩, rfl⟩; exact adjoin.mono _ _ _ Set.subset_union_left hx
· exact subset_adjoin_of_subset_right _ _ Set.subset_union_right
-- Porting note: orginal proof times out
· rintro x ⟨f, rfl⟩
refine Subfield.subset_closure ?_
left
exact ⟨f, rfl⟩
-- Porting note: orginal proof times out
· refine Set.union_subset (fun x hx => Subfield.subset_closure ?_)
(fun x hx => Subfield.subset_closure ?_)
· left
refine ⟨⟨x, Subfield.subset_closure ?_⟩, rfl⟩
right
exact hx
· right
exact hx
#align intermediate_field.adjoin_adjoin_left IntermediateField.adjoin_adjoin_left
@[simp]
theorem adjoin_insert_adjoin (x : E) :
adjoin F (insert x (adjoin F S : Set E)) = adjoin F (insert x S) :=
le_antisymm
(adjoin_le_iff.mpr
(Set.insert_subset_iff.mpr
⟨subset_adjoin _ _ (Set.mem_insert _ _),
adjoin_le_iff.mpr (subset_adjoin_of_subset_right _ _ (Set.subset_insert _ _))⟩))
(adjoin.mono _ _ _ (Set.insert_subset_insert (subset_adjoin _ _)))
#align intermediate_field.adjoin_insert_adjoin IntermediateField.adjoin_insert_adjoin
theorem adjoin_adjoin_comm (T : Set E) :
(adjoin (adjoin F S) T).restrictScalars F = (adjoin (adjoin F T) S).restrictScalars F := by
rw [adjoin_adjoin_left, adjoin_adjoin_left, Set.union_comm]
#align intermediate_field.adjoin_adjoin_comm IntermediateField.adjoin_adjoin_comm
theorem adjoin_map {E' : Type*} [Field E'] [Algebra F E'] (f : E →ₐ[F] E') :
(adjoin F S).map f = adjoin F (f '' S) := by
ext x
show
x ∈ (Subfield.closure (Set.range (algebraMap F E) ∪ S)).map (f : E →+* E') ↔
x ∈ Subfield.closure (Set.range (algebraMap F E') ∪ f '' S)
rw [RingHom.map_field_closure, Set.image_union, ← Set.range_comp, ← RingHom.coe_comp,
f.comp_algebraMap]
rfl
#align intermediate_field.adjoin_map IntermediateField.adjoin_map
@[simp]
theorem lift_adjoin (K : IntermediateField F E) (S : Set K) :
lift (adjoin F S) = adjoin F (Subtype.val '' S) :=
adjoin_map _ _ _
theorem lift_adjoin_simple (K : IntermediateField F E) (α : K) :
lift (adjoin F {α}) = adjoin F {α.1} := by
simp only [lift_adjoin, Set.image_singleton]
@[simp]
theorem lift_bot (K : IntermediateField F E) :
lift (F := K) ⊥ = ⊥ := map_bot _
@[simp]
theorem lift_top (K : IntermediateField F E) :
lift (F := K) ⊤ = K := by rw [lift, ← AlgHom.fieldRange_eq_map, fieldRange_val]
@[simp]
theorem adjoin_self (K : IntermediateField F E) :
adjoin F K = K := le_antisymm (adjoin_le_iff.2 fun _ ↦ id) (subset_adjoin F _)
| Mathlib/FieldTheory/Adjoin.lean | 484 | 486 | theorem restrictScalars_adjoin (K : IntermediateField F E) (S : Set E) :
restrictScalars F (adjoin K S) = adjoin F (K ∪ S) := by |
rw [← adjoin_self _ K, adjoin_adjoin_left, adjoin_self _ K]
|
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.RingTheory.Localization.FractionRing
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section CommRing
variable [CommRing R] [IsDomain R] {p q : R[X]}
section Roots
open Multiset Finset
noncomputable def roots (p : R[X]) : Multiset R :=
haveI := Classical.decEq R
haveI := Classical.dec (p = 0)
if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h)
#align polynomial.roots Polynomial.roots
theorem roots_def [DecidableEq R] (p : R[X]) [Decidable (p = 0)] :
p.roots = if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h) := by
-- porting noteL `‹_›` doesn't work for instance arguments
rename_i iR ip0
obtain rfl := Subsingleton.elim iR (Classical.decEq R)
obtain rfl := Subsingleton.elim ip0 (Classical.dec (p = 0))
rfl
#align polynomial.roots_def Polynomial.roots_def
@[simp]
theorem roots_zero : (0 : R[X]).roots = 0 :=
dif_pos rfl
#align polynomial.roots_zero Polynomial.roots_zero
theorem card_roots (hp0 : p ≠ 0) : (Multiset.card (roots p) : WithBot ℕ) ≤ degree p := by
classical
unfold roots
rw [dif_neg hp0]
exact (Classical.choose_spec (exists_multiset_roots hp0)).1
#align polynomial.card_roots Polynomial.card_roots
theorem card_roots' (p : R[X]) : Multiset.card p.roots ≤ natDegree p := by
by_cases hp0 : p = 0
· simp [hp0]
exact WithBot.coe_le_coe.1 (le_trans (card_roots hp0) (le_of_eq <| degree_eq_natDegree hp0))
#align polynomial.card_roots' Polynomial.card_roots'
theorem card_roots_sub_C {p : R[X]} {a : R} (hp0 : 0 < degree p) :
(Multiset.card (p - C a).roots : WithBot ℕ) ≤ degree p :=
calc
(Multiset.card (p - C a).roots : WithBot ℕ) ≤ degree (p - C a) :=
card_roots <| mt sub_eq_zero.1 fun h => not_le_of_gt hp0 <| h.symm ▸ degree_C_le
_ = degree p := by rw [sub_eq_add_neg, ← C_neg]; exact degree_add_C hp0
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C Polynomial.card_roots_sub_C
theorem card_roots_sub_C' {p : R[X]} {a : R} (hp0 : 0 < degree p) :
Multiset.card (p - C a).roots ≤ natDegree p :=
WithBot.coe_le_coe.1
(le_trans (card_roots_sub_C hp0)
(le_of_eq <| degree_eq_natDegree fun h => by simp_all [lt_irrefl]))
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C' Polynomial.card_roots_sub_C'
@[simp]
theorem count_roots [DecidableEq R] (p : R[X]) : p.roots.count a = rootMultiplicity a p := by
classical
by_cases hp : p = 0
· simp [hp]
rw [roots_def, dif_neg hp]
exact (Classical.choose_spec (exists_multiset_roots hp)).2 a
#align polynomial.count_roots Polynomial.count_roots
@[simp]
theorem mem_roots' : a ∈ p.roots ↔ p ≠ 0 ∧ IsRoot p a := by
classical
rw [← count_pos, count_roots p, rootMultiplicity_pos']
#align polynomial.mem_roots' Polynomial.mem_roots'
theorem mem_roots (hp : p ≠ 0) : a ∈ p.roots ↔ IsRoot p a :=
mem_roots'.trans <| and_iff_right hp
#align polynomial.mem_roots Polynomial.mem_roots
theorem ne_zero_of_mem_roots (h : a ∈ p.roots) : p ≠ 0 :=
(mem_roots'.1 h).1
#align polynomial.ne_zero_of_mem_roots Polynomial.ne_zero_of_mem_roots
theorem isRoot_of_mem_roots (h : a ∈ p.roots) : IsRoot p a :=
(mem_roots'.1 h).2
#align polynomial.is_root_of_mem_roots Polynomial.isRoot_of_mem_roots
-- Porting note: added during port.
lemma mem_roots_iff_aeval_eq_zero {x : R} (w : p ≠ 0) : x ∈ roots p ↔ aeval x p = 0 := by
rw [mem_roots w, IsRoot.def, aeval_def, eval₂_eq_eval_map]
simp
theorem card_le_degree_of_subset_roots {p : R[X]} {Z : Finset R} (h : Z.val ⊆ p.roots) :
Z.card ≤ p.natDegree :=
(Multiset.card_le_card (Finset.val_le_iff_val_subset.2 h)).trans (Polynomial.card_roots' p)
#align polynomial.card_le_degree_of_subset_roots Polynomial.card_le_degree_of_subset_roots
theorem finite_setOf_isRoot {p : R[X]} (hp : p ≠ 0) : Set.Finite { x | IsRoot p x } := by
classical
simpa only [← Finset.setOf_mem, Multiset.mem_toFinset, mem_roots hp]
using p.roots.toFinset.finite_toSet
#align polynomial.finite_set_of_is_root Polynomial.finite_setOf_isRoot
theorem eq_zero_of_infinite_isRoot (p : R[X]) (h : Set.Infinite { x | IsRoot p x }) : p = 0 :=
not_imp_comm.mp finite_setOf_isRoot h
#align polynomial.eq_zero_of_infinite_is_root Polynomial.eq_zero_of_infinite_isRoot
theorem exists_max_root [LinearOrder R] (p : R[X]) (hp : p ≠ 0) : ∃ x₀, ∀ x, p.IsRoot x → x ≤ x₀ :=
Set.exists_upper_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_max_root Polynomial.exists_max_root
theorem exists_min_root [LinearOrder R] (p : R[X]) (hp : p ≠ 0) : ∃ x₀, ∀ x, p.IsRoot x → x₀ ≤ x :=
Set.exists_lower_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_min_root Polynomial.exists_min_root
theorem eq_of_infinite_eval_eq (p q : R[X]) (h : Set.Infinite { x | eval x p = eval x q }) :
p = q := by
rw [← sub_eq_zero]
apply eq_zero_of_infinite_isRoot
simpa only [IsRoot, eval_sub, sub_eq_zero]
#align polynomial.eq_of_infinite_eval_eq Polynomial.eq_of_infinite_eval_eq
theorem roots_mul {p q : R[X]} (hpq : p * q ≠ 0) : (p * q).roots = p.roots + q.roots := by
classical
exact Multiset.ext.mpr fun r => by
rw [count_add, count_roots, count_roots, count_roots, rootMultiplicity_mul hpq]
#align polynomial.roots_mul Polynomial.roots_mul
theorem roots.le_of_dvd (h : q ≠ 0) : p ∣ q → roots p ≤ roots q := by
rintro ⟨k, rfl⟩
exact Multiset.le_iff_exists_add.mpr ⟨k.roots, roots_mul h⟩
#align polynomial.roots.le_of_dvd Polynomial.roots.le_of_dvd
theorem mem_roots_sub_C' {p : R[X]} {a x : R} : x ∈ (p - C a).roots ↔ p ≠ C a ∧ p.eval x = a := by
rw [mem_roots', IsRoot.def, sub_ne_zero, eval_sub, sub_eq_zero, eval_C]
set_option linter.uppercaseLean3 false in
#align polynomial.mem_roots_sub_C' Polynomial.mem_roots_sub_C'
theorem mem_roots_sub_C {p : R[X]} {a x : R} (hp0 : 0 < degree p) :
x ∈ (p - C a).roots ↔ p.eval x = a :=
mem_roots_sub_C'.trans <| and_iff_right fun hp => hp0.not_le <| hp.symm ▸ degree_C_le
set_option linter.uppercaseLean3 false in
#align polynomial.mem_roots_sub_C Polynomial.mem_roots_sub_C
@[simp]
theorem roots_X_sub_C (r : R) : roots (X - C r) = {r} := by
classical
ext s
rw [count_roots, rootMultiplicity_X_sub_C, count_singleton]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_X_sub_C Polynomial.roots_X_sub_C
@[simp]
theorem roots_X : roots (X : R[X]) = {0} := by rw [← roots_X_sub_C, C_0, sub_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_X Polynomial.roots_X
@[simp]
theorem roots_C (x : R) : (C x).roots = 0 := by
classical exact
if H : x = 0 then by rw [H, C_0, roots_zero]
else
Multiset.ext.mpr fun r => (by
rw [count_roots, count_zero, rootMultiplicity_eq_zero (not_isRoot_C _ _ H)])
set_option linter.uppercaseLean3 false in
#align polynomial.roots_C Polynomial.roots_C
@[simp]
theorem roots_one : (1 : R[X]).roots = ∅ :=
roots_C 1
#align polynomial.roots_one Polynomial.roots_one
@[simp]
theorem roots_C_mul (p : R[X]) (ha : a ≠ 0) : (C a * p).roots = p.roots := by
by_cases hp : p = 0 <;>
simp only [roots_mul, *, Ne, mul_eq_zero, C_eq_zero, or_self_iff, not_false_iff, roots_C,
zero_add, mul_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_C_mul Polynomial.roots_C_mul
@[simp]
theorem roots_smul_nonzero (p : R[X]) (ha : a ≠ 0) : (a • p).roots = p.roots := by
rw [smul_eq_C_mul, roots_C_mul _ ha]
#align polynomial.roots_smul_nonzero Polynomial.roots_smul_nonzero
@[simp]
lemma roots_neg (p : R[X]) : (-p).roots = p.roots := by
rw [← neg_one_smul R p, roots_smul_nonzero p (neg_ne_zero.mpr one_ne_zero)]
theorem roots_list_prod (L : List R[X]) :
(0 : R[X]) ∉ L → L.prod.roots = (L : Multiset R[X]).bind roots :=
List.recOn L (fun _ => roots_one) fun hd tl ih H => by
rw [List.mem_cons, not_or] at H
rw [List.prod_cons, roots_mul (mul_ne_zero (Ne.symm H.1) <| List.prod_ne_zero H.2), ←
Multiset.cons_coe, Multiset.cons_bind, ih H.2]
#align polynomial.roots_list_prod Polynomial.roots_list_prod
theorem roots_multiset_prod (m : Multiset R[X]) : (0 : R[X]) ∉ m → m.prod.roots = m.bind roots := by
rcases m with ⟨L⟩
simpa only [Multiset.prod_coe, quot_mk_to_coe''] using roots_list_prod L
#align polynomial.roots_multiset_prod Polynomial.roots_multiset_prod
theorem roots_prod {ι : Type*} (f : ι → R[X]) (s : Finset ι) :
s.prod f ≠ 0 → (s.prod f).roots = s.val.bind fun i => roots (f i) := by
rcases s with ⟨m, hm⟩
simpa [Multiset.prod_eq_zero_iff, Multiset.bind_map] using roots_multiset_prod (m.map f)
#align polynomial.roots_prod Polynomial.roots_prod
@[simp]
theorem roots_pow (p : R[X]) (n : ℕ) : (p ^ n).roots = n • p.roots := by
induction' n with n ihn
· rw [pow_zero, roots_one, zero_smul, empty_eq_zero]
· rcases eq_or_ne p 0 with (rfl | hp)
· rw [zero_pow n.succ_ne_zero, roots_zero, smul_zero]
· rw [pow_succ, roots_mul (mul_ne_zero (pow_ne_zero _ hp) hp), ihn, add_smul, one_smul]
#align polynomial.roots_pow Polynomial.roots_pow
theorem roots_X_pow (n : ℕ) : (X ^ n : R[X]).roots = n • ({0} : Multiset R) := by
rw [roots_pow, roots_X]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_X_pow Polynomial.roots_X_pow
theorem roots_C_mul_X_pow (ha : a ≠ 0) (n : ℕ) :
Polynomial.roots (C a * X ^ n) = n • ({0} : Multiset R) := by
rw [roots_C_mul _ ha, roots_X_pow]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_C_mul_X_pow Polynomial.roots_C_mul_X_pow
@[simp]
theorem roots_monomial (ha : a ≠ 0) (n : ℕ) : (monomial n a).roots = n • ({0} : Multiset R) := by
rw [← C_mul_X_pow_eq_monomial, roots_C_mul_X_pow ha]
#align polynomial.roots_monomial Polynomial.roots_monomial
| Mathlib/Algebra/Polynomial/Roots.lean | 272 | 276 | theorem roots_prod_X_sub_C (s : Finset R) : (s.prod fun a => X - C a).roots = s.val := by |
apply (roots_prod (fun a => X - C a) s ?_).trans
· simp_rw [roots_X_sub_C]
rw [Multiset.bind_singleton, Multiset.map_id']
· refine prod_ne_zero_iff.mpr (fun a _ => X_sub_C_ne_zero a)
|
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.CategoryTheory.Groupoid.VertexGroup
import Mathlib.CategoryTheory.Groupoid.Basic
import Mathlib.CategoryTheory.Groupoid
import Mathlib.Data.Set.Lattice
import Mathlib.Order.GaloisConnection
#align_import category_theory.groupoid.subgroupoid from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open Set Groupoid
universe u v
variable {C : Type u} [Groupoid C]
@[ext]
structure Subgroupoid (C : Type u) [Groupoid C] where
arrows : ∀ c d : C, Set (c ⟶ d)
protected inv : ∀ {c d} {p : c ⟶ d}, p ∈ arrows c d → Groupoid.inv p ∈ arrows d c
protected mul : ∀ {c d e} {p}, p ∈ arrows c d → ∀ {q}, q ∈ arrows d e → p ≫ q ∈ arrows c e
#align category_theory.subgroupoid CategoryTheory.Subgroupoid
namespace Subgroupoid
variable (S : Subgroupoid C)
theorem inv_mem_iff {c d : C} (f : c ⟶ d) :
Groupoid.inv f ∈ S.arrows d c ↔ f ∈ S.arrows c d := by
constructor
· intro h
simpa only [inv_eq_inv, IsIso.inv_inv] using S.inv h
· apply S.inv
#align category_theory.subgroupoid.inv_mem_iff CategoryTheory.Subgroupoid.inv_mem_iff
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
constructor
· rintro h
suffices Groupoid.inv f ≫ f ≫ g ∈ S.arrows d e by
simpa only [inv_eq_inv, IsIso.inv_hom_id_assoc] using this
apply S.mul (S.inv hf) h
· apply S.mul hf
#align category_theory.subgroupoid.mul_mem_cancel_left CategoryTheory.Subgroupoid.mul_mem_cancel_left
theorem mul_mem_cancel_right {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hg : g ∈ S.arrows d e) :
f ≫ g ∈ S.arrows c e ↔ f ∈ S.arrows c d := by
constructor
· rintro h
suffices (f ≫ g) ≫ Groupoid.inv g ∈ S.arrows c d by
simpa only [inv_eq_inv, IsIso.hom_inv_id, Category.comp_id, Category.assoc] using this
apply S.mul h (S.inv hg)
· exact fun hf => S.mul hf hg
#align category_theory.subgroupoid.mul_mem_cancel_right CategoryTheory.Subgroupoid.mul_mem_cancel_right
def objs : Set C :=
{c : C | (S.arrows c c).Nonempty}
#align category_theory.subgroupoid.objs CategoryTheory.Subgroupoid.objs
theorem mem_objs_of_src {c d : C} {f : c ⟶ d} (h : f ∈ S.arrows c d) : c ∈ S.objs :=
⟨f ≫ Groupoid.inv f, S.mul h (S.inv h)⟩
#align category_theory.subgroupoid.mem_objs_of_src CategoryTheory.Subgroupoid.mem_objs_of_src
theorem mem_objs_of_tgt {c d : C} {f : c ⟶ d} (h : f ∈ S.arrows c d) : d ∈ S.objs :=
⟨Groupoid.inv f ≫ f, S.mul (S.inv h) h⟩
#align category_theory.subgroupoid.mem_objs_of_tgt CategoryTheory.Subgroupoid.mem_objs_of_tgt
theorem id_mem_of_nonempty_isotropy (c : C) : c ∈ objs S → 𝟙 c ∈ S.arrows c c := by
rintro ⟨γ, hγ⟩
convert S.mul hγ (S.inv hγ)
simp only [inv_eq_inv, IsIso.hom_inv_id]
#align category_theory.subgroupoid.id_mem_of_nonempty_isotropy CategoryTheory.Subgroupoid.id_mem_of_nonempty_isotropy
theorem id_mem_of_src {c d : C} {f : c ⟶ d} (h : f ∈ S.arrows c d) : 𝟙 c ∈ S.arrows c c :=
id_mem_of_nonempty_isotropy S c (mem_objs_of_src S h)
#align category_theory.subgroupoid.id_mem_of_src CategoryTheory.Subgroupoid.id_mem_of_src
theorem id_mem_of_tgt {c d : C} {f : c ⟶ d} (h : f ∈ S.arrows c d) : 𝟙 d ∈ S.arrows d d :=
id_mem_of_nonempty_isotropy S d (mem_objs_of_tgt S h)
#align category_theory.subgroupoid.id_mem_of_tgt CategoryTheory.Subgroupoid.id_mem_of_tgt
def asWideQuiver : Quiver C :=
⟨fun c d => Subtype <| S.arrows c d⟩
#align category_theory.subgroupoid.as_wide_quiver CategoryTheory.Subgroupoid.asWideQuiver
@[simps comp_coe, simps (config := .lemmasOnly) inv_coe]
instance coe : Groupoid S.objs where
Hom a b := S.arrows a.val b.val
id a := ⟨𝟙 a.val, id_mem_of_nonempty_isotropy S a.val a.prop⟩
comp p q := ⟨p.val ≫ q.val, S.mul p.prop q.prop⟩
inv p := ⟨Groupoid.inv p.val, S.inv p.prop⟩
#align category_theory.subgroupoid.coe CategoryTheory.Subgroupoid.coe
@[simp]
theorem coe_inv_coe' {c d : S.objs} (p : c ⟶ d) :
(CategoryTheory.inv p).val = CategoryTheory.inv p.val := by
simp only [← inv_eq_inv, coe_inv_coe]
#align category_theory.subgroupoid.coe_inv_coe' CategoryTheory.Subgroupoid.coe_inv_coe'
def hom : S.objs ⥤ C where
obj c := c.val
map f := f.val
map_id _ := rfl
map_comp _ _ := rfl
#align category_theory.subgroupoid.hom CategoryTheory.Subgroupoid.hom
theorem hom.inj_on_objects : Function.Injective (hom S).obj := by
rintro ⟨c, hc⟩ ⟨d, hd⟩ hcd
simp only [Subtype.mk_eq_mk]; exact hcd
#align category_theory.subgroupoid.hom.inj_on_objects CategoryTheory.Subgroupoid.hom.inj_on_objects
theorem hom.faithful : ∀ c d, Function.Injective fun f : c ⟶ d => (hom S).map f := by
rintro ⟨c, hc⟩ ⟨d, hd⟩ ⟨f, hf⟩ ⟨g, hg⟩ hfg; exact Subtype.eq hfg
#align category_theory.subgroupoid.hom.faithful CategoryTheory.Subgroupoid.hom.faithful
def vertexSubgroup {c : C} (hc : c ∈ S.objs) : Subgroup (c ⟶ c) where
carrier := S.arrows c c
mul_mem' hf hg := S.mul hf hg
one_mem' := id_mem_of_nonempty_isotropy _ _ hc
inv_mem' hf := S.inv hf
#align category_theory.subgroupoid.vertex_subgroup CategoryTheory.Subgroupoid.vertexSubgroup
@[coe] def toSet (S : Subgroupoid C) : Set (Σ c d : C, c ⟶ d) :=
{F | F.2.2 ∈ S.arrows F.1 F.2.1}
instance : SetLike (Subgroupoid C) (Σ c d : C, c ⟶ d) where
coe := toSet
coe_injective' := fun ⟨S, _, _⟩ ⟨T, _, _⟩ h => by ext c d f; apply Set.ext_iff.1 h ⟨c, d, f⟩
theorem mem_iff (S : Subgroupoid C) (F : Σ c d, c ⟶ d) : F ∈ S ↔ F.2.2 ∈ S.arrows F.1 F.2.1 :=
Iff.rfl
#align category_theory.subgroupoid.mem_iff CategoryTheory.Subgroupoid.mem_iff
theorem le_iff (S T : Subgroupoid C) : S ≤ T ↔ ∀ {c d}, S.arrows c d ⊆ T.arrows c d := by
rw [SetLike.le_def, Sigma.forall]; exact forall_congr' fun c => Sigma.forall
#align category_theory.subgroupoid.le_iff CategoryTheory.Subgroupoid.le_iff
instance : Top (Subgroupoid C) :=
⟨{ arrows := fun _ _ => Set.univ
mul := by intros; trivial
inv := by intros; trivial }⟩
theorem mem_top {c d : C} (f : c ⟶ d) : f ∈ (⊤ : Subgroupoid C).arrows c d :=
trivial
#align category_theory.subgroupoid.mem_top CategoryTheory.Subgroupoid.mem_top
theorem mem_top_objs (c : C) : c ∈ (⊤ : Subgroupoid C).objs := by
dsimp [Top.top, objs]
simp only [univ_nonempty]
#align category_theory.subgroupoid.mem_top_objs CategoryTheory.Subgroupoid.mem_top_objs
instance : Bot (Subgroupoid C) :=
⟨{ arrows := fun _ _ => ∅
mul := False.elim
inv := False.elim }⟩
instance : Inhabited (Subgroupoid C) :=
⟨⊤⟩
instance : Inf (Subgroupoid C) :=
⟨fun S T =>
{ arrows := fun c d => S.arrows c d ∩ T.arrows c d
inv := fun hp ↦ ⟨S.inv hp.1, T.inv hp.2⟩
mul := fun hp _ hq ↦ ⟨S.mul hp.1 hq.1, T.mul hp.2 hq.2⟩ }⟩
instance : InfSet (Subgroupoid C) :=
⟨fun s =>
{ arrows := fun c d => ⋂ S ∈ s, Subgroupoid.arrows S c d
inv := fun hp ↦ by rw [mem_iInter₂] at hp ⊢; exact fun S hS => S.inv (hp S hS)
mul := fun hp _ hq ↦ by
rw [mem_iInter₂] at hp hq ⊢;
exact fun S hS => S.mul (hp S hS) (hq S hS) }⟩
-- Porting note (#10756): new lemma
theorem mem_sInf_arrows {s : Set (Subgroupoid C)} {c d : C} {p : c ⟶ d} :
p ∈ (sInf s).arrows c d ↔ ∀ S ∈ s, p ∈ S.arrows c d :=
mem_iInter₂
theorem mem_sInf {s : Set (Subgroupoid C)} {p : Σ c d : C, c ⟶ d} :
p ∈ sInf s ↔ ∀ S ∈ s, p ∈ S :=
mem_sInf_arrows
instance : CompleteLattice (Subgroupoid C) :=
{ completeLatticeOfInf (Subgroupoid C) (by
refine fun s => ⟨fun S Ss F => ?_, fun T Tl F fT => ?_⟩ <;> simp only [mem_sInf]
exacts [fun hp => hp S Ss, fun S Ss => Tl Ss fT]) with
bot := ⊥
bot_le := fun S => empty_subset _
top := ⊤
le_top := fun S => subset_univ _
inf := (· ⊓ ·)
le_inf := fun R S T RS RT _ pR => ⟨RS pR, RT pR⟩
inf_le_left := fun R S _ => And.left
inf_le_right := fun R S _ => And.right }
theorem le_objs {S T : Subgroupoid C} (h : S ≤ T) : S.objs ⊆ T.objs := fun s ⟨γ, hγ⟩ =>
⟨γ, @h ⟨s, s, γ⟩ hγ⟩
#align category_theory.subgroupoid.le_objs CategoryTheory.Subgroupoid.le_objs
def inclusion {S T : Subgroupoid C} (h : S ≤ T) : S.objs ⥤ T.objs where
obj s := ⟨s.val, le_objs h s.prop⟩
map f := ⟨f.val, @h ⟨_, _, f.val⟩ f.prop⟩
map_id _ := rfl
map_comp _ _ := rfl
#align category_theory.subgroupoid.inclusion CategoryTheory.Subgroupoid.inclusion
theorem inclusion_inj_on_objects {S T : Subgroupoid C} (h : S ≤ T) :
Function.Injective (inclusion h).obj := fun ⟨s, hs⟩ ⟨t, ht⟩ => by
simpa only [inclusion, Subtype.mk_eq_mk] using id
#align category_theory.subgroupoid.inclusion_inj_on_objects CategoryTheory.Subgroupoid.inclusion_inj_on_objects
theorem inclusion_faithful {S T : Subgroupoid C} (h : S ≤ T) (s t : S.objs) :
Function.Injective fun f : s ⟶ t => (inclusion h).map f := fun ⟨f, hf⟩ ⟨g, hg⟩ => by
-- Porting note: was `...; simpa only [Subtype.mk_eq_mk] using id`
dsimp only [inclusion]; rw [Subtype.mk_eq_mk, Subtype.mk_eq_mk]; exact id
#align category_theory.subgroupoid.inclusion_faithful CategoryTheory.Subgroupoid.inclusion_faithful
theorem inclusion_refl {S : Subgroupoid C} : inclusion (le_refl S) = 𝟭 S.objs :=
Functor.hext (fun _ => rfl) fun _ _ _ => HEq.refl _
#align category_theory.subgroupoid.inclusion_refl CategoryTheory.Subgroupoid.inclusion_refl
theorem inclusion_trans {R S T : Subgroupoid C} (k : R ≤ S) (h : S ≤ T) :
inclusion (k.trans h) = inclusion k ⋙ inclusion h :=
rfl
#align category_theory.subgroupoid.inclusion_trans CategoryTheory.Subgroupoid.inclusion_trans
theorem inclusion_comp_embedding {S T : Subgroupoid C} (h : S ≤ T) : inclusion h ⋙ T.hom = S.hom :=
rfl
#align category_theory.subgroupoid.inclusion_comp_embedding CategoryTheory.Subgroupoid.inclusion_comp_embedding
inductive Discrete.Arrows : ∀ c d : C, (c ⟶ d) → Prop
| id (c : C) : Discrete.Arrows c c (𝟙 c)
#align category_theory.subgroupoid.discrete.arrows CategoryTheory.Subgroupoid.Discrete.Arrows
def discrete : Subgroupoid C where
arrows c d := {p | Discrete.Arrows c d p}
inv := by rintro _ _ _ ⟨⟩; simp only [inv_eq_inv, IsIso.inv_id]; constructor
mul := by rintro _ _ _ _ ⟨⟩ _ ⟨⟩; rw [Category.comp_id]; constructor
#align category_theory.subgroupoid.discrete CategoryTheory.Subgroupoid.discrete
theorem mem_discrete_iff {c d : C} (f : c ⟶ d) :
f ∈ discrete.arrows c d ↔ ∃ h : c = d, f = eqToHom h :=
⟨by rintro ⟨⟩; exact ⟨rfl, rfl⟩, by rintro ⟨rfl, rfl⟩; constructor⟩
#align category_theory.subgroupoid.mem_discrete_iff CategoryTheory.Subgroupoid.mem_discrete_iff
structure IsWide : Prop where
wide : ∀ c, 𝟙 c ∈ S.arrows c c
#align category_theory.subgroupoid.is_wide CategoryTheory.Subgroupoid.IsWide
theorem isWide_iff_objs_eq_univ : S.IsWide ↔ S.objs = Set.univ := by
constructor
· rintro h
ext x; constructor <;> simp only [top_eq_univ, mem_univ, imp_true_iff, forall_true_left]
apply mem_objs_of_src S (h.wide x)
· rintro h
refine ⟨fun c => ?_⟩
obtain ⟨γ, γS⟩ := (le_of_eq h.symm : ⊤ ⊆ S.objs) (Set.mem_univ c)
exact id_mem_of_src S γS
#align category_theory.subgroupoid.is_wide_iff_objs_eq_univ CategoryTheory.Subgroupoid.isWide_iff_objs_eq_univ
theorem IsWide.id_mem {S : Subgroupoid C} (Sw : S.IsWide) (c : C) : 𝟙 c ∈ S.arrows c c :=
Sw.wide c
#align category_theory.subgroupoid.is_wide.id_mem CategoryTheory.Subgroupoid.IsWide.id_mem
theorem IsWide.eqToHom_mem {S : Subgroupoid C} (Sw : S.IsWide) {c d : C} (h : c = d) :
eqToHom h ∈ S.arrows c d := by cases h; simp only [eqToHom_refl]; apply Sw.id_mem c
#align category_theory.subgroupoid.is_wide.eq_to_hom_mem CategoryTheory.Subgroupoid.IsWide.eqToHom_mem
structure IsNormal extends IsWide S : Prop where
conj : ∀ {c d} (p : c ⟶ d) {γ : c ⟶ c}, γ ∈ S.arrows c c → Groupoid.inv p ≫ γ ≫ p ∈ S.arrows d d
#align category_theory.subgroupoid.is_normal CategoryTheory.Subgroupoid.IsNormal
theorem IsNormal.conj' {S : Subgroupoid C} (Sn : IsNormal S) :
∀ {c d} (p : d ⟶ c) {γ : c ⟶ c}, γ ∈ S.arrows c c → p ≫ γ ≫ Groupoid.inv p ∈ S.arrows d d :=
fun p γ hs => by convert Sn.conj (Groupoid.inv p) hs; simp
#align category_theory.subgroupoid.is_normal.conj' CategoryTheory.Subgroupoid.IsNormal.conj'
theorem IsNormal.conjugation_bij (Sn : IsNormal S) {c d} (p : c ⟶ d) :
Set.BijOn (fun γ : c ⟶ c => Groupoid.inv p ≫ γ ≫ p) (S.arrows c c) (S.arrows d d) := by
refine ⟨fun γ γS => Sn.conj p γS, fun γ₁ _ γ₂ _ h => ?_, fun δ δS =>
⟨p ≫ δ ≫ Groupoid.inv p, Sn.conj' p δS, ?_⟩⟩
· simpa only [inv_eq_inv, Category.assoc, IsIso.hom_inv_id, Category.comp_id,
IsIso.hom_inv_id_assoc] using p ≫= h =≫ inv p
· simp only [inv_eq_inv, Category.assoc, IsIso.inv_hom_id, Category.comp_id,
IsIso.inv_hom_id_assoc]
#align category_theory.subgroupoid.is_normal.conjugation_bij CategoryTheory.Subgroupoid.IsNormal.conjugation_bij
theorem top_isNormal : IsNormal (⊤ : Subgroupoid C) :=
{ wide := fun _ => trivial
conj := fun _ _ _ => trivial }
#align category_theory.subgroupoid.top_is_normal CategoryTheory.Subgroupoid.top_isNormal
theorem sInf_isNormal (s : Set <| Subgroupoid C) (sn : ∀ S ∈ s, IsNormal S) : IsNormal (sInf s) :=
{ wide := by simp_rw [sInf, mem_iInter₂]; exact fun c S Ss => (sn S Ss).wide c
conj := by simp_rw [sInf, mem_iInter₂]; exact fun p γ hγ S Ss => (sn S Ss).conj p (hγ S Ss) }
#align category_theory.subgroupoid.Inf_is_normal CategoryTheory.Subgroupoid.sInf_isNormal
theorem discrete_isNormal : (@discrete C _).IsNormal :=
{ wide := fun c => by constructor
conj := fun f γ hγ => by
cases hγ
simp only [inv_eq_inv, Category.id_comp, IsIso.inv_hom_id]; constructor }
#align category_theory.subgroupoid.discrete_is_normal CategoryTheory.Subgroupoid.discrete_isNormal
theorem IsNormal.vertexSubgroup (Sn : IsNormal S) (c : C) (cS : c ∈ S.objs) :
(S.vertexSubgroup cS).Normal where
conj_mem x hx y := by rw [mul_assoc]; exact Sn.conj' y hx
#align category_theory.subgroupoid.is_normal.vertex_subgroup CategoryTheory.Subgroupoid.IsNormal.vertexSubgroup
section Full
variable (D : Set C)
def full : Subgroupoid C where
arrows c d := {_f | c ∈ D ∧ d ∈ D}
inv := by rintro _ _ _ ⟨⟩; constructor <;> assumption
mul := by rintro _ _ _ _ ⟨⟩ _ ⟨⟩; constructor <;> assumption
#align category_theory.subgroupoid.full CategoryTheory.Subgroupoid.full
theorem full_objs : (full D).objs = D :=
Set.ext fun _ => ⟨fun ⟨_, h, _⟩ => h, fun h => ⟨𝟙 _, h, h⟩⟩
#align category_theory.subgroupoid.full_objs CategoryTheory.Subgroupoid.full_objs
@[simp]
theorem mem_full_iff {c d : C} {f : c ⟶ d} : f ∈ (full D).arrows c d ↔ c ∈ D ∧ d ∈ D :=
Iff.rfl
#align category_theory.subgroupoid.mem_full_iff CategoryTheory.Subgroupoid.mem_full_iff
@[simp]
theorem mem_full_objs_iff {c : C} : c ∈ (full D).objs ↔ c ∈ D := by rw [full_objs]
#align category_theory.subgroupoid.mem_full_objs_iff CategoryTheory.Subgroupoid.mem_full_objs_iff
@[simp]
| Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean | 682 | 684 | theorem full_empty : full ∅ = (⊥ : Subgroupoid C) := by |
ext
simp only [Bot.bot, mem_full_iff, mem_empty_iff_false, and_self_iff]
|
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace Num
@[simp, norm_cast]
theorem of_to_nat' : ∀ n : Num, Num.ofNat' (n : ℕ) = n
| 0 => ofNat'_zero
| pos p => p.of_to_nat'
#align num.of_to_nat' Num.of_to_nat'
lemma toNat_injective : Injective (castNum : Num → ℕ) := LeftInverse.injective of_to_nat'
@[norm_cast]
theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n := toNat_injective.eq_iff
#align num.to_nat_inj Num.to_nat_inj
scoped macro (name := transfer_rw) "transfer_rw" : tactic => `(tactic|
(repeat first | rw [← to_nat_inj] | rw [← lt_to_nat] | rw [← le_to_nat]
repeat first | rw [add_to_nat] | rw [mul_to_nat] | rw [cast_one] | rw [cast_zero]))
scoped macro (name := transfer) "transfer" : tactic => `(tactic|
(intros; transfer_rw; try simp))
instance addMonoid : AddMonoid Num where
add := (· + ·)
zero := 0
zero_add := zero_add
add_zero := add_zero
add_assoc := by transfer
nsmul := nsmulRec
#align num.add_monoid Num.addMonoid
instance addMonoidWithOne : AddMonoidWithOne Num :=
{ Num.addMonoid with
natCast := Num.ofNat'
one := 1
natCast_zero := ofNat'_zero
natCast_succ := fun _ => ofNat'_succ }
#align num.add_monoid_with_one Num.addMonoidWithOne
instance commSemiring : CommSemiring Num where
__ := Num.addMonoid
__ := Num.addMonoidWithOne
mul := (· * ·)
npow := @npowRec Num ⟨1⟩ ⟨(· * ·)⟩
mul_zero _ := by rw [← to_nat_inj, mul_to_nat, cast_zero, mul_zero]
zero_mul _ := by rw [← to_nat_inj, mul_to_nat, cast_zero, zero_mul]
mul_one _ := by rw [← to_nat_inj, mul_to_nat, cast_one, mul_one]
one_mul _ := by rw [← to_nat_inj, mul_to_nat, cast_one, one_mul]
add_comm _ _ := by simp_rw [← to_nat_inj, add_to_nat, add_comm]
mul_comm _ _ := by simp_rw [← to_nat_inj, mul_to_nat, mul_comm]
mul_assoc _ _ _ := by simp_rw [← to_nat_inj, mul_to_nat, mul_assoc]
left_distrib _ _ _ := by simp only [← to_nat_inj, mul_to_nat, add_to_nat, mul_add]
right_distrib _ _ _ := by simp only [← to_nat_inj, mul_to_nat, add_to_nat, add_mul]
#align num.comm_semiring Num.commSemiring
instance orderedCancelAddCommMonoid : OrderedCancelAddCommMonoid Num where
le := (· ≤ ·)
lt := (· < ·)
lt_iff_le_not_le a b := by simp only [← lt_to_nat, ← le_to_nat, lt_iff_le_not_le]
le_refl := by transfer
le_trans a b c := by transfer_rw; apply le_trans
le_antisymm a b := by transfer_rw; apply le_antisymm
add_le_add_left a b h c := by revert h; transfer_rw; exact fun h => add_le_add_left h c
le_of_add_le_add_left a b c := by transfer_rw; apply le_of_add_le_add_left
#align num.ordered_cancel_add_comm_monoid Num.orderedCancelAddCommMonoid
instance linearOrderedSemiring : LinearOrderedSemiring Num :=
{ Num.commSemiring,
Num.orderedCancelAddCommMonoid with
le_total := by
intro a b
transfer_rw
apply le_total
zero_le_one := by decide
mul_lt_mul_of_pos_left := by
intro a b c
transfer_rw
apply mul_lt_mul_of_pos_left
mul_lt_mul_of_pos_right := by
intro a b c
transfer_rw
apply mul_lt_mul_of_pos_right
decidableLT := Num.decidableLT
decidableLE := Num.decidableLE
-- This is relying on an automatically generated instance name,
-- generated in a `deriving` handler.
-- See https://github.com/leanprover/lean4/issues/2343
decidableEq := instDecidableEqNum
exists_pair_ne := ⟨0, 1, by decide⟩ }
#align num.linear_ordered_semiring Num.linearOrderedSemiring
@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem add_of_nat (m n) : ((m + n : ℕ) : Num) = m + n :=
add_ofNat' _ _
#align num.add_of_nat Num.add_of_nat
@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align num.to_nat_to_int Num.to_nat_to_int
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align num.cast_to_int Num.cast_to_int
theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
| 0 => by rw [Nat.cast_zero, cast_zero]
| n + 1 => by rw [Nat.cast_succ, add_one, succ_to_nat, to_of_nat n]
#align num.to_of_nat Num.to_of_nat
@[simp, norm_cast]
| Mathlib/Data/Num/Lemmas.lean | 485 | 486 | theorem of_natCast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by |
rw [← cast_to_nat, to_of_nat]
|
import Mathlib.Topology.UniformSpace.UniformConvergenceTopology
#align_import topology.uniform_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
section
open UniformSpace Filter Set Uniformity Topology UniformConvergence Function
variable {ι κ X X' Y Z α α' β β' γ 𝓕 : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y]
[tZ : TopologicalSpace Z] [uα : UniformSpace α] [uβ : UniformSpace β] [uγ : UniformSpace γ]
def EquicontinuousAt (F : ι → X → α) (x₀ : X) : Prop :=
∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝 x₀, ∀ i, (F i x₀, F i x) ∈ U
#align equicontinuous_at EquicontinuousAt
protected abbrev Set.EquicontinuousAt (H : Set <| X → α) (x₀ : X) : Prop :=
EquicontinuousAt ((↑) : H → X → α) x₀
#align set.equicontinuous_at Set.EquicontinuousAt
def EquicontinuousWithinAt (F : ι → X → α) (S : Set X) (x₀ : X) : Prop :=
∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝[S] x₀, ∀ i, (F i x₀, F i x) ∈ U
protected abbrev Set.EquicontinuousWithinAt (H : Set <| X → α) (S : Set X) (x₀ : X) : Prop :=
EquicontinuousWithinAt ((↑) : H → X → α) S x₀
def Equicontinuous (F : ι → X → α) : Prop :=
∀ x₀, EquicontinuousAt F x₀
#align equicontinuous Equicontinuous
protected abbrev Set.Equicontinuous (H : Set <| X → α) : Prop :=
Equicontinuous ((↑) : H → X → α)
#align set.equicontinuous Set.Equicontinuous
def EquicontinuousOn (F : ι → X → α) (S : Set X) : Prop :=
∀ x₀ ∈ S, EquicontinuousWithinAt F S x₀
protected abbrev Set.EquicontinuousOn (H : Set <| X → α) (S : Set X) : Prop :=
EquicontinuousOn ((↑) : H → X → α) S
def UniformEquicontinuous (F : ι → β → α) : Prop :=
∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, (F i xy.1, F i xy.2) ∈ U
#align uniform_equicontinuous UniformEquicontinuous
protected abbrev Set.UniformEquicontinuous (H : Set <| β → α) : Prop :=
UniformEquicontinuous ((↑) : H → β → α)
#align set.uniform_equicontinuous Set.UniformEquicontinuous
def UniformEquicontinuousOn (F : ι → β → α) (S : Set β) : Prop :=
∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β ⊓ 𝓟 (S ×ˢ S), ∀ i, (F i xy.1, F i xy.2) ∈ U
protected abbrev Set.UniformEquicontinuousOn (H : Set <| β → α) (S : Set β) : Prop :=
UniformEquicontinuousOn ((↑) : H → β → α) S
lemma EquicontinuousAt.equicontinuousWithinAt {F : ι → X → α} {x₀ : X} (H : EquicontinuousAt F x₀)
(S : Set X) : EquicontinuousWithinAt F S x₀ :=
fun U hU ↦ (H U hU).filter_mono inf_le_left
lemma EquicontinuousWithinAt.mono {F : ι → X → α} {x₀ : X} {S T : Set X}
(H : EquicontinuousWithinAt F T x₀) (hST : S ⊆ T) : EquicontinuousWithinAt F S x₀ :=
fun U hU ↦ (H U hU).filter_mono <| nhdsWithin_mono x₀ hST
@[simp] lemma equicontinuousWithinAt_univ (F : ι → X → α) (x₀ : X) :
EquicontinuousWithinAt F univ x₀ ↔ EquicontinuousAt F x₀ := by
rw [EquicontinuousWithinAt, EquicontinuousAt, nhdsWithin_univ]
lemma equicontinuousAt_restrict_iff (F : ι → X → α) {S : Set X} (x₀ : S) :
EquicontinuousAt (S.restrict ∘ F) x₀ ↔ EquicontinuousWithinAt F S x₀ := by
simp [EquicontinuousWithinAt, EquicontinuousAt,
← eventually_nhds_subtype_iff]
lemma Equicontinuous.equicontinuousOn {F : ι → X → α} (H : Equicontinuous F)
(S : Set X) : EquicontinuousOn F S :=
fun x _ ↦ (H x).equicontinuousWithinAt S
lemma EquicontinuousOn.mono {F : ι → X → α} {S T : Set X}
(H : EquicontinuousOn F T) (hST : S ⊆ T) : EquicontinuousOn F S :=
fun x hx ↦ (H x (hST hx)).mono hST
lemma equicontinuousOn_univ (F : ι → X → α) :
EquicontinuousOn F univ ↔ Equicontinuous F := by
simp [EquicontinuousOn, Equicontinuous]
lemma equicontinuous_restrict_iff (F : ι → X → α) {S : Set X} :
Equicontinuous (S.restrict ∘ F) ↔ EquicontinuousOn F S := by
simp [Equicontinuous, EquicontinuousOn, equicontinuousAt_restrict_iff]
lemma UniformEquicontinuous.uniformEquicontinuousOn {F : ι → β → α} (H : UniformEquicontinuous F)
(S : Set β) : UniformEquicontinuousOn F S :=
fun U hU ↦ (H U hU).filter_mono inf_le_left
lemma UniformEquicontinuousOn.mono {F : ι → β → α} {S T : Set β}
(H : UniformEquicontinuousOn F T) (hST : S ⊆ T) : UniformEquicontinuousOn F S :=
fun U hU ↦ (H U hU).filter_mono <| by gcongr
lemma uniformEquicontinuousOn_univ (F : ι → β → α) :
UniformEquicontinuousOn F univ ↔ UniformEquicontinuous F := by
simp [UniformEquicontinuousOn, UniformEquicontinuous]
lemma uniformEquicontinuous_restrict_iff (F : ι → β → α) {S : Set β} :
UniformEquicontinuous (S.restrict ∘ F) ↔ UniformEquicontinuousOn F S := by
rw [UniformEquicontinuous, UniformEquicontinuousOn]
conv in _ ⊓ _ => rw [← Subtype.range_val (s := S), ← range_prod_map, ← map_comap]
rfl
@[simp]
lemma equicontinuousAt_empty [h : IsEmpty ι] (F : ι → X → α) (x₀ : X) :
EquicontinuousAt F x₀ :=
fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim)
@[simp]
lemma equicontinuousWithinAt_empty [h : IsEmpty ι] (F : ι → X → α) (S : Set X) (x₀ : X) :
EquicontinuousWithinAt F S x₀ :=
fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim)
@[simp]
lemma equicontinuous_empty [IsEmpty ι] (F : ι → X → α) :
Equicontinuous F :=
equicontinuousAt_empty F
@[simp]
lemma equicontinuousOn_empty [IsEmpty ι] (F : ι → X → α) (S : Set X) :
EquicontinuousOn F S :=
fun x₀ _ ↦ equicontinuousWithinAt_empty F S x₀
@[simp]
lemma uniformEquicontinuous_empty [h : IsEmpty ι] (F : ι → β → α) :
UniformEquicontinuous F :=
fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim)
@[simp]
lemma uniformEquicontinuousOn_empty [h : IsEmpty ι] (F : ι → β → α) (S : Set β) :
UniformEquicontinuousOn F S :=
fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim)
theorem equicontinuousAt_finite [Finite ι] {F : ι → X → α} {x₀ : X} :
EquicontinuousAt F x₀ ↔ ∀ i, ContinuousAt (F i) x₀ := by
simp [EquicontinuousAt, ContinuousAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff,
UniformSpace.ball, @forall_swap _ ι]
theorem equicontinuousWithinAt_finite [Finite ι] {F : ι → X → α} {S : Set X} {x₀ : X} :
EquicontinuousWithinAt F S x₀ ↔ ∀ i, ContinuousWithinAt (F i) S x₀ := by
simp [EquicontinuousWithinAt, ContinuousWithinAt,
(nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball,
@forall_swap _ ι]
theorem equicontinuous_finite [Finite ι] {F : ι → X → α} :
Equicontinuous F ↔ ∀ i, Continuous (F i) := by
simp only [Equicontinuous, equicontinuousAt_finite, continuous_iff_continuousAt, @forall_swap ι]
theorem equicontinuousOn_finite [Finite ι] {F : ι → X → α} {S : Set X} :
EquicontinuousOn F S ↔ ∀ i, ContinuousOn (F i) S := by
simp only [EquicontinuousOn, equicontinuousWithinAt_finite, ContinuousOn, @forall_swap ι]
theorem uniformEquicontinuous_finite [Finite ι] {F : ι → β → α} :
UniformEquicontinuous F ↔ ∀ i, UniformContinuous (F i) := by
simp only [UniformEquicontinuous, eventually_all, @forall_swap _ ι]; rfl
theorem uniformEquicontinuousOn_finite [Finite ι] {F : ι → β → α} {S : Set β} :
UniformEquicontinuousOn F S ↔ ∀ i, UniformContinuousOn (F i) S := by
simp only [UniformEquicontinuousOn, eventually_all, @forall_swap _ ι]; rfl
theorem equicontinuousAt_unique [Unique ι] {F : ι → X → α} {x : X} :
EquicontinuousAt F x ↔ ContinuousAt (F default) x :=
equicontinuousAt_finite.trans Unique.forall_iff
theorem equicontinuousWithinAt_unique [Unique ι] {F : ι → X → α} {S : Set X} {x : X} :
EquicontinuousWithinAt F S x ↔ ContinuousWithinAt (F default) S x :=
equicontinuousWithinAt_finite.trans Unique.forall_iff
theorem equicontinuous_unique [Unique ι] {F : ι → X → α} :
Equicontinuous F ↔ Continuous (F default) :=
equicontinuous_finite.trans Unique.forall_iff
theorem equicontinuousOn_unique [Unique ι] {F : ι → X → α} {S : Set X} :
EquicontinuousOn F S ↔ ContinuousOn (F default) S :=
equicontinuousOn_finite.trans Unique.forall_iff
theorem uniformEquicontinuous_unique [Unique ι] {F : ι → β → α} :
UniformEquicontinuous F ↔ UniformContinuous (F default) :=
uniformEquicontinuous_finite.trans Unique.forall_iff
theorem uniformEquicontinuousOn_unique [Unique ι] {F : ι → β → α} {S : Set β} :
UniformEquicontinuousOn F S ↔ UniformContinuousOn (F default) S :=
uniformEquicontinuousOn_finite.trans Unique.forall_iff
theorem equicontinuousWithinAt_iff_pair {F : ι → X → α} {S : Set X} {x₀ : X} (hx₀ : x₀ ∈ S) :
EquicontinuousWithinAt F S x₀ ↔
∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝[S] x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by
constructor <;> intro H U hU
· rcases comp_symm_mem_uniformity_sets hU with ⟨V, hV, hVsymm, hVU⟩
refine ⟨_, H V hV, fun x hx y hy i => hVU (prod_mk_mem_compRel ?_ (hy i))⟩
exact hVsymm.mk_mem_comm.mp (hx i)
· rcases H U hU with ⟨V, hV, hVU⟩
filter_upwards [hV] using fun x hx i => hVU x₀ (mem_of_mem_nhdsWithin hx₀ hV) x hx i
theorem equicontinuousAt_iff_pair {F : ι → X → α} {x₀ : X} :
EquicontinuousAt F x₀ ↔
∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝 x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by
simp_rw [← equicontinuousWithinAt_univ, equicontinuousWithinAt_iff_pair (mem_univ x₀),
nhdsWithin_univ]
#align equicontinuous_at_iff_pair equicontinuousAt_iff_pair
theorem UniformEquicontinuous.equicontinuous {F : ι → β → α} (h : UniformEquicontinuous F) :
Equicontinuous F := fun x₀ U hU ↦
mem_of_superset (ball_mem_nhds x₀ (h U hU)) fun _ hx i ↦ hx i
#align uniform_equicontinuous.equicontinuous UniformEquicontinuous.equicontinuous
theorem UniformEquicontinuousOn.equicontinuousOn {F : ι → β → α} {S : Set β}
(h : UniformEquicontinuousOn F S) :
EquicontinuousOn F S := fun _ hx₀ U hU ↦
mem_of_superset (ball_mem_nhdsWithin hx₀ (h U hU)) fun _ hx i ↦ hx i
theorem EquicontinuousAt.continuousAt {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (i : ι) :
ContinuousAt (F i) x₀ :=
(UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i
#align equicontinuous_at.continuous_at EquicontinuousAt.continuousAt
theorem EquicontinuousWithinAt.continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X}
(h : EquicontinuousWithinAt F S x₀) (i : ι) :
ContinuousWithinAt (F i) S x₀ :=
(UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i
protected theorem Set.EquicontinuousAt.continuousAt_of_mem {H : Set <| X → α} {x₀ : X}
(h : H.EquicontinuousAt x₀) {f : X → α} (hf : f ∈ H) : ContinuousAt f x₀ :=
h.continuousAt ⟨f, hf⟩
#align set.equicontinuous_at.continuous_at_of_mem Set.EquicontinuousAt.continuousAt_of_mem
protected theorem Set.EquicontinuousWithinAt.continuousWithinAt_of_mem {H : Set <| X → α}
{S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) {f : X → α} (hf : f ∈ H) :
ContinuousWithinAt f S x₀ :=
h.continuousWithinAt ⟨f, hf⟩
theorem Equicontinuous.continuous {F : ι → X → α} (h : Equicontinuous F) (i : ι) :
Continuous (F i) :=
continuous_iff_continuousAt.mpr fun x => (h x).continuousAt i
#align equicontinuous.continuous Equicontinuous.continuous
theorem EquicontinuousOn.continuousOn {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S)
(i : ι) : ContinuousOn (F i) S :=
fun x hx ↦ (h x hx).continuousWithinAt i
protected theorem Set.Equicontinuous.continuous_of_mem {H : Set <| X → α} (h : H.Equicontinuous)
{f : X → α} (hf : f ∈ H) : Continuous f :=
h.continuous ⟨f, hf⟩
#align set.equicontinuous.continuous_of_mem Set.Equicontinuous.continuous_of_mem
protected theorem Set.EquicontinuousOn.continuousOn_of_mem {H : Set <| X → α} {S : Set X}
(h : H.EquicontinuousOn S) {f : X → α} (hf : f ∈ H) : ContinuousOn f S :=
h.continuousOn ⟨f, hf⟩
theorem UniformEquicontinuous.uniformContinuous {F : ι → β → α} (h : UniformEquicontinuous F)
(i : ι) : UniformContinuous (F i) := fun U hU =>
mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i)
#align uniform_equicontinuous.uniform_continuous UniformEquicontinuous.uniformContinuous
theorem UniformEquicontinuousOn.uniformContinuousOn {F : ι → β → α} {S : Set β}
(h : UniformEquicontinuousOn F S) (i : ι) :
UniformContinuousOn (F i) S := fun U hU =>
mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i)
protected theorem Set.UniformEquicontinuous.uniformContinuous_of_mem {H : Set <| β → α}
(h : H.UniformEquicontinuous) {f : β → α} (hf : f ∈ H) : UniformContinuous f :=
h.uniformContinuous ⟨f, hf⟩
#align set.uniform_equicontinuous.uniform_continuous_of_mem Set.UniformEquicontinuous.uniformContinuous_of_mem
protected theorem Set.UniformEquicontinuousOn.uniformContinuousOn_of_mem {H : Set <| β → α}
{S : Set β} (h : H.UniformEquicontinuousOn S) {f : β → α} (hf : f ∈ H) :
UniformContinuousOn f S :=
h.uniformContinuousOn ⟨f, hf⟩
theorem EquicontinuousAt.comp {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (u : κ → ι) :
EquicontinuousAt (F ∘ u) x₀ := fun U hU => (h U hU).mono fun _ H k => H (u k)
#align equicontinuous_at.comp EquicontinuousAt.comp
theorem EquicontinuousWithinAt.comp {F : ι → X → α} {S : Set X} {x₀ : X}
(h : EquicontinuousWithinAt F S x₀) (u : κ → ι) :
EquicontinuousWithinAt (F ∘ u) S x₀ :=
fun U hU ↦ (h U hU).mono fun _ H k => H (u k)
protected theorem Set.EquicontinuousAt.mono {H H' : Set <| X → α} {x₀ : X}
(h : H.EquicontinuousAt x₀) (hH : H' ⊆ H) : H'.EquicontinuousAt x₀ :=
h.comp (inclusion hH)
#align set.equicontinuous_at.mono Set.EquicontinuousAt.mono
protected theorem Set.EquicontinuousWithinAt.mono {H H' : Set <| X → α} {S : Set X} {x₀ : X}
(h : H.EquicontinuousWithinAt S x₀) (hH : H' ⊆ H) : H'.EquicontinuousWithinAt S x₀ :=
h.comp (inclusion hH)
theorem Equicontinuous.comp {F : ι → X → α} (h : Equicontinuous F) (u : κ → ι) :
Equicontinuous (F ∘ u) := fun x => (h x).comp u
#align equicontinuous.comp Equicontinuous.comp
theorem EquicontinuousOn.comp {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (u : κ → ι) :
EquicontinuousOn (F ∘ u) S := fun x hx ↦ (h x hx).comp u
protected theorem Set.Equicontinuous.mono {H H' : Set <| X → α} (h : H.Equicontinuous)
(hH : H' ⊆ H) : H'.Equicontinuous :=
h.comp (inclusion hH)
#align set.equicontinuous.mono Set.Equicontinuous.mono
protected theorem Set.EquicontinuousOn.mono {H H' : Set <| X → α} {S : Set X}
(h : H.EquicontinuousOn S) (hH : H' ⊆ H) : H'.EquicontinuousOn S :=
h.comp (inclusion hH)
theorem UniformEquicontinuous.comp {F : ι → β → α} (h : UniformEquicontinuous F) (u : κ → ι) :
UniformEquicontinuous (F ∘ u) := fun U hU => (h U hU).mono fun _ H k => H (u k)
#align uniform_equicontinuous.comp UniformEquicontinuous.comp
theorem UniformEquicontinuousOn.comp {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S)
(u : κ → ι) : UniformEquicontinuousOn (F ∘ u) S :=
fun U hU ↦ (h U hU).mono fun _ H k => H (u k)
protected theorem Set.UniformEquicontinuous.mono {H H' : Set <| β → α} (h : H.UniformEquicontinuous)
(hH : H' ⊆ H) : H'.UniformEquicontinuous :=
h.comp (inclusion hH)
#align set.uniform_equicontinuous.mono Set.UniformEquicontinuous.mono
protected theorem Set.UniformEquicontinuousOn.mono {H H' : Set <| β → α} {S : Set β}
(h : H.UniformEquicontinuousOn S) (hH : H' ⊆ H) : H'.UniformEquicontinuousOn S :=
h.comp (inclusion hH)
theorem equicontinuousAt_iff_range {F : ι → X → α} {x₀ : X} :
EquicontinuousAt F x₀ ↔ EquicontinuousAt ((↑) : range F → X → α) x₀ := by
simp only [EquicontinuousAt, forall_subtype_range_iff]
#align equicontinuous_at_iff_range equicontinuousAt_iff_range
theorem equicontinuousWithinAt_iff_range {F : ι → X → α} {S : Set X} {x₀ : X} :
EquicontinuousWithinAt F S x₀ ↔ EquicontinuousWithinAt ((↑) : range F → X → α) S x₀ := by
simp only [EquicontinuousWithinAt, forall_subtype_range_iff]
theorem equicontinuous_iff_range {F : ι → X → α} :
Equicontinuous F ↔ Equicontinuous ((↑) : range F → X → α) :=
forall_congr' fun _ => equicontinuousAt_iff_range
#align equicontinuous_iff_range equicontinuous_iff_range
theorem equicontinuousOn_iff_range {F : ι → X → α} {S : Set X} :
EquicontinuousOn F S ↔ EquicontinuousOn ((↑) : range F → X → α) S :=
forall_congr' fun _ ↦ forall_congr' fun _ ↦ equicontinuousWithinAt_iff_range
theorem uniformEquicontinuous_iff_range {F : ι → β → α} :
UniformEquicontinuous F ↔ UniformEquicontinuous ((↑) : range F → β → α) :=
⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h =>
h.comp (rangeFactorization F)⟩
#align uniform_equicontinuous_at_iff_range uniformEquicontinuous_iff_range
theorem uniformEquicontinuousOn_iff_range {F : ι → β → α} {S : Set β} :
UniformEquicontinuousOn F S ↔ UniformEquicontinuousOn ((↑) : range F → β → α) S :=
⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h =>
h.comp (rangeFactorization F)⟩
section
open UniformFun
theorem equicontinuousAt_iff_continuousAt {F : ι → X → α} {x₀ : X} :
EquicontinuousAt F x₀ ↔ ContinuousAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) x₀ := by
rw [ContinuousAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff]
rfl
#align equicontinuous_at_iff_continuous_at equicontinuousAt_iff_continuousAt
theorem equicontinuousWithinAt_iff_continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} :
EquicontinuousWithinAt F S x₀ ↔
ContinuousWithinAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) S x₀ := by
rw [ContinuousWithinAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff]
rfl
theorem equicontinuous_iff_continuous {F : ι → X → α} :
Equicontinuous F ↔ Continuous (ofFun ∘ Function.swap F : X → ι →ᵤ α) := by
simp_rw [Equicontinuous, continuous_iff_continuousAt, equicontinuousAt_iff_continuousAt]
#align equicontinuous_iff_continuous equicontinuous_iff_continuous
theorem equicontinuousOn_iff_continuousOn {F : ι → X → α} {S : Set X} :
EquicontinuousOn F S ↔ ContinuousOn (ofFun ∘ Function.swap F : X → ι →ᵤ α) S := by
simp_rw [EquicontinuousOn, ContinuousOn, equicontinuousWithinAt_iff_continuousWithinAt]
theorem uniformEquicontinuous_iff_uniformContinuous {F : ι → β → α} :
UniformEquicontinuous F ↔ UniformContinuous (ofFun ∘ Function.swap F : β → ι →ᵤ α) := by
rw [UniformContinuous, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff]
rfl
#align uniform_equicontinuous_iff_uniform_continuous uniformEquicontinuous_iff_uniformContinuous
theorem uniformEquicontinuousOn_iff_uniformContinuousOn {F : ι → β → α} {S : Set β} :
UniformEquicontinuousOn F S ↔ UniformContinuousOn (ofFun ∘ Function.swap F : β → ι →ᵤ α) S := by
rw [UniformContinuousOn, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff]
rfl
theorem equicontinuousWithinAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'}
{S : Set X} {x₀ : X} : EquicontinuousWithinAt (uα := ⨅ k, u k) F S x₀ ↔
∀ k, EquicontinuousWithinAt (uα := u k) F S x₀ := by
simp only [equicontinuousWithinAt_iff_continuousWithinAt (uα := _), topologicalSpace]
unfold ContinuousWithinAt
rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, nhds_iInf, tendsto_iInf]
theorem equicontinuousAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'}
{x₀ : X} :
EquicontinuousAt (uα := ⨅ k, u k) F x₀ ↔ ∀ k, EquicontinuousAt (uα := u k) F x₀ := by
simp only [← equicontinuousWithinAt_univ (uα := _), equicontinuousWithinAt_iInf_rng]
theorem equicontinuous_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} :
Equicontinuous (uα := ⨅ k, u k) F ↔ ∀ k, Equicontinuous (uα := u k) F := by
simp_rw [equicontinuous_iff_continuous (uα := _), UniformFun.topologicalSpace]
rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, continuous_iInf_rng]
| Mathlib/Topology/UniformSpace/Equicontinuity.lean | 578 | 581 | theorem equicontinuousOn_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'}
{S : Set X} :
EquicontinuousOn (uα := ⨅ k, u k) F S ↔ ∀ k, EquicontinuousOn (uα := u k) F S := by |
simp_rw [EquicontinuousOn, equicontinuousWithinAt_iInf_rng, @forall_swap _ κ]
|
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Int.Lemmas
import Mathlib.Data.Set.Subsingleton
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Order.GaloisConnection
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Positivity
#align_import algebra.order.floor from "leanprover-community/mathlib"@"afdb43429311b885a7988ea15d0bac2aac80f69c"
open Set
variable {F α β : Type*}
class FloorSemiring (α) [OrderedSemiring α] where
floor : α → ℕ
ceil : α → ℕ
floor_of_neg {a : α} (ha : a < 0) : floor a = 0
gc_floor {a : α} {n : ℕ} (ha : 0 ≤ a) : n ≤ floor a ↔ (n : α) ≤ a
gc_ceil : GaloisConnection ceil (↑)
#align floor_semiring FloorSemiring
instance : FloorSemiring ℕ where
floor := id
ceil := id
floor_of_neg ha := (Nat.not_lt_zero _ ha).elim
gc_floor _ := by
rw [Nat.cast_id]
rfl
gc_ceil n a := by
rw [Nat.cast_id]
rfl
namespace Nat
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
Subsingleton (FloorSemiring α) := by
refine ⟨fun H₁ H₂ => ?_⟩
have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
have : H₁.floor = H₂.floor := by
ext a
cases' lt_or_le a 0 with h h
· rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
· refine eq_of_forall_le_iff fun n => ?_
rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
cases H₁
cases H₂
congr
#align subsingleton_floor_semiring subsingleton_floorSemiring
class FloorRing (α) [LinearOrderedRing α] where
floor : α → ℤ
ceil : α → ℤ
gc_coe_floor : GaloisConnection (↑) floor
gc_ceil_coe : GaloisConnection ceil (↑)
#align floor_ring FloorRing
instance : FloorRing ℤ where
floor := id
ceil := id
gc_coe_floor a b := by
rw [Int.cast_id]
rfl
gc_ceil_coe a b := by
rw [Int.cast_id]
rfl
def FloorRing.ofFloor (α) [LinearOrderedRing α] (floor : α → ℤ)
(gc_coe_floor : GaloisConnection (↑) floor) : FloorRing α :=
{ floor
ceil := fun a => -floor (-a)
gc_coe_floor
gc_ceil_coe := fun a z => by rw [neg_le, ← gc_coe_floor, Int.cast_neg, neg_le_neg_iff] }
#align floor_ring.of_floor FloorRing.ofFloor
def FloorRing.ofCeil (α) [LinearOrderedRing α] (ceil : α → ℤ)
(gc_ceil_coe : GaloisConnection ceil (↑)) : FloorRing α :=
{ floor := fun a => -ceil (-a)
ceil
gc_coe_floor := fun a z => by rw [le_neg, gc_ceil_coe, Int.cast_neg, neg_le_neg_iff]
gc_ceil_coe }
#align floor_ring.of_ceil FloorRing.ofCeil
namespace Int
variable [LinearOrderedRing α] [FloorRing α] {z : ℤ} {a : α}
def floor : α → ℤ :=
FloorRing.floor
#align int.floor Int.floor
def ceil : α → ℤ :=
FloorRing.ceil
#align int.ceil Int.ceil
def fract (a : α) : α :=
a - floor a
#align int.fract Int.fract
@[simp]
theorem floor_int : (Int.floor : ℤ → ℤ) = id :=
rfl
#align int.floor_int Int.floor_int
@[simp]
theorem ceil_int : (Int.ceil : ℤ → ℤ) = id :=
rfl
#align int.ceil_int Int.ceil_int
@[simp]
theorem fract_int : (Int.fract : ℤ → ℤ) = 0 :=
funext fun x => by simp [fract]
#align int.fract_int Int.fract_int
@[inherit_doc]
notation "⌊" a "⌋" => Int.floor a
@[inherit_doc]
notation "⌈" a "⌉" => Int.ceil a
-- Mathematical notation for `fract a` is usually `{a}`. Let's not even go there.
@[simp]
theorem floorRing_floor_eq : @FloorRing.floor = @Int.floor :=
rfl
#align int.floor_ring_floor_eq Int.floorRing_floor_eq
@[simp]
theorem floorRing_ceil_eq : @FloorRing.ceil = @Int.ceil :=
rfl
#align int.floor_ring_ceil_eq Int.floorRing_ceil_eq
theorem gc_coe_floor : GaloisConnection ((↑) : ℤ → α) floor :=
FloorRing.gc_coe_floor
#align int.gc_coe_floor Int.gc_coe_floor
theorem le_floor : z ≤ ⌊a⌋ ↔ (z : α) ≤ a :=
(gc_coe_floor z a).symm
#align int.le_floor Int.le_floor
theorem floor_lt : ⌊a⌋ < z ↔ a < z :=
lt_iff_lt_of_le_iff_le le_floor
#align int.floor_lt Int.floor_lt
theorem floor_le (a : α) : (⌊a⌋ : α) ≤ a :=
gc_coe_floor.l_u_le a
#align int.floor_le Int.floor_le
theorem floor_nonneg : 0 ≤ ⌊a⌋ ↔ 0 ≤ a := by rw [le_floor, Int.cast_zero]
#align int.floor_nonneg Int.floor_nonneg
@[simp]
theorem floor_le_sub_one_iff : ⌊a⌋ ≤ z - 1 ↔ a < z := by rw [← floor_lt, le_sub_one_iff]
#align int.floor_le_sub_one_iff Int.floor_le_sub_one_iff
@[simp]
theorem floor_le_neg_one_iff : ⌊a⌋ ≤ -1 ↔ a < 0 := by
rw [← zero_sub (1 : ℤ), floor_le_sub_one_iff, cast_zero]
#align int.floor_le_neg_one_iff Int.floor_le_neg_one_iff
theorem floor_nonpos (ha : a ≤ 0) : ⌊a⌋ ≤ 0 := by
rw [← @cast_le α, Int.cast_zero]
exact (floor_le a).trans ha
#align int.floor_nonpos Int.floor_nonpos
theorem lt_succ_floor (a : α) : a < ⌊a⌋.succ :=
floor_lt.1 <| Int.lt_succ_self _
#align int.lt_succ_floor Int.lt_succ_floor
@[simp]
theorem lt_floor_add_one (a : α) : a < ⌊a⌋ + 1 := by
simpa only [Int.succ, Int.cast_add, Int.cast_one] using lt_succ_floor a
#align int.lt_floor_add_one Int.lt_floor_add_one
@[simp]
theorem sub_one_lt_floor (a : α) : a - 1 < ⌊a⌋ :=
sub_lt_iff_lt_add.2 (lt_floor_add_one a)
#align int.sub_one_lt_floor Int.sub_one_lt_floor
@[simp]
theorem floor_intCast (z : ℤ) : ⌊(z : α)⌋ = z :=
eq_of_forall_le_iff fun a => by rw [le_floor, Int.cast_le]
#align int.floor_int_cast Int.floor_intCast
@[simp]
theorem floor_natCast (n : ℕ) : ⌊(n : α)⌋ = n :=
eq_of_forall_le_iff fun a => by rw [le_floor, ← cast_natCast, cast_le]
#align int.floor_nat_cast Int.floor_natCast
@[simp]
theorem floor_zero : ⌊(0 : α)⌋ = 0 := by rw [← cast_zero, floor_intCast]
#align int.floor_zero Int.floor_zero
@[simp]
theorem floor_one : ⌊(1 : α)⌋ = 1 := by rw [← cast_one, floor_intCast]
#align int.floor_one Int.floor_one
-- See note [no_index around OfNat.ofNat]
@[simp] theorem floor_ofNat (n : ℕ) [n.AtLeastTwo] : ⌊(no_index (OfNat.ofNat n : α))⌋ = n :=
floor_natCast n
@[mono]
theorem floor_mono : Monotone (floor : α → ℤ) :=
gc_coe_floor.monotone_u
#align int.floor_mono Int.floor_mono
@[gcongr]
theorem floor_le_floor : ∀ x y : α, x ≤ y → ⌊x⌋ ≤ ⌊y⌋ := floor_mono
theorem floor_pos : 0 < ⌊a⌋ ↔ 1 ≤ a := by
-- Porting note: broken `convert le_floor`
rw [Int.lt_iff_add_one_le, zero_add, le_floor, cast_one]
#align int.floor_pos Int.floor_pos
@[simp]
theorem floor_add_int (a : α) (z : ℤ) : ⌊a + z⌋ = ⌊a⌋ + z :=
eq_of_forall_le_iff fun a => by
rw [le_floor, ← sub_le_iff_le_add, ← sub_le_iff_le_add, le_floor, Int.cast_sub]
#align int.floor_add_int Int.floor_add_int
@[simp]
theorem floor_add_one (a : α) : ⌊a + 1⌋ = ⌊a⌋ + 1 := by
-- Porting note: broken `convert floor_add_int a 1`
rw [← cast_one, floor_add_int]
#align int.floor_add_one Int.floor_add_one
theorem le_floor_add (a b : α) : ⌊a⌋ + ⌊b⌋ ≤ ⌊a + b⌋ := by
rw [le_floor, Int.cast_add]
exact add_le_add (floor_le _) (floor_le _)
#align int.le_floor_add Int.le_floor_add
theorem le_floor_add_floor (a b : α) : ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋ := by
rw [← sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
refine le_trans ?_ (sub_one_lt_floor _).le
rw [sub_le_iff_le_add', ← add_sub_assoc, sub_le_sub_iff_right]
exact floor_le _
#align int.le_floor_add_floor Int.le_floor_add_floor
@[simp]
theorem floor_int_add (z : ℤ) (a : α) : ⌊↑z + a⌋ = z + ⌊a⌋ := by
simpa only [add_comm] using floor_add_int a z
#align int.floor_int_add Int.floor_int_add
@[simp]
theorem floor_add_nat (a : α) (n : ℕ) : ⌊a + n⌋ = ⌊a⌋ + n := by
rw [← Int.cast_natCast, floor_add_int]
#align int.floor_add_nat Int.floor_add_nat
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem floor_add_ofNat (a : α) (n : ℕ) [n.AtLeastTwo] :
⌊a + (no_index (OfNat.ofNat n))⌋ = ⌊a⌋ + OfNat.ofNat n :=
floor_add_nat a n
@[simp]
theorem floor_nat_add (n : ℕ) (a : α) : ⌊↑n + a⌋ = n + ⌊a⌋ := by
rw [← Int.cast_natCast, floor_int_add]
#align int.floor_nat_add Int.floor_nat_add
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem floor_ofNat_add (n : ℕ) [n.AtLeastTwo] (a : α) :
⌊(no_index (OfNat.ofNat n)) + a⌋ = OfNat.ofNat n + ⌊a⌋ :=
floor_nat_add n a
@[simp]
theorem floor_sub_int (a : α) (z : ℤ) : ⌊a - z⌋ = ⌊a⌋ - z :=
Eq.trans (by rw [Int.cast_neg, sub_eq_add_neg]) (floor_add_int _ _)
#align int.floor_sub_int Int.floor_sub_int
@[simp]
theorem floor_sub_nat (a : α) (n : ℕ) : ⌊a - n⌋ = ⌊a⌋ - n := by
rw [← Int.cast_natCast, floor_sub_int]
#align int.floor_sub_nat Int.floor_sub_nat
@[simp] theorem floor_sub_one (a : α) : ⌊a - 1⌋ = ⌊a⌋ - 1 := mod_cast floor_sub_nat a 1
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem floor_sub_ofNat (a : α) (n : ℕ) [n.AtLeastTwo] :
⌊a - (no_index (OfNat.ofNat n))⌋ = ⌊a⌋ - OfNat.ofNat n :=
floor_sub_nat a n
theorem abs_sub_lt_one_of_floor_eq_floor {α : Type*} [LinearOrderedCommRing α] [FloorRing α]
{a b : α} (h : ⌊a⌋ = ⌊b⌋) : |a - b| < 1 := by
have : a < ⌊a⌋ + 1 := lt_floor_add_one a
have : b < ⌊b⌋ + 1 := lt_floor_add_one b
have : (⌊a⌋ : α) = ⌊b⌋ := Int.cast_inj.2 h
have : (⌊a⌋ : α) ≤ a := floor_le a
have : (⌊b⌋ : α) ≤ b := floor_le b
exact abs_sub_lt_iff.2 ⟨by linarith, by linarith⟩
#align int.abs_sub_lt_one_of_floor_eq_floor Int.abs_sub_lt_one_of_floor_eq_floor
theorem floor_eq_iff : ⌊a⌋ = z ↔ ↑z ≤ a ∧ a < z + 1 := by
rw [le_antisymm_iff, le_floor, ← Int.lt_add_one_iff, floor_lt, Int.cast_add, Int.cast_one,
and_comm]
#align int.floor_eq_iff Int.floor_eq_iff
@[simp]
theorem floor_eq_zero_iff : ⌊a⌋ = 0 ↔ a ∈ Ico (0 : α) 1 := by simp [floor_eq_iff]
#align int.floor_eq_zero_iff Int.floor_eq_zero_iff
theorem floor_eq_on_Ico (n : ℤ) : ∀ a ∈ Set.Ico (n : α) (n + 1), ⌊a⌋ = n := fun _ ⟨h₀, h₁⟩ =>
floor_eq_iff.mpr ⟨h₀, h₁⟩
#align int.floor_eq_on_Ico Int.floor_eq_on_Ico
theorem floor_eq_on_Ico' (n : ℤ) : ∀ a ∈ Set.Ico (n : α) (n + 1), (⌊a⌋ : α) = n := fun a ha =>
congr_arg _ <| floor_eq_on_Ico n a ha
#align int.floor_eq_on_Ico' Int.floor_eq_on_Ico'
-- Porting note: in mathlib3 there was no need for the type annotation in `(m:α)`
@[simp]
theorem preimage_floor_singleton (m : ℤ) : (floor : α → ℤ) ⁻¹' {m} = Ico (m : α) (m + 1) :=
ext fun _ => floor_eq_iff
#align int.preimage_floor_singleton Int.preimage_floor_singleton
@[simp]
theorem self_sub_floor (a : α) : a - ⌊a⌋ = fract a :=
rfl
#align int.self_sub_floor Int.self_sub_floor
@[simp]
theorem floor_add_fract (a : α) : (⌊a⌋ : α) + fract a = a :=
add_sub_cancel _ _
#align int.floor_add_fract Int.floor_add_fract
@[simp]
theorem fract_add_floor (a : α) : fract a + ⌊a⌋ = a :=
sub_add_cancel _ _
#align int.fract_add_floor Int.fract_add_floor
@[simp]
theorem fract_add_int (a : α) (m : ℤ) : fract (a + m) = fract a := by
rw [fract]
simp
#align int.fract_add_int Int.fract_add_int
@[simp]
theorem fract_add_nat (a : α) (m : ℕ) : fract (a + m) = fract a := by
rw [fract]
simp
#align int.fract_add_nat Int.fract_add_nat
@[simp]
theorem fract_add_one (a : α) : fract (a + 1) = fract a := mod_cast fract_add_nat a 1
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem fract_add_ofNat (a : α) (n : ℕ) [n.AtLeastTwo] :
fract (a + (no_index (OfNat.ofNat n))) = fract a :=
fract_add_nat a n
@[simp]
theorem fract_int_add (m : ℤ) (a : α) : fract (↑m + a) = fract a := by rw [add_comm, fract_add_int]
#align int.fract_int_add Int.fract_int_add
@[simp]
theorem fract_nat_add (n : ℕ) (a : α) : fract (↑n + a) = fract a := by rw [add_comm, fract_add_nat]
@[simp]
theorem fract_one_add (a : α) : fract (1 + a) = fract a := mod_cast fract_nat_add 1 a
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem fract_ofNat_add (n : ℕ) [n.AtLeastTwo] (a : α) :
fract ((no_index (OfNat.ofNat n)) + a) = fract a :=
fract_nat_add n a
@[simp]
theorem fract_sub_int (a : α) (m : ℤ) : fract (a - m) = fract a := by
rw [fract]
simp
#align int.fract_sub_int Int.fract_sub_int
@[simp]
theorem fract_sub_nat (a : α) (n : ℕ) : fract (a - n) = fract a := by
rw [fract]
simp
#align int.fract_sub_nat Int.fract_sub_nat
@[simp]
theorem fract_sub_one (a : α) : fract (a - 1) = fract a := mod_cast fract_sub_nat a 1
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem fract_sub_ofNat (a : α) (n : ℕ) [n.AtLeastTwo] :
fract (a - (no_index (OfNat.ofNat n))) = fract a :=
fract_sub_nat a n
-- Was a duplicate lemma under a bad name
#align int.fract_int_nat Int.fract_int_add
theorem fract_add_le (a b : α) : fract (a + b) ≤ fract a + fract b := by
rw [fract, fract, fract, sub_add_sub_comm, sub_le_sub_iff_left, ← Int.cast_add, Int.cast_le]
exact le_floor_add _ _
#align int.fract_add_le Int.fract_add_le
theorem fract_add_fract_le (a b : α) : fract a + fract b ≤ fract (a + b) + 1 := by
rw [fract, fract, fract, sub_add_sub_comm, sub_add, sub_le_sub_iff_left]
exact mod_cast le_floor_add_floor a b
#align int.fract_add_fract_le Int.fract_add_fract_le
@[simp]
theorem self_sub_fract (a : α) : a - fract a = ⌊a⌋ :=
sub_sub_cancel _ _
#align int.self_sub_fract Int.self_sub_fract
@[simp]
theorem fract_sub_self (a : α) : fract a - a = -⌊a⌋ :=
sub_sub_cancel_left _ _
#align int.fract_sub_self Int.fract_sub_self
@[simp]
theorem fract_nonneg (a : α) : 0 ≤ fract a :=
sub_nonneg.2 <| floor_le _
#align int.fract_nonneg Int.fract_nonneg
lemma fract_pos : 0 < fract a ↔ a ≠ ⌊a⌋ :=
(fract_nonneg a).lt_iff_ne.trans <| ne_comm.trans sub_ne_zero
#align int.fract_pos Int.fract_pos
theorem fract_lt_one (a : α) : fract a < 1 :=
sub_lt_comm.1 <| sub_one_lt_floor _
#align int.fract_lt_one Int.fract_lt_one
@[simp]
theorem fract_zero : fract (0 : α) = 0 := by rw [fract, floor_zero, cast_zero, sub_self]
#align int.fract_zero Int.fract_zero
@[simp]
theorem fract_one : fract (1 : α) = 0 := by simp [fract]
#align int.fract_one Int.fract_one
theorem abs_fract : |fract a| = fract a :=
abs_eq_self.mpr <| fract_nonneg a
#align int.abs_fract Int.abs_fract
@[simp]
theorem abs_one_sub_fract : |1 - fract a| = 1 - fract a :=
abs_eq_self.mpr <| sub_nonneg.mpr (fract_lt_one a).le
#align int.abs_one_sub_fract Int.abs_one_sub_fract
@[simp]
theorem fract_intCast (z : ℤ) : fract (z : α) = 0 := by
unfold fract
rw [floor_intCast]
exact sub_self _
#align int.fract_int_cast Int.fract_intCast
@[simp]
theorem fract_natCast (n : ℕ) : fract (n : α) = 0 := by simp [fract]
#align int.fract_nat_cast Int.fract_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem fract_ofNat (n : ℕ) [n.AtLeastTwo] :
fract ((no_index (OfNat.ofNat n)) : α) = 0 :=
fract_natCast n
-- porting note (#10618): simp can prove this
-- @[simp]
theorem fract_floor (a : α) : fract (⌊a⌋ : α) = 0 :=
fract_intCast _
#align int.fract_floor Int.fract_floor
@[simp]
theorem floor_fract (a : α) : ⌊fract a⌋ = 0 := by
rw [floor_eq_iff, Int.cast_zero, zero_add]; exact ⟨fract_nonneg _, fract_lt_one _⟩
#align int.floor_fract Int.floor_fract
theorem fract_eq_iff {a b : α} : fract a = b ↔ 0 ≤ b ∧ b < 1 ∧ ∃ z : ℤ, a - b = z :=
⟨fun h => by
rw [← h]
exact ⟨fract_nonneg _, fract_lt_one _, ⟨⌊a⌋, sub_sub_cancel _ _⟩⟩,
by
rintro ⟨h₀, h₁, z, hz⟩
rw [← self_sub_floor, eq_comm, eq_sub_iff_add_eq, add_comm, ← eq_sub_iff_add_eq, hz,
Int.cast_inj, floor_eq_iff, ← hz]
constructor <;> simpa [sub_eq_add_neg, add_assoc] ⟩
#align int.fract_eq_iff Int.fract_eq_iff
theorem fract_eq_fract {a b : α} : fract a = fract b ↔ ∃ z : ℤ, a - b = z :=
⟨fun h => ⟨⌊a⌋ - ⌊b⌋, by unfold fract at h; rw [Int.cast_sub, sub_eq_sub_iff_sub_eq_sub.1 h]⟩,
by
rintro ⟨z, hz⟩
refine fract_eq_iff.2 ⟨fract_nonneg _, fract_lt_one _, z + ⌊b⌋, ?_⟩
rw [eq_add_of_sub_eq hz, add_comm, Int.cast_add]
exact add_sub_sub_cancel _ _ _⟩
#align int.fract_eq_fract Int.fract_eq_fract
@[simp]
theorem fract_eq_self {a : α} : fract a = a ↔ 0 ≤ a ∧ a < 1 :=
fract_eq_iff.trans <| and_assoc.symm.trans <| and_iff_left ⟨0, by simp⟩
#align int.fract_eq_self Int.fract_eq_self
@[simp]
theorem fract_fract (a : α) : fract (fract a) = fract a :=
fract_eq_self.2 ⟨fract_nonneg _, fract_lt_one _⟩
#align int.fract_fract Int.fract_fract
theorem fract_add (a b : α) : ∃ z : ℤ, fract (a + b) - fract a - fract b = z :=
⟨⌊a⌋ + ⌊b⌋ - ⌊a + b⌋, by
unfold fract
simp only [sub_eq_add_neg, neg_add_rev, neg_neg, cast_add, cast_neg]
abel⟩
#align int.fract_add Int.fract_add
theorem fract_neg {x : α} (hx : fract x ≠ 0) : fract (-x) = 1 - fract x := by
rw [fract_eq_iff]
constructor
· rw [le_sub_iff_add_le, zero_add]
exact (fract_lt_one x).le
refine ⟨sub_lt_self _ (lt_of_le_of_ne' (fract_nonneg x) hx), -⌊x⌋ - 1, ?_⟩
simp only [sub_sub_eq_add_sub, cast_sub, cast_neg, cast_one, sub_left_inj]
conv in -x => rw [← floor_add_fract x]
simp [-floor_add_fract]
#align int.fract_neg Int.fract_neg
@[simp]
theorem fract_neg_eq_zero {x : α} : fract (-x) = 0 ↔ fract x = 0 := by
simp only [fract_eq_iff, le_refl, zero_lt_one, tsub_zero, true_and_iff]
constructor <;> rintro ⟨z, hz⟩ <;> use -z <;> simp [← hz]
#align int.fract_neg_eq_zero Int.fract_neg_eq_zero
theorem fract_mul_nat (a : α) (b : ℕ) : ∃ z : ℤ, fract a * b - fract (a * b) = z := by
induction' b with c hc
· use 0; simp
· rcases hc with ⟨z, hz⟩
rw [Nat.cast_add, mul_add, mul_add, Nat.cast_one, mul_one, mul_one]
rcases fract_add (a * c) a with ⟨y, hy⟩
use z - y
rw [Int.cast_sub, ← hz, ← hy]
abel
#align int.fract_mul_nat Int.fract_mul_nat
-- Porting note: in mathlib3 there was no need for the type annotation in `(m:α)`
theorem preimage_fract (s : Set α) :
fract ⁻¹' s = ⋃ m : ℤ, (fun x => x - (m:α)) ⁻¹' (s ∩ Ico (0 : α) 1) := by
ext x
simp only [mem_preimage, mem_iUnion, mem_inter_iff]
refine ⟨fun h => ⟨⌊x⌋, h, fract_nonneg x, fract_lt_one x⟩, ?_⟩
rintro ⟨m, hms, hm0, hm1⟩
obtain rfl : ⌊x⌋ = m := floor_eq_iff.2 ⟨sub_nonneg.1 hm0, sub_lt_iff_lt_add'.1 hm1⟩
exact hms
#align int.preimage_fract Int.preimage_fract
theorem image_fract (s : Set α) : fract '' s = ⋃ m : ℤ, (fun x : α => x - m) '' s ∩ Ico 0 1 := by
ext x
simp only [mem_image, mem_inter_iff, mem_iUnion]; constructor
· rintro ⟨y, hy, rfl⟩
exact ⟨⌊y⌋, ⟨y, hy, rfl⟩, fract_nonneg y, fract_lt_one y⟩
· rintro ⟨m, ⟨y, hys, rfl⟩, h0, h1⟩
obtain rfl : ⌊y⌋ = m := floor_eq_iff.2 ⟨sub_nonneg.1 h0, sub_lt_iff_lt_add'.1 h1⟩
exact ⟨y, hys, rfl⟩
#align int.image_fract Int.image_fract
open Int
section round
section LinearOrderedRing
variable [LinearOrderedRing α] [FloorRing α]
def round (x : α) : ℤ :=
if 2 * fract x < 1 then ⌊x⌋ else ⌈x⌉
#align round round
@[simp]
theorem round_zero : round (0 : α) = 0 := by simp [round]
#align round_zero round_zero
@[simp]
theorem round_one : round (1 : α) = 1 := by simp [round]
#align round_one round_one
@[simp]
theorem round_natCast (n : ℕ) : round (n : α) = n := by simp [round]
#align round_nat_cast round_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem round_ofNat (n : ℕ) [n.AtLeastTwo] : round (no_index (OfNat.ofNat n : α)) = n :=
round_natCast n
@[simp]
theorem round_intCast (n : ℤ) : round (n : α) = n := by simp [round]
#align round_int_cast round_intCast
@[simp]
theorem round_add_int (x : α) (y : ℤ) : round (x + y) = round x + y := by
rw [round, round, Int.fract_add_int, Int.floor_add_int, Int.ceil_add_int, ← apply_ite₂, ite_self]
#align round_add_int round_add_int
@[simp]
theorem round_add_one (a : α) : round (a + 1) = round a + 1 := by
-- Porting note: broken `convert round_add_int a 1`
rw [← round_add_int a 1, cast_one]
#align round_add_one round_add_one
@[simp]
theorem round_sub_int (x : α) (y : ℤ) : round (x - y) = round x - y := by
rw [sub_eq_add_neg]
norm_cast
rw [round_add_int, sub_eq_add_neg]
#align round_sub_int round_sub_int
@[simp]
theorem round_sub_one (a : α) : round (a - 1) = round a - 1 := by
-- Porting note: broken `convert round_sub_int a 1`
rw [← round_sub_int a 1, cast_one]
#align round_sub_one round_sub_one
@[simp]
theorem round_add_nat (x : α) (y : ℕ) : round (x + y) = round x + y :=
mod_cast round_add_int x y
#align round_add_nat round_add_nat
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem round_add_ofNat (x : α) (n : ℕ) [n.AtLeastTwo] :
round (x + (no_index (OfNat.ofNat n))) = round x + OfNat.ofNat n :=
round_add_nat x n
@[simp]
theorem round_sub_nat (x : α) (y : ℕ) : round (x - y) = round x - y :=
mod_cast round_sub_int x y
#align round_sub_nat round_sub_nat
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem round_sub_ofNat (x : α) (n : ℕ) [n.AtLeastTwo] :
round (x - (no_index (OfNat.ofNat n))) = round x - OfNat.ofNat n :=
round_sub_nat x n
@[simp]
theorem round_int_add (x : α) (y : ℤ) : round ((y : α) + x) = y + round x := by
rw [add_comm, round_add_int, add_comm]
#align round_int_add round_int_add
@[simp]
theorem round_nat_add (x : α) (y : ℕ) : round ((y : α) + x) = y + round x := by
rw [add_comm, round_add_nat, add_comm]
#align round_nat_add round_nat_add
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem round_ofNat_add (n : ℕ) [n.AtLeastTwo] (x : α) :
round ((no_index (OfNat.ofNat n)) + x) = OfNat.ofNat n + round x :=
round_nat_add x n
theorem abs_sub_round_eq_min (x : α) : |x - round x| = min (fract x) (1 - fract x) := by
simp_rw [round, min_def_lt, two_mul, ← lt_tsub_iff_left]
cases' lt_or_ge (fract x) (1 - fract x) with hx hx
· rw [if_pos hx, if_pos hx, self_sub_floor, abs_fract]
· have : 0 < fract x := by
replace hx : 0 < fract x + fract x := lt_of_lt_of_le zero_lt_one (tsub_le_iff_left.mp hx)
simpa only [← two_mul, mul_pos_iff_of_pos_left, zero_lt_two] using hx
rw [if_neg (not_lt.mpr hx), if_neg (not_lt.mpr hx), abs_sub_comm, ceil_sub_self_eq this.ne.symm,
abs_one_sub_fract]
#align abs_sub_round_eq_min abs_sub_round_eq_min
| Mathlib/Algebra/Order/Floor.lean | 1,546 | 1,556 | theorem round_le (x : α) (z : ℤ) : |x - round x| ≤ |x - z| := by |
rw [abs_sub_round_eq_min, min_le_iff]
rcases le_or_lt (z : α) x with (hx | hx) <;> [left; right]
· conv_rhs => rw [abs_eq_self.mpr (sub_nonneg.mpr hx), ← fract_add_floor x, add_sub_assoc]
simpa only [le_add_iff_nonneg_right, sub_nonneg, cast_le] using le_floor.mpr hx
· rw [abs_eq_neg_self.mpr (sub_neg.mpr hx).le]
conv_rhs => rw [← fract_add_floor x]
rw [add_sub_assoc, add_comm, neg_add, neg_sub, le_add_neg_iff_add_le, sub_add_cancel,
le_sub_comm]
norm_cast
exact floor_le_sub_one_iff.mpr hx
|
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Ring.Action.Basic
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Algebra.Group.Hom.CompTypeclasses
#align_import algebra.hom.group_action from "leanprover-community/mathlib"@"e7bab9a85e92cf46c02cb4725a7be2f04691e3a7"
assert_not_exists Submonoid
section DistribMulAction
variable {M : Type*} [Monoid M]
variable {N : Type*} [Monoid N]
variable {P : Type*} [Monoid P]
variable (φ: M →* N) (φ' : N →* M) (ψ : N →* P) (χ : M →* P)
variable (A : Type*) [AddMonoid A] [DistribMulAction M A]
variable (B : Type*) [AddMonoid B] [DistribMulAction N B]
variable (B₁ : Type*) [AddMonoid B₁] [DistribMulAction M B₁]
variable (C : Type*) [AddMonoid C] [DistribMulAction P C]
variable (A' : Type*) [AddGroup A'] [DistribMulAction M A']
variable (B' : Type*) [AddGroup B'] [DistribMulAction N B']
structure DistribMulActionHom extends A →ₑ[φ] B, A →+ B
#align distrib_mul_action_hom DistribMulActionHom
add_decl_doc DistribMulActionHom.toAddMonoidHom
#align distrib_mul_action_hom.to_add_monoid_hom DistribMulActionHom.toAddMonoidHom
add_decl_doc DistribMulActionHom.toMulActionHom
#align distrib_mul_action_hom.to_mul_action_hom DistribMulActionHom.toMulActionHom
@[inherit_doc]
notation:25 (name := «DistribMulActionHomLocal≺»)
A " →ₑ+[" φ:25 "] " B:0 => DistribMulActionHom φ A B
@[inherit_doc]
notation:25 (name := «DistribMulActionHomIdLocal≺»)
A " →+[" M:25 "] " B:0 => DistribMulActionHom (MonoidHom.id M) A B
-- QUESTION/TODO : Impose that `φ` is a morphism of monoids?
class DistribMulActionSemiHomClass (F : Type*)
{M N : outParam Type*} (φ : outParam (M → N))
(A B : outParam Type*)
[Monoid M] [Monoid N]
[AddMonoid A] [AddMonoid B] [DistribMulAction M A] [DistribMulAction N B]
[FunLike F A B]
extends MulActionSemiHomClass F φ A B, AddMonoidHomClass F A B : Prop
#align distrib_mul_action_hom_class DistribMulActionSemiHomClass
abbrev DistribMulActionHomClass (F : Type*) (M : outParam Type*)
(A B : outParam Type*) [Monoid M] [AddMonoid A] [AddMonoid B]
[DistribMulAction M A] [DistribMulAction M B] [FunLike F A B] :=
DistribMulActionSemiHomClass F (MonoidHom.id M) A B
namespace DistribMulActionHom
-- instance coe : Coe (A →+[M] B) (A →+ B) :=
-- ⟨toAddMonoidHom⟩
-- #align distrib_mul_action_hom.has_coe DistribMulActionHom.coe
-- instance coe' : Coe (A →+[M] B) (A →[M] B) :=
-- ⟨toMulActionHom⟩
-- #align distrib_mul_action_hom.has_coe' DistribMulActionHom.coe'
#noalign distrib_mul_action_hom.has_coe
#noalign distrib_mul_action_hom.has_coe'
#noalign distrib_mul_action_hom.has_coe_to_fun
instance : FunLike (A →ₑ+[φ] B) A B where
coe m := m.toFun
coe_injective' f g h := by
rcases f with ⟨tF, _, _⟩; rcases g with ⟨tG, _, _⟩
cases tF; cases tG; congr
instance : DistribMulActionSemiHomClass (A →ₑ+[φ] B) φ A B where
map_smulₛₗ m := m.map_smul'
map_zero := DistribMulActionHom.map_zero'
map_add := DistribMulActionHom.map_add'
variable {φ φ' A B B₁}
variable {F : Type*} [FunLike F A B]
@[coe]
def _root_.DistribMulActionSemiHomClass.toDistribMulActionHom
[DistribMulActionSemiHomClass F φ A B]
(f : F) : A →ₑ+[φ] B :=
{ (f : A →+ B), (f : A →ₑ[φ] B) with }
instance [DistribMulActionSemiHomClass F φ A B] :
CoeTC F (A →ₑ+[φ] B) :=
⟨DistribMulActionSemiHomClass.toDistribMulActionHom⟩
@[simps]
def _root_.SMulCommClass.toDistribMulActionHom {M} (N A : Type*) [Monoid N] [AddMonoid A]
[DistribSMul M A] [DistribMulAction N A] [SMulCommClass M N A] (c : M) : A →+[N] A :=
{ SMulCommClass.toMulActionHom N A c,
DistribSMul.toAddMonoidHom _ c with
toFun := (c • ·) }
@[simp]
theorem toFun_eq_coe (f : A →ₑ+[φ] B) : f.toFun = f := rfl
#align distrib_mul_action_hom.to_fun_eq_coe DistribMulActionHom.toFun_eq_coe
@[norm_cast]
theorem coe_fn_coe (f : A →ₑ+[φ] B) : ⇑(f : A →+ B) = f :=
rfl
#align distrib_mul_action_hom.coe_fn_coe DistribMulActionHom.coe_fn_coe
@[norm_cast]
theorem coe_fn_coe' (f : A →ₑ+[φ] B) : ⇑(f : A →ₑ[φ] B) = f :=
rfl
#align distrib_mul_action_hom.coe_fn_coe' DistribMulActionHom.coe_fn_coe'
@[ext]
theorem ext {f g : A →ₑ+[φ] B} : (∀ x, f x = g x) → f = g :=
DFunLike.ext f g
#align distrib_mul_action_hom.ext DistribMulActionHom.ext
theorem ext_iff {f g : A →ₑ+[φ] B} : f = g ↔ ∀ x, f x = g x :=
DFunLike.ext_iff
#align distrib_mul_action_hom.ext_iff DistribMulActionHom.ext_iff
protected theorem congr_fun {f g : A →ₑ+[φ] B} (h : f = g) (x : A) : f x = g x :=
DFunLike.congr_fun h _
#align distrib_mul_action_hom.congr_fun DistribMulActionHom.congr_fun
| Mathlib/GroupTheory/GroupAction/Hom.lean | 473 | 476 | theorem toMulActionHom_injective {f g : A →ₑ+[φ] B} (h : (f : A →ₑ[φ] B) = (g : A →ₑ[φ] B)) :
f = g := by |
ext a
exact MulActionHom.congr_fun h a
|
import Mathlib.Algebra.BigOperators.Option
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Data.Set.Pairwise.Lattice
#align_import analysis.box_integral.partition.basic from "leanprover-community/mathlib"@"84dc0bd6619acaea625086d6f53cb35cdd554219"
open Set Finset Function
open scoped Classical
open NNReal
noncomputable section
namespace BoxIntegral
variable {ι : Type*}
structure Prepartition (I : Box ι) where
boxes : Finset (Box ι)
le_of_mem' : ∀ J ∈ boxes, J ≤ I
pairwiseDisjoint : Set.Pairwise (↑boxes) (Disjoint on ((↑) : Box ι → Set (ι → ℝ)))
#align box_integral.prepartition BoxIntegral.Prepartition
namespace Prepartition
variable {I J J₁ J₂ : Box ι} (π : Prepartition I) {π₁ π₂ : Prepartition I} {x : ι → ℝ}
instance : Membership (Box ι) (Prepartition I) :=
⟨fun J π => J ∈ π.boxes⟩
@[simp]
theorem mem_boxes : J ∈ π.boxes ↔ J ∈ π := Iff.rfl
#align box_integral.prepartition.mem_boxes BoxIntegral.Prepartition.mem_boxes
@[simp]
theorem mem_mk {s h₁ h₂} : J ∈ (mk s h₁ h₂ : Prepartition I) ↔ J ∈ s := Iff.rfl
#align box_integral.prepartition.mem_mk BoxIntegral.Prepartition.mem_mk
theorem disjoint_coe_of_mem (h₁ : J₁ ∈ π) (h₂ : J₂ ∈ π) (h : J₁ ≠ J₂) :
Disjoint (J₁ : Set (ι → ℝ)) J₂ :=
π.pairwiseDisjoint h₁ h₂ h
#align box_integral.prepartition.disjoint_coe_of_mem BoxIntegral.Prepartition.disjoint_coe_of_mem
theorem eq_of_mem_of_mem (h₁ : J₁ ∈ π) (h₂ : J₂ ∈ π) (hx₁ : x ∈ J₁) (hx₂ : x ∈ J₂) : J₁ = J₂ :=
by_contra fun H => (π.disjoint_coe_of_mem h₁ h₂ H).le_bot ⟨hx₁, hx₂⟩
#align box_integral.prepartition.eq_of_mem_of_mem BoxIntegral.Prepartition.eq_of_mem_of_mem
theorem eq_of_le_of_le (h₁ : J₁ ∈ π) (h₂ : J₂ ∈ π) (hle₁ : J ≤ J₁) (hle₂ : J ≤ J₂) : J₁ = J₂ :=
π.eq_of_mem_of_mem h₁ h₂ (hle₁ J.upper_mem) (hle₂ J.upper_mem)
#align box_integral.prepartition.eq_of_le_of_le BoxIntegral.Prepartition.eq_of_le_of_le
theorem eq_of_le (h₁ : J₁ ∈ π) (h₂ : J₂ ∈ π) (hle : J₁ ≤ J₂) : J₁ = J₂ :=
π.eq_of_le_of_le h₁ h₂ le_rfl hle
#align box_integral.prepartition.eq_of_le BoxIntegral.Prepartition.eq_of_le
theorem le_of_mem (hJ : J ∈ π) : J ≤ I :=
π.le_of_mem' J hJ
#align box_integral.prepartition.le_of_mem BoxIntegral.Prepartition.le_of_mem
theorem lower_le_lower (hJ : J ∈ π) : I.lower ≤ J.lower :=
Box.antitone_lower (π.le_of_mem hJ)
#align box_integral.prepartition.lower_le_lower BoxIntegral.Prepartition.lower_le_lower
theorem upper_le_upper (hJ : J ∈ π) : J.upper ≤ I.upper :=
Box.monotone_upper (π.le_of_mem hJ)
#align box_integral.prepartition.upper_le_upper BoxIntegral.Prepartition.upper_le_upper
theorem injective_boxes : Function.Injective (boxes : Prepartition I → Finset (Box ι)) := by
rintro ⟨s₁, h₁, h₁'⟩ ⟨s₂, h₂, h₂'⟩ (rfl : s₁ = s₂)
rfl
#align box_integral.prepartition.injective_boxes BoxIntegral.Prepartition.injective_boxes
@[ext]
theorem ext (h : ∀ J, J ∈ π₁ ↔ J ∈ π₂) : π₁ = π₂ :=
injective_boxes <| Finset.ext h
#align box_integral.prepartition.ext BoxIntegral.Prepartition.ext
@[simps]
def single (I J : Box ι) (h : J ≤ I) : Prepartition I :=
⟨{J}, by simpa, by simp⟩
#align box_integral.prepartition.single BoxIntegral.Prepartition.single
@[simp]
theorem mem_single {J'} (h : J ≤ I) : J' ∈ single I J h ↔ J' = J :=
mem_singleton
#align box_integral.prepartition.mem_single BoxIntegral.Prepartition.mem_single
instance : LE (Prepartition I) :=
⟨fun π π' => ∀ ⦃I⦄, I ∈ π → ∃ I' ∈ π', I ≤ I'⟩
instance partialOrder : PartialOrder (Prepartition I) where
le := (· ≤ ·)
le_refl π I hI := ⟨I, hI, le_rfl⟩
le_trans π₁ π₂ π₃ h₁₂ h₂₃ I₁ hI₁ :=
let ⟨I₂, hI₂, hI₁₂⟩ := h₁₂ hI₁
let ⟨I₃, hI₃, hI₂₃⟩ := h₂₃ hI₂
⟨I₃, hI₃, hI₁₂.trans hI₂₃⟩
le_antisymm := by
suffices ∀ {π₁ π₂ : Prepartition I}, π₁ ≤ π₂ → π₂ ≤ π₁ → π₁.boxes ⊆ π₂.boxes from
fun π₁ π₂ h₁ h₂ => injective_boxes (Subset.antisymm (this h₁ h₂) (this h₂ h₁))
intro π₁ π₂ h₁ h₂ J hJ
rcases h₁ hJ with ⟨J', hJ', hle⟩; rcases h₂ hJ' with ⟨J'', hJ'', hle'⟩
obtain rfl : J = J'' := π₁.eq_of_le hJ hJ'' (hle.trans hle')
obtain rfl : J' = J := le_antisymm ‹_› ‹_›
assumption
instance : OrderTop (Prepartition I) where
top := single I I le_rfl
le_top π J hJ := ⟨I, by simp, π.le_of_mem hJ⟩
instance : OrderBot (Prepartition I) where
bot := ⟨∅,
fun _ hJ => (Finset.not_mem_empty _ hJ).elim,
fun _ hJ => (Set.not_mem_empty _ <| Finset.coe_empty ▸ hJ).elim⟩
bot_le _ _ hJ := (Finset.not_mem_empty _ hJ).elim
instance : Inhabited (Prepartition I) := ⟨⊤⟩
theorem le_def : π₁ ≤ π₂ ↔ ∀ J ∈ π₁, ∃ J' ∈ π₂, J ≤ J' := Iff.rfl
#align box_integral.prepartition.le_def BoxIntegral.Prepartition.le_def
@[simp]
theorem mem_top : J ∈ (⊤ : Prepartition I) ↔ J = I :=
mem_singleton
#align box_integral.prepartition.mem_top BoxIntegral.Prepartition.mem_top
@[simp]
theorem top_boxes : (⊤ : Prepartition I).boxes = {I} := rfl
#align box_integral.prepartition.top_boxes BoxIntegral.Prepartition.top_boxes
@[simp]
theorem not_mem_bot : J ∉ (⊥ : Prepartition I) :=
Finset.not_mem_empty _
#align box_integral.prepartition.not_mem_bot BoxIntegral.Prepartition.not_mem_bot
@[simp]
theorem bot_boxes : (⊥ : Prepartition I).boxes = ∅ := rfl
#align box_integral.prepartition.bot_boxes BoxIntegral.Prepartition.bot_boxes
theorem injOn_setOf_mem_Icc_setOf_lower_eq (x : ι → ℝ) :
InjOn (fun J : Box ι => { i | J.lower i = x i }) { J | J ∈ π ∧ x ∈ Box.Icc J } := by
rintro J₁ ⟨h₁, hx₁⟩ J₂ ⟨h₂, hx₂⟩ (H : { i | J₁.lower i = x i } = { i | J₂.lower i = x i })
suffices ∀ i, (Ioc (J₁.lower i) (J₁.upper i) ∩ Ioc (J₂.lower i) (J₂.upper i)).Nonempty by
choose y hy₁ hy₂ using this
exact π.eq_of_mem_of_mem h₁ h₂ hy₁ hy₂
intro i
simp only [Set.ext_iff, mem_setOf] at H
rcases (hx₁.1 i).eq_or_lt with hi₁ | hi₁
· have hi₂ : J₂.lower i = x i := (H _).1 hi₁
have H₁ : x i < J₁.upper i := by simpa only [hi₁] using J₁.lower_lt_upper i
have H₂ : x i < J₂.upper i := by simpa only [hi₂] using J₂.lower_lt_upper i
rw [Ioc_inter_Ioc, hi₁, hi₂, sup_idem, Set.nonempty_Ioc]
exact lt_min H₁ H₂
· have hi₂ : J₂.lower i < x i := (hx₂.1 i).lt_of_ne (mt (H _).2 hi₁.ne)
exact ⟨x i, ⟨hi₁, hx₁.2 i⟩, ⟨hi₂, hx₂.2 i⟩⟩
#align box_integral.prepartition.inj_on_set_of_mem_Icc_set_of_lower_eq BoxIntegral.Prepartition.injOn_setOf_mem_Icc_setOf_lower_eq
theorem card_filter_mem_Icc_le [Fintype ι] (x : ι → ℝ) :
(π.boxes.filter fun J : Box ι => x ∈ Box.Icc J).card ≤ 2 ^ Fintype.card ι := by
rw [← Fintype.card_set]
refine Finset.card_le_card_of_inj_on (fun J : Box ι => { i | J.lower i = x i })
(fun _ _ => Finset.mem_univ _) ?_
simpa only [Finset.mem_filter] using π.injOn_setOf_mem_Icc_setOf_lower_eq x
#align box_integral.prepartition.card_filter_mem_Icc_le BoxIntegral.Prepartition.card_filter_mem_Icc_le
protected def iUnion : Set (ι → ℝ) :=
⋃ J ∈ π, ↑J
#align box_integral.prepartition.Union BoxIntegral.Prepartition.iUnion
theorem iUnion_def : π.iUnion = ⋃ J ∈ π, ↑J := rfl
#align box_integral.prepartition.Union_def BoxIntegral.Prepartition.iUnion_def
theorem iUnion_def' : π.iUnion = ⋃ J ∈ π.boxes, ↑J := rfl
#align box_integral.prepartition.Union_def' BoxIntegral.Prepartition.iUnion_def'
-- Porting note: Previous proof was `:= Set.mem_iUnion₂`
@[simp]
theorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by
convert Set.mem_iUnion₂
rw [Box.mem_coe, exists_prop]
#align box_integral.prepartition.mem_Union BoxIntegral.Prepartition.mem_iUnion
@[simp]
theorem iUnion_single (h : J ≤ I) : (single I J h).iUnion = J := by simp [iUnion_def]
#align box_integral.prepartition.Union_single BoxIntegral.Prepartition.iUnion_single
@[simp]
theorem iUnion_top : (⊤ : Prepartition I).iUnion = I := by simp [Prepartition.iUnion]
#align box_integral.prepartition.Union_top BoxIntegral.Prepartition.iUnion_top
@[simp]
theorem iUnion_eq_empty : π₁.iUnion = ∅ ↔ π₁ = ⊥ := by
simp [← injective_boxes.eq_iff, Finset.ext_iff, Prepartition.iUnion, imp_false]
#align box_integral.prepartition.Union_eq_empty BoxIntegral.Prepartition.iUnion_eq_empty
@[simp]
theorem iUnion_bot : (⊥ : Prepartition I).iUnion = ∅ :=
iUnion_eq_empty.2 rfl
#align box_integral.prepartition.Union_bot BoxIntegral.Prepartition.iUnion_bot
theorem subset_iUnion (h : J ∈ π) : ↑J ⊆ π.iUnion :=
subset_biUnion_of_mem h
#align box_integral.prepartition.subset_Union BoxIntegral.Prepartition.subset_iUnion
theorem iUnion_subset : π.iUnion ⊆ I :=
iUnion₂_subset π.le_of_mem'
#align box_integral.prepartition.Union_subset BoxIntegral.Prepartition.iUnion_subset
@[mono]
theorem iUnion_mono (h : π₁ ≤ π₂) : π₁.iUnion ⊆ π₂.iUnion := fun _ hx =>
let ⟨_, hJ₁, hx⟩ := π₁.mem_iUnion.1 hx
let ⟨J₂, hJ₂, hle⟩ := h hJ₁
π₂.mem_iUnion.2 ⟨J₂, hJ₂, hle hx⟩
#align box_integral.prepartition.Union_mono BoxIntegral.Prepartition.iUnion_mono
theorem disjoint_boxes_of_disjoint_iUnion (h : Disjoint π₁.iUnion π₂.iUnion) :
Disjoint π₁.boxes π₂.boxes :=
Finset.disjoint_left.2 fun J h₁ h₂ =>
Disjoint.le_bot (h.mono (π₁.subset_iUnion h₁) (π₂.subset_iUnion h₂)) ⟨J.upper_mem, J.upper_mem⟩
#align box_integral.prepartition.disjoint_boxes_of_disjoint_Union BoxIntegral.Prepartition.disjoint_boxes_of_disjoint_iUnion
theorem le_iff_nonempty_imp_le_and_iUnion_subset :
π₁ ≤ π₂ ↔
(∀ J ∈ π₁, ∀ J' ∈ π₂, (J ∩ J' : Set (ι → ℝ)).Nonempty → J ≤ J') ∧ π₁.iUnion ⊆ π₂.iUnion := by
constructor
· refine fun H => ⟨fun J hJ J' hJ' Hne => ?_, iUnion_mono H⟩
rcases H hJ with ⟨J'', hJ'', Hle⟩
rcases Hne with ⟨x, hx, hx'⟩
rwa [π₂.eq_of_mem_of_mem hJ' hJ'' hx' (Hle hx)]
· rintro ⟨H, HU⟩ J hJ
simp only [Set.subset_def, mem_iUnion] at HU
rcases HU J.upper ⟨J, hJ, J.upper_mem⟩ with ⟨J₂, hJ₂, hx⟩
exact ⟨J₂, hJ₂, H _ hJ _ hJ₂ ⟨_, J.upper_mem, hx⟩⟩
#align box_integral.prepartition.le_iff_nonempty_imp_le_and_Union_subset BoxIntegral.Prepartition.le_iff_nonempty_imp_le_and_iUnion_subset
theorem eq_of_boxes_subset_iUnion_superset (h₁ : π₁.boxes ⊆ π₂.boxes) (h₂ : π₂.iUnion ⊆ π₁.iUnion) :
π₁ = π₂ :=
le_antisymm (fun J hJ => ⟨J, h₁ hJ, le_rfl⟩) <|
le_iff_nonempty_imp_le_and_iUnion_subset.2
⟨fun _ hJ₁ _ hJ₂ Hne =>
(π₂.eq_of_mem_of_mem hJ₁ (h₁ hJ₂) Hne.choose_spec.1 Hne.choose_spec.2).le, h₂⟩
#align box_integral.prepartition.eq_of_boxes_subset_Union_superset BoxIntegral.Prepartition.eq_of_boxes_subset_iUnion_superset
@[simps]
def biUnion (πi : ∀ J : Box ι, Prepartition J) : Prepartition I where
boxes := π.boxes.biUnion fun J => (πi J).boxes
le_of_mem' J hJ := by
simp only [Finset.mem_biUnion, exists_prop, mem_boxes] at hJ
rcases hJ with ⟨J', hJ', hJ⟩
exact ((πi J').le_of_mem hJ).trans (π.le_of_mem hJ')
pairwiseDisjoint := by
simp only [Set.Pairwise, Finset.mem_coe, Finset.mem_biUnion]
rintro J₁' ⟨J₁, hJ₁, hJ₁'⟩ J₂' ⟨J₂, hJ₂, hJ₂'⟩ Hne
rw [Function.onFun, Set.disjoint_left]
rintro x hx₁ hx₂; apply Hne
obtain rfl : J₁ = J₂ :=
π.eq_of_mem_of_mem hJ₁ hJ₂ ((πi J₁).le_of_mem hJ₁' hx₁) ((πi J₂).le_of_mem hJ₂' hx₂)
exact (πi J₁).eq_of_mem_of_mem hJ₁' hJ₂' hx₁ hx₂
#align box_integral.prepartition.bUnion BoxIntegral.Prepartition.biUnion
variable {πi πi₁ πi₂ : ∀ J : Box ι, Prepartition J}
@[simp]
theorem mem_biUnion : J ∈ π.biUnion πi ↔ ∃ J' ∈ π, J ∈ πi J' := by simp [biUnion]
#align box_integral.prepartition.mem_bUnion BoxIntegral.Prepartition.mem_biUnion
theorem biUnion_le (πi : ∀ J, Prepartition J) : π.biUnion πi ≤ π := fun _ hJ =>
let ⟨J', hJ', hJ⟩ := π.mem_biUnion.1 hJ
⟨J', hJ', (πi J').le_of_mem hJ⟩
#align box_integral.prepartition.bUnion_le BoxIntegral.Prepartition.biUnion_le
@[simp]
theorem biUnion_top : (π.biUnion fun _ => ⊤) = π := by
ext
simp
#align box_integral.prepartition.bUnion_top BoxIntegral.Prepartition.biUnion_top
@[congr]
theorem biUnion_congr (h : π₁ = π₂) (hi : ∀ J ∈ π₁, πi₁ J = πi₂ J) :
π₁.biUnion πi₁ = π₂.biUnion πi₂ := by
subst π₂
ext J
simp only [mem_biUnion]
constructor <;> exact fun ⟨J', h₁, h₂⟩ => ⟨J', h₁, hi J' h₁ ▸ h₂⟩
#align box_integral.prepartition.bUnion_congr BoxIntegral.Prepartition.biUnion_congr
theorem biUnion_congr_of_le (h : π₁ = π₂) (hi : ∀ J ≤ I, πi₁ J = πi₂ J) :
π₁.biUnion πi₁ = π₂.biUnion πi₂ :=
biUnion_congr h fun J hJ => hi J (π₁.le_of_mem hJ)
#align box_integral.prepartition.bUnion_congr_of_le BoxIntegral.Prepartition.biUnion_congr_of_le
@[simp]
theorem iUnion_biUnion (πi : ∀ J : Box ι, Prepartition J) :
(π.biUnion πi).iUnion = ⋃ J ∈ π, (πi J).iUnion := by simp [Prepartition.iUnion]
#align box_integral.prepartition.Union_bUnion BoxIntegral.Prepartition.iUnion_biUnion
@[simp]
theorem sum_biUnion_boxes {M : Type*} [AddCommMonoid M] (π : Prepartition I)
(πi : ∀ J, Prepartition J) (f : Box ι → M) :
(∑ J ∈ π.boxes.biUnion fun J => (πi J).boxes, f J) =
∑ J ∈ π.boxes, ∑ J' ∈ (πi J).boxes, f J' := by
refine Finset.sum_biUnion fun J₁ h₁ J₂ h₂ hne => Finset.disjoint_left.2 fun J' h₁' h₂' => ?_
exact hne (π.eq_of_le_of_le h₁ h₂ ((πi J₁).le_of_mem h₁') ((πi J₂).le_of_mem h₂'))
#align box_integral.prepartition.sum_bUnion_boxes BoxIntegral.Prepartition.sum_biUnion_boxes
def biUnionIndex (πi : ∀ (J : Box ι), Prepartition J) (J : Box ι) : Box ι :=
if hJ : J ∈ π.biUnion πi then (π.mem_biUnion.1 hJ).choose else I
#align box_integral.prepartition.bUnion_index BoxIntegral.Prepartition.biUnionIndex
theorem biUnionIndex_mem (hJ : J ∈ π.biUnion πi) : π.biUnionIndex πi J ∈ π := by
rw [biUnionIndex, dif_pos hJ]
exact (π.mem_biUnion.1 hJ).choose_spec.1
#align box_integral.prepartition.bUnion_index_mem BoxIntegral.Prepartition.biUnionIndex_mem
theorem biUnionIndex_le (πi : ∀ J, Prepartition J) (J : Box ι) : π.biUnionIndex πi J ≤ I := by
by_cases hJ : J ∈ π.biUnion πi
· exact π.le_of_mem (π.biUnionIndex_mem hJ)
· rw [biUnionIndex, dif_neg hJ]
#align box_integral.prepartition.bUnion_index_le BoxIntegral.Prepartition.biUnionIndex_le
theorem mem_biUnionIndex (hJ : J ∈ π.biUnion πi) : J ∈ πi (π.biUnionIndex πi J) := by
convert (π.mem_biUnion.1 hJ).choose_spec.2 <;> exact dif_pos hJ
#align box_integral.prepartition.mem_bUnion_index BoxIntegral.Prepartition.mem_biUnionIndex
theorem le_biUnionIndex (hJ : J ∈ π.biUnion πi) : J ≤ π.biUnionIndex πi J :=
le_of_mem _ (π.mem_biUnionIndex hJ)
#align box_integral.prepartition.le_bUnion_index BoxIntegral.Prepartition.le_biUnionIndex
theorem biUnionIndex_of_mem (hJ : J ∈ π) {J'} (hJ' : J' ∈ πi J) : π.biUnionIndex πi J' = J :=
have : J' ∈ π.biUnion πi := π.mem_biUnion.2 ⟨J, hJ, hJ'⟩
π.eq_of_le_of_le (π.biUnionIndex_mem this) hJ (π.le_biUnionIndex this) (le_of_mem _ hJ')
#align box_integral.prepartition.bUnion_index_of_mem BoxIntegral.Prepartition.biUnionIndex_of_mem
theorem biUnion_assoc (πi : ∀ J, Prepartition J) (πi' : Box ι → ∀ J : Box ι, Prepartition J) :
(π.biUnion fun J => (πi J).biUnion (πi' J)) =
(π.biUnion πi).biUnion fun J => πi' (π.biUnionIndex πi J) J := by
ext J
simp only [mem_biUnion, exists_prop]
constructor
· rintro ⟨J₁, hJ₁, J₂, hJ₂, hJ⟩
refine ⟨J₂, ⟨J₁, hJ₁, hJ₂⟩, ?_⟩
rwa [π.biUnionIndex_of_mem hJ₁ hJ₂]
· rintro ⟨J₁, ⟨J₂, hJ₂, hJ₁⟩, hJ⟩
refine ⟨J₂, hJ₂, J₁, hJ₁, ?_⟩
rwa [π.biUnionIndex_of_mem hJ₂ hJ₁] at hJ
#align box_integral.prepartition.bUnion_assoc BoxIntegral.Prepartition.biUnion_assoc
def ofWithBot (boxes : Finset (WithBot (Box ι)))
(le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I)
(pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint) :
Prepartition I where
boxes := Finset.eraseNone boxes
le_of_mem' J hJ := by
rw [mem_eraseNone] at hJ
simpa only [WithBot.some_eq_coe, WithBot.coe_le_coe] using le_of_mem _ hJ
pairwiseDisjoint J₁ h₁ J₂ h₂ hne := by
simp only [mem_coe, mem_eraseNone] at h₁ h₂
exact Box.disjoint_coe.1 (pairwise_disjoint h₁ h₂ (mt Option.some_inj.1 hne))
#align box_integral.prepartition.of_with_bot BoxIntegral.Prepartition.ofWithBot
@[simp]
theorem mem_ofWithBot {boxes : Finset (WithBot (Box ι))} {h₁ h₂} :
J ∈ (ofWithBot boxes h₁ h₂ : Prepartition I) ↔ (J : WithBot (Box ι)) ∈ boxes :=
mem_eraseNone
#align box_integral.prepartition.mem_of_with_bot BoxIntegral.Prepartition.mem_ofWithBot
@[simp]
theorem iUnion_ofWithBot (boxes : Finset (WithBot (Box ι)))
(le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I)
(pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint) :
(ofWithBot boxes le_of_mem pairwise_disjoint).iUnion = ⋃ J ∈ boxes, ↑J := by
suffices ⋃ (J : Box ι) (_ : ↑J ∈ boxes), ↑J = ⋃ J ∈ boxes, (J : Set (ι → ℝ)) by
simpa [ofWithBot, Prepartition.iUnion]
simp only [← Box.biUnion_coe_eq_coe, @iUnion_comm _ _ (Box ι), @iUnion_comm _ _ (@Eq _ _ _),
iUnion_iUnion_eq_right]
#align box_integral.prepartition.Union_of_with_bot BoxIntegral.Prepartition.iUnion_ofWithBot
theorem ofWithBot_le {boxes : Finset (WithBot (Box ι))}
{le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I}
{pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint}
(H : ∀ J ∈ boxes, J ≠ ⊥ → ∃ J' ∈ π, J ≤ ↑J') :
ofWithBot boxes le_of_mem pairwise_disjoint ≤ π := by
have : ∀ J : Box ι, ↑J ∈ boxes → ∃ J' ∈ π, J ≤ J' := fun J hJ => by
simpa only [WithBot.coe_le_coe] using H J hJ WithBot.coe_ne_bot
simpa [ofWithBot, le_def]
#align box_integral.prepartition.of_with_bot_le BoxIntegral.Prepartition.ofWithBot_le
theorem le_ofWithBot {boxes : Finset (WithBot (Box ι))}
{le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I}
{pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint}
(H : ∀ J ∈ π, ∃ J' ∈ boxes, ↑J ≤ J') : π ≤ ofWithBot boxes le_of_mem pairwise_disjoint := by
intro J hJ
rcases H J hJ with ⟨J', J'mem, hle⟩
lift J' to Box ι using ne_bot_of_le_ne_bot WithBot.coe_ne_bot hle
exact ⟨J', mem_ofWithBot.2 J'mem, WithBot.coe_le_coe.1 hle⟩
#align box_integral.prepartition.le_of_with_bot BoxIntegral.Prepartition.le_ofWithBot
theorem ofWithBot_mono {boxes₁ : Finset (WithBot (Box ι))}
{le_of_mem₁ : ∀ J ∈ boxes₁, (J : WithBot (Box ι)) ≤ I}
{pairwise_disjoint₁ : Set.Pairwise (boxes₁ : Set (WithBot (Box ι))) Disjoint}
{boxes₂ : Finset (WithBot (Box ι))} {le_of_mem₂ : ∀ J ∈ boxes₂, (J : WithBot (Box ι)) ≤ I}
{pairwise_disjoint₂ : Set.Pairwise (boxes₂ : Set (WithBot (Box ι))) Disjoint}
(H : ∀ J ∈ boxes₁, J ≠ ⊥ → ∃ J' ∈ boxes₂, J ≤ J') :
ofWithBot boxes₁ le_of_mem₁ pairwise_disjoint₁ ≤
ofWithBot boxes₂ le_of_mem₂ pairwise_disjoint₂ :=
le_ofWithBot _ fun J hJ => H J (mem_ofWithBot.1 hJ) WithBot.coe_ne_bot
#align box_integral.prepartition.of_with_bot_mono BoxIntegral.Prepartition.ofWithBot_mono
theorem sum_ofWithBot {M : Type*} [AddCommMonoid M] (boxes : Finset (WithBot (Box ι)))
(le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I)
(pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint) (f : Box ι → M) :
(∑ J ∈ (ofWithBot boxes le_of_mem pairwise_disjoint).boxes, f J) =
∑ J ∈ boxes, Option.elim' 0 f J :=
Finset.sum_eraseNone _ _
#align box_integral.prepartition.sum_of_with_bot BoxIntegral.Prepartition.sum_ofWithBot
def restrict (π : Prepartition I) (J : Box ι) : Prepartition J :=
ofWithBot (π.boxes.image fun J' : Box ι => J ⊓ J')
(fun J' hJ' => by
rcases Finset.mem_image.1 hJ' with ⟨J', -, rfl⟩
exact inf_le_left)
(by
simp only [Set.Pairwise, onFun, Finset.mem_coe, Finset.mem_image]
rintro _ ⟨J₁, h₁, rfl⟩ _ ⟨J₂, h₂, rfl⟩ Hne
have : J₁ ≠ J₂ := by
rintro rfl
exact Hne rfl
exact ((Box.disjoint_coe.2 <| π.disjoint_coe_of_mem h₁ h₂ this).inf_left' _).inf_right' _)
#align box_integral.prepartition.restrict BoxIntegral.Prepartition.restrict
@[simp]
theorem mem_restrict : J₁ ∈ π.restrict J ↔ ∃ J' ∈ π, (J₁ : WithBot (Box ι)) = ↑J ⊓ ↑J' := by
simp [restrict, eq_comm]
#align box_integral.prepartition.mem_restrict BoxIntegral.Prepartition.mem_restrict
theorem mem_restrict' : J₁ ∈ π.restrict J ↔ ∃ J' ∈ π, (J₁ : Set (ι → ℝ)) = ↑J ∩ ↑J' := by
simp only [mem_restrict, ← Box.withBotCoe_inj, Box.coe_inf, Box.coe_coe]
#align box_integral.prepartition.mem_restrict' BoxIntegral.Prepartition.mem_restrict'
@[mono]
theorem restrict_mono {π₁ π₂ : Prepartition I} (Hle : π₁ ≤ π₂) : π₁.restrict J ≤ π₂.restrict J := by
refine ofWithBot_mono fun J₁ hJ₁ hne => ?_
rw [Finset.mem_image] at hJ₁; rcases hJ₁ with ⟨J₁, hJ₁, rfl⟩
rcases Hle hJ₁ with ⟨J₂, hJ₂, hle⟩
exact ⟨_, Finset.mem_image_of_mem _ hJ₂, inf_le_inf_left _ <| WithBot.coe_le_coe.2 hle⟩
#align box_integral.prepartition.restrict_mono BoxIntegral.Prepartition.restrict_mono
theorem monotone_restrict : Monotone fun π : Prepartition I => restrict π J :=
fun _ _ => restrict_mono
#align box_integral.prepartition.monotone_restrict BoxIntegral.Prepartition.monotone_restrict
theorem restrict_boxes_of_le (π : Prepartition I) (h : I ≤ J) : (π.restrict J).boxes = π.boxes := by
simp only [restrict, ofWithBot, eraseNone_eq_biUnion]
refine Finset.image_biUnion.trans ?_
refine (Finset.biUnion_congr rfl ?_).trans Finset.biUnion_singleton_eq_self
intro J' hJ'
rw [inf_of_le_right, ← WithBot.some_eq_coe, Option.toFinset_some]
exact WithBot.coe_le_coe.2 ((π.le_of_mem hJ').trans h)
#align box_integral.prepartition.restrict_boxes_of_le BoxIntegral.Prepartition.restrict_boxes_of_le
@[simp]
theorem restrict_self : π.restrict I = π :=
injective_boxes <| restrict_boxes_of_le π le_rfl
#align box_integral.prepartition.restrict_self BoxIntegral.Prepartition.restrict_self
@[simp]
theorem iUnion_restrict : (π.restrict J).iUnion = (J : Set (ι → ℝ)) ∩ (π.iUnion) := by
simp [restrict, ← inter_iUnion, ← iUnion_def]
#align box_integral.prepartition.Union_restrict BoxIntegral.Prepartition.iUnion_restrict
@[simp]
theorem restrict_biUnion (πi : ∀ J, Prepartition J) (hJ : J ∈ π) :
(π.biUnion πi).restrict J = πi J := by
refine (eq_of_boxes_subset_iUnion_superset (fun J₁ h₁ => ?_) ?_).symm
· refine (mem_restrict _).2 ⟨J₁, π.mem_biUnion.2 ⟨J, hJ, h₁⟩, (inf_of_le_right ?_).symm⟩
exact WithBot.coe_le_coe.2 (le_of_mem _ h₁)
· simp only [iUnion_restrict, iUnion_biUnion, Set.subset_def, Set.mem_inter_iff, Set.mem_iUnion]
rintro x ⟨hxJ, J₁, h₁, hx⟩
obtain rfl : J = J₁ := π.eq_of_mem_of_mem hJ h₁ hxJ (iUnion_subset _ hx)
exact hx
#align box_integral.prepartition.restrict_bUnion BoxIntegral.Prepartition.restrict_biUnion
theorem biUnion_le_iff {πi : ∀ J, Prepartition J} {π' : Prepartition I} :
π.biUnion πi ≤ π' ↔ ∀ J ∈ π, πi J ≤ π'.restrict J := by
constructor <;> intro H J hJ
· rw [← π.restrict_biUnion πi hJ]
exact restrict_mono H
· rw [mem_biUnion] at hJ
rcases hJ with ⟨J₁, h₁, hJ⟩
rcases H J₁ h₁ hJ with ⟨J₂, h₂, Hle⟩
rcases π'.mem_restrict.mp h₂ with ⟨J₃, h₃, H⟩
exact ⟨J₃, h₃, Hle.trans <| WithBot.coe_le_coe.1 <| H.trans_le inf_le_right⟩
#align box_integral.prepartition.bUnion_le_iff BoxIntegral.Prepartition.biUnion_le_iff
theorem le_biUnion_iff {πi : ∀ J, Prepartition J} {π' : Prepartition I} :
π' ≤ π.biUnion πi ↔ π' ≤ π ∧ ∀ J ∈ π, π'.restrict J ≤ πi J := by
refine ⟨fun H => ⟨H.trans (π.biUnion_le πi), fun J hJ => ?_⟩, ?_⟩
· rw [← π.restrict_biUnion πi hJ]
exact restrict_mono H
· rintro ⟨H, Hi⟩ J' hJ'
rcases H hJ' with ⟨J, hJ, hle⟩
have : J' ∈ π'.restrict J :=
π'.mem_restrict.2 ⟨J', hJ', (inf_of_le_right <| WithBot.coe_le_coe.2 hle).symm⟩
rcases Hi J hJ this with ⟨Ji, hJi, hlei⟩
exact ⟨Ji, π.mem_biUnion.2 ⟨J, hJ, hJi⟩, hlei⟩
#align box_integral.prepartition.le_bUnion_iff BoxIntegral.Prepartition.le_biUnion_iff
instance inf : Inf (Prepartition I) :=
⟨fun π₁ π₂ => π₁.biUnion fun J => π₂.restrict J⟩
theorem inf_def (π₁ π₂ : Prepartition I) : π₁ ⊓ π₂ = π₁.biUnion fun J => π₂.restrict J := rfl
#align box_integral.prepartition.inf_def BoxIntegral.Prepartition.inf_def
@[simp]
theorem mem_inf {π₁ π₂ : Prepartition I} :
J ∈ π₁ ⊓ π₂ ↔ ∃ J₁ ∈ π₁, ∃ J₂ ∈ π₂, (J : WithBot (Box ι)) = ↑J₁ ⊓ ↑J₂ := by
simp only [inf_def, mem_biUnion, mem_restrict]
#align box_integral.prepartition.mem_inf BoxIntegral.Prepartition.mem_inf
@[simp]
theorem iUnion_inf (π₁ π₂ : Prepartition I) : (π₁ ⊓ π₂).iUnion = π₁.iUnion ∩ π₂.iUnion := by
simp only [inf_def, iUnion_biUnion, iUnion_restrict, ← iUnion_inter, ← iUnion_def]
#align box_integral.prepartition.Union_inf BoxIntegral.Prepartition.iUnion_inf
instance : SemilatticeInf (Prepartition I) :=
{ Prepartition.inf,
Prepartition.partialOrder with
inf_le_left := fun π₁ _ => π₁.biUnion_le _
inf_le_right := fun _ _ => (biUnion_le_iff _).2 fun _ _ => le_rfl
le_inf := fun _ π₁ _ h₁ h₂ => π₁.le_biUnion_iff.2 ⟨h₁, fun _ _ => restrict_mono h₂⟩ }
@[simps]
def filter (π : Prepartition I) (p : Box ι → Prop) : Prepartition I where
boxes := π.boxes.filter p
le_of_mem' _ hJ := π.le_of_mem (mem_filter.1 hJ).1
pairwiseDisjoint _ h₁ _ h₂ := π.disjoint_coe_of_mem (mem_filter.1 h₁).1 (mem_filter.1 h₂).1
#align box_integral.prepartition.filter BoxIntegral.Prepartition.filter
@[simp]
theorem mem_filter {p : Box ι → Prop} : J ∈ π.filter p ↔ J ∈ π ∧ p J :=
Finset.mem_filter
#align box_integral.prepartition.mem_filter BoxIntegral.Prepartition.mem_filter
theorem filter_le (π : Prepartition I) (p : Box ι → Prop) : π.filter p ≤ π := fun J hJ =>
let ⟨hπ, _⟩ := π.mem_filter.1 hJ
⟨J, hπ, le_rfl⟩
#align box_integral.prepartition.filter_le BoxIntegral.Prepartition.filter_le
theorem filter_of_true {p : Box ι → Prop} (hp : ∀ J ∈ π, p J) : π.filter p = π := by
ext J
simpa using hp J
#align box_integral.prepartition.filter_of_true BoxIntegral.Prepartition.filter_of_true
@[simp]
theorem filter_true : (π.filter fun _ => True) = π :=
π.filter_of_true fun _ _ => trivial
#align box_integral.prepartition.filter_true BoxIntegral.Prepartition.filter_true
@[simp]
theorem iUnion_filter_not (π : Prepartition I) (p : Box ι → Prop) :
(π.filter fun J => ¬p J).iUnion = π.iUnion \ (π.filter p).iUnion := by
simp only [Prepartition.iUnion]
convert (@Set.biUnion_diff_biUnion_eq (ι → ℝ) (Box ι) π.boxes (π.filter p).boxes (↑) _).symm
· simp (config := { contextual := true })
· rw [Set.PairwiseDisjoint]
convert π.pairwiseDisjoint
rw [Set.union_eq_left, filter_boxes, coe_filter]
exact fun _ ⟨h, _⟩ => h
#align box_integral.prepartition.Union_filter_not BoxIntegral.Prepartition.iUnion_filter_not
theorem sum_fiberwise {α M} [AddCommMonoid M] (π : Prepartition I) (f : Box ι → α) (g : Box ι → M) :
(∑ y ∈ π.boxes.image f, ∑ J ∈ (π.filter fun J => f J = y).boxes, g J) =
∑ J ∈ π.boxes, g J := by
convert sum_fiberwise_of_maps_to (fun _ => Finset.mem_image_of_mem f) g
#align box_integral.prepartition.sum_fiberwise BoxIntegral.Prepartition.sum_fiberwise
@[simps]
def disjUnion (π₁ π₂ : Prepartition I) (h : Disjoint π₁.iUnion π₂.iUnion) : Prepartition I where
boxes := π₁.boxes ∪ π₂.boxes
le_of_mem' J hJ := (Finset.mem_union.1 hJ).elim π₁.le_of_mem π₂.le_of_mem
pairwiseDisjoint :=
suffices ∀ J₁ ∈ π₁, ∀ J₂ ∈ π₂, J₁ ≠ J₂ → Disjoint (J₁ : Set (ι → ℝ)) J₂ by
simpa [pairwise_union_of_symmetric (symmetric_disjoint.comap _), pairwiseDisjoint]
fun J₁ h₁ J₂ h₂ _ => h.mono (π₁.subset_iUnion h₁) (π₂.subset_iUnion h₂)
#align box_integral.prepartition.disj_union BoxIntegral.Prepartition.disjUnion
@[simp]
theorem mem_disjUnion (H : Disjoint π₁.iUnion π₂.iUnion) :
J ∈ π₁.disjUnion π₂ H ↔ J ∈ π₁ ∨ J ∈ π₂ :=
Finset.mem_union
#align box_integral.prepartition.mem_disj_union BoxIntegral.Prepartition.mem_disjUnion
@[simp]
| Mathlib/Analysis/BoxIntegral/Partition/Basic.lean | 657 | 659 | theorem iUnion_disjUnion (h : Disjoint π₁.iUnion π₂.iUnion) :
(π₁.disjUnion π₂ h).iUnion = π₁.iUnion ∪ π₂.iUnion := by |
simp [disjUnion, Prepartition.iUnion, iUnion_or, iUnion_union_distrib]
|
import Mathlib.Algebra.MonoidAlgebra.Basic
#align_import algebra.monoid_algebra.division from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951"
variable {k G : Type*} [Semiring k]
namespace AddMonoidAlgebra
section
variable [AddCancelCommMonoid G]
noncomputable def divOf (x : k[G]) (g : G) : k[G] :=
-- note: comapping by `+ g` has the effect of subtracting `g` from every element in
-- the support, and discarding the elements of the support from which `g` can't be subtracted.
-- If `G` is an additive group, such as `ℤ` when used for `LaurentPolynomial`,
-- then no discarding occurs.
@Finsupp.comapDomain.addMonoidHom _ _ _ _ (g + ·) (add_right_injective g) x
#align add_monoid_algebra.div_of AddMonoidAlgebra.divOf
local infixl:70 " /ᵒᶠ " => divOf
@[simp]
theorem divOf_apply (g : G) (x : k[G]) (g' : G) : (x /ᵒᶠ g) g' = x (g + g') :=
rfl
#align add_monoid_algebra.div_of_apply AddMonoidAlgebra.divOf_apply
@[simp]
theorem support_divOf (g : G) (x : k[G]) :
(x /ᵒᶠ g).support =
x.support.preimage (g + ·) (Function.Injective.injOn (add_right_injective g)) :=
rfl
#align add_monoid_algebra.support_div_of AddMonoidAlgebra.support_divOf
@[simp]
theorem zero_divOf (g : G) : (0 : k[G]) /ᵒᶠ g = 0 :=
map_zero (Finsupp.comapDomain.addMonoidHom _)
#align add_monoid_algebra.zero_div_of AddMonoidAlgebra.zero_divOf
@[simp]
theorem divOf_zero (x : k[G]) : x /ᵒᶠ 0 = x := by
refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work
simp only [AddMonoidAlgebra.divOf_apply, zero_add]
#align add_monoid_algebra.div_of_zero AddMonoidAlgebra.divOf_zero
theorem add_divOf (x y : k[G]) (g : G) : (x + y) /ᵒᶠ g = x /ᵒᶠ g + y /ᵒᶠ g :=
map_add (Finsupp.comapDomain.addMonoidHom _) _ _
#align add_monoid_algebra.add_div_of AddMonoidAlgebra.add_divOf
theorem divOf_add (x : k[G]) (a b : G) : x /ᵒᶠ (a + b) = x /ᵒᶠ a /ᵒᶠ b := by
refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work
simp only [AddMonoidAlgebra.divOf_apply, add_assoc]
#align add_monoid_algebra.div_of_add AddMonoidAlgebra.divOf_add
@[simps]
noncomputable def divOfHom : Multiplicative G →* AddMonoid.End k[G] where
toFun g :=
{ toFun := fun x => divOf x (Multiplicative.toAdd g)
map_zero' := zero_divOf _
map_add' := fun x y => add_divOf x y (Multiplicative.toAdd g) }
map_one' := AddMonoidHom.ext divOf_zero
map_mul' g₁ g₂ :=
AddMonoidHom.ext fun _x =>
(congr_arg _ (add_comm (Multiplicative.toAdd g₁) (Multiplicative.toAdd g₂))).trans
(divOf_add _ _ _)
#align add_monoid_algebra.div_of_hom AddMonoidAlgebra.divOfHom
theorem of'_mul_divOf (a : G) (x : k[G]) : of' k G a * x /ᵒᶠ a = x := by
refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work
rw [AddMonoidAlgebra.divOf_apply, of'_apply, single_mul_apply_aux, one_mul]
intro c
exact add_right_inj _
#align add_monoid_algebra.of'_mul_div_of AddMonoidAlgebra.of'_mul_divOf
theorem mul_of'_divOf (x : k[G]) (a : G) : x * of' k G a /ᵒᶠ a = x := by
refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work
rw [AddMonoidAlgebra.divOf_apply, of'_apply, mul_single_apply_aux, mul_one]
intro c
rw [add_comm]
exact add_right_inj _
#align add_monoid_algebra.mul_of'_div_of AddMonoidAlgebra.mul_of'_divOf
theorem of'_divOf (a : G) : of' k G a /ᵒᶠ a = 1 := by
simpa only [one_mul] using mul_of'_divOf (1 : k[G]) a
#align add_monoid_algebra.of'_div_of AddMonoidAlgebra.of'_divOf
noncomputable def modOf (x : k[G]) (g : G) : k[G] :=
letI := Classical.decPred fun g₁ => ∃ g₂, g₁ = g + g₂
x.filter fun g₁ => ¬∃ g₂, g₁ = g + g₂
#align add_monoid_algebra.mod_of AddMonoidAlgebra.modOf
local infixl:70 " %ᵒᶠ " => modOf
@[simp]
theorem modOf_apply_of_not_exists_add (x : k[G]) (g : G) (g' : G)
(h : ¬∃ d, g' = g + d) : (x %ᵒᶠ g) g' = x g' := by
classical exact Finsupp.filter_apply_pos _ _ h
#align add_monoid_algebra.mod_of_apply_of_not_exists_add AddMonoidAlgebra.modOf_apply_of_not_exists_add
@[simp]
theorem modOf_apply_of_exists_add (x : k[G]) (g : G) (g' : G)
(h : ∃ d, g' = g + d) : (x %ᵒᶠ g) g' = 0 := by
classical exact Finsupp.filter_apply_neg _ _ <| by rwa [Classical.not_not]
#align add_monoid_algebra.mod_of_apply_of_exists_add AddMonoidAlgebra.modOf_apply_of_exists_add
@[simp]
theorem modOf_apply_add_self (x : k[G]) (g : G) (d : G) : (x %ᵒᶠ g) (d + g) = 0 :=
modOf_apply_of_exists_add _ _ _ ⟨_, add_comm _ _⟩
#align add_monoid_algebra.mod_of_apply_add_self AddMonoidAlgebra.modOf_apply_add_self
-- @[simp] -- Porting note (#10618): simp can prove this
theorem modOf_apply_self_add (x : k[G]) (g : G) (d : G) : (x %ᵒᶠ g) (g + d) = 0 :=
modOf_apply_of_exists_add _ _ _ ⟨_, rfl⟩
#align add_monoid_algebra.mod_of_apply_self_add AddMonoidAlgebra.modOf_apply_self_add
theorem of'_mul_modOf (g : G) (x : k[G]) : of' k G g * x %ᵒᶠ g = 0 := by
refine Finsupp.ext fun g' => ?_ -- Porting note: `ext g'` doesn't work
rw [Finsupp.zero_apply]
obtain ⟨d, rfl⟩ | h := em (∃ d, g' = g + d)
· rw [modOf_apply_self_add]
· rw [modOf_apply_of_not_exists_add _ _ _ h, of'_apply, single_mul_apply_of_not_exists_add _ _ h]
#align add_monoid_algebra.of'_mul_mod_of AddMonoidAlgebra.of'_mul_modOf
theorem mul_of'_modOf (x : k[G]) (g : G) : x * of' k G g %ᵒᶠ g = 0 := by
refine Finsupp.ext fun g' => ?_ -- Porting note: `ext g'` doesn't work
rw [Finsupp.zero_apply]
obtain ⟨d, rfl⟩ | h := em (∃ d, g' = g + d)
· rw [modOf_apply_self_add]
· rw [modOf_apply_of_not_exists_add _ _ _ h, of'_apply, mul_single_apply_of_not_exists_add]
simpa only [add_comm] using h
#align add_monoid_algebra.mul_of'_mod_of AddMonoidAlgebra.mul_of'_modOf
theorem of'_modOf (g : G) : of' k G g %ᵒᶠ g = 0 := by
simpa only [one_mul] using mul_of'_modOf (1 : k[G]) g
#align add_monoid_algebra.of'_mod_of AddMonoidAlgebra.of'_modOf
theorem divOf_add_modOf (x : k[G]) (g : G) :
of' k G g * (x /ᵒᶠ g) + x %ᵒᶠ g = x := by
refine Finsupp.ext fun g' => ?_ -- Porting note: `ext` doesn't work
rw [Finsupp.add_apply] -- Porting note: changed from `simp_rw` which can't see through the type
obtain ⟨d, rfl⟩ | h := em (∃ d, g' = g + d)
swap
· rw [modOf_apply_of_not_exists_add x _ _ h, of'_apply, single_mul_apply_of_not_exists_add _ _ h,
zero_add]
· rw [modOf_apply_self_add, add_zero]
rw [of'_apply, single_mul_apply_aux _ _ _, one_mul, divOf_apply]
intro a
exact add_right_inj _
#align add_monoid_algebra.div_of_add_mod_of AddMonoidAlgebra.divOf_add_modOf
theorem modOf_add_divOf (x : k[G]) (g : G) : x %ᵒᶠ g + of' k G g * (x /ᵒᶠ g) = x := by
rw [add_comm, divOf_add_modOf]
#align add_monoid_algebra.mod_of_add_div_of AddMonoidAlgebra.modOf_add_divOf
| Mathlib/Algebra/MonoidAlgebra/Division.lean | 193 | 200 | theorem of'_dvd_iff_modOf_eq_zero {x : k[G]} {g : G} :
of' k G g ∣ x ↔ x %ᵒᶠ g = 0 := by |
constructor
· rintro ⟨x, rfl⟩
rw [of'_mul_modOf]
· intro h
rw [← divOf_add_modOf x g, h, add_zero]
exact dvd_mul_right _ _
|
import Mathlib.Topology.Algebra.Nonarchimedean.Basic
import Mathlib.Topology.Algebra.FilterBasis
import Mathlib.Algebra.Module.Submodule.Pointwise
#align_import topology.algebra.nonarchimedean.bases from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Filter Function Lattice
open Topology Filter Pointwise
structure RingSubgroupsBasis {A ι : Type*} [Ring A] (B : ι → AddSubgroup A) : Prop where
inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j
mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i
leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (x * ·) ⁻¹' B i
rightMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (· * x) ⁻¹' B i
#align ring_subgroups_basis RingSubgroupsBasis
namespace RingSubgroupsBasis
variable {A ι : Type*} [Ring A]
theorem of_comm {A ι : Type*} [CommRing A] (B : ι → AddSubgroup A)
(inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j) (mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i)
(leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (fun y : A => x * y) ⁻¹' B i) :
RingSubgroupsBasis B :=
{ inter
mul
leftMul
rightMul := fun x i ↦ (leftMul x i).imp fun j hj ↦ by simpa only [mul_comm] using hj }
#align ring_subgroups_basis.of_comm RingSubgroupsBasis.of_comm
def toRingFilterBasis [Nonempty ι] {B : ι → AddSubgroup A} (hB : RingSubgroupsBasis B) :
RingFilterBasis A where
sets := { U | ∃ i, U = B i }
nonempty := by
inhabit ι
exact ⟨B default, default, rfl⟩
inter_sets := by
rintro _ _ ⟨i, rfl⟩ ⟨j, rfl⟩
cases' hB.inter i j with k hk
use B k
constructor
· use k
· exact hk
zero' := by
rintro _ ⟨i, rfl⟩
exact (B i).zero_mem
add' := by
rintro _ ⟨i, rfl⟩
use B i
constructor
· use i
· rintro x ⟨y, y_in, z, z_in, rfl⟩
exact (B i).add_mem y_in z_in
neg' := by
rintro _ ⟨i, rfl⟩
use B i
constructor
· use i
· intro x x_in
exact (B i).neg_mem x_in
conj' := by
rintro x₀ _ ⟨i, rfl⟩
use B i
constructor
· use i
· simp
mul' := by
rintro _ ⟨i, rfl⟩
cases' hB.mul i with k hk
use B k
constructor
· use k
· exact hk
mul_left' := by
rintro x₀ _ ⟨i, rfl⟩
cases' hB.leftMul x₀ i with k hk
use B k
constructor
· use k
· exact hk
mul_right' := by
rintro x₀ _ ⟨i, rfl⟩
cases' hB.rightMul x₀ i with k hk
use B k
constructor
· use k
· exact hk
#align ring_subgroups_basis.to_ring_filter_basis RingSubgroupsBasis.toRingFilterBasis
variable [Nonempty ι] {B : ι → AddSubgroup A} (hB : RingSubgroupsBasis B)
theorem mem_addGroupFilterBasis_iff {V : Set A} :
V ∈ hB.toRingFilterBasis.toAddGroupFilterBasis ↔ ∃ i, V = B i :=
Iff.rfl
#align ring_subgroups_basis.mem_add_group_filter_basis_iff RingSubgroupsBasis.mem_addGroupFilterBasis_iff
theorem mem_addGroupFilterBasis (i) : (B i : Set A) ∈ hB.toRingFilterBasis.toAddGroupFilterBasis :=
⟨i, rfl⟩
#align ring_subgroups_basis.mem_add_group_filter_basis RingSubgroupsBasis.mem_addGroupFilterBasis
def topology : TopologicalSpace A :=
hB.toRingFilterBasis.toAddGroupFilterBasis.topology
#align ring_subgroups_basis.topology RingSubgroupsBasis.topology
theorem hasBasis_nhds_zero : HasBasis (@nhds A hB.topology 0) (fun _ => True) fun i => B i :=
⟨by
intro s
rw [hB.toRingFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff]
constructor
· rintro ⟨-, ⟨i, rfl⟩, hi⟩
exact ⟨i, trivial, hi⟩
· rintro ⟨i, -, hi⟩
exact ⟨B i, ⟨i, rfl⟩, hi⟩⟩
#align ring_subgroups_basis.has_basis_nhds_zero RingSubgroupsBasis.hasBasis_nhds_zero
theorem hasBasis_nhds (a : A) :
HasBasis (@nhds A hB.topology a) (fun _ => True) fun i => { b | b - a ∈ B i } :=
⟨by
intro s
rw [(hB.toRingFilterBasis.toAddGroupFilterBasis.nhds_hasBasis a).mem_iff]
simp only [true_and]
constructor
· rintro ⟨-, ⟨i, rfl⟩, hi⟩
use i
suffices h : { b : A | b - a ∈ B i } = (fun y => a + y) '' ↑(B i) by
rw [h]
assumption
simp only [image_add_left, neg_add_eq_sub]
ext b
simp
· rintro ⟨i, hi⟩
use B i
constructor
· use i
· rw [image_subset_iff]
rintro b b_in
apply hi
simpa using b_in⟩
#align ring_subgroups_basis.has_basis_nhds RingSubgroupsBasis.hasBasis_nhds
def openAddSubgroup (i : ι) : @OpenAddSubgroup A _ hB.topology :=
-- Porting note: failed to synthesize instance `TopologicalSpace A`
let _ := hB.topology
{ B i with
isOpen' := by
rw [isOpen_iff_mem_nhds]
intro a a_in
rw [(hB.hasBasis_nhds a).mem_iff]
use i, trivial
rintro b b_in
simpa using (B i).add_mem a_in b_in }
#align ring_subgroups_basis.open_add_subgroup RingSubgroupsBasis.openAddSubgroup
-- see Note [nonarchimedean non instances]
| Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean | 194 | 199 | theorem nonarchimedean : @NonarchimedeanRing A _ hB.topology := by |
letI := hB.topology
constructor
intro U hU
obtain ⟨i, -, hi : (B i : Set A) ⊆ U⟩ := hB.hasBasis_nhds_zero.mem_iff.mp hU
exact ⟨hB.openAddSubgroup i, hi⟩
|
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section support
variable [DecidableEq α] [Fintype α] {f g : Perm α}
def support (f : Perm α) : Finset α :=
univ.filter fun x => f x ≠ x
#align equiv.perm.support Equiv.Perm.support
@[simp]
theorem mem_support {x : α} : x ∈ f.support ↔ f x ≠ x := by
rw [support, mem_filter, and_iff_right (mem_univ x)]
#align equiv.perm.mem_support Equiv.Perm.mem_support
theorem not_mem_support {x : α} : x ∉ f.support ↔ f x = x := by simp
#align equiv.perm.not_mem_support Equiv.Perm.not_mem_support
theorem coe_support_eq_set_support (f : Perm α) : (f.support : Set α) = { x | f x ≠ x } := by
ext
simp
#align equiv.perm.coe_support_eq_set_support Equiv.Perm.coe_support_eq_set_support
@[simp]
theorem support_eq_empty_iff {σ : Perm α} : σ.support = ∅ ↔ σ = 1 := by
simp_rw [Finset.ext_iff, mem_support, Finset.not_mem_empty, iff_false_iff, not_not,
Equiv.Perm.ext_iff, one_apply]
#align equiv.perm.support_eq_empty_iff Equiv.Perm.support_eq_empty_iff
@[simp]
theorem support_one : (1 : Perm α).support = ∅ := by rw [support_eq_empty_iff]
#align equiv.perm.support_one Equiv.Perm.support_one
@[simp]
theorem support_refl : support (Equiv.refl α) = ∅ :=
support_one
#align equiv.perm.support_refl Equiv.Perm.support_refl
theorem support_congr (h : f.support ⊆ g.support) (h' : ∀ x ∈ g.support, f x = g x) : f = g := by
ext x
by_cases hx : x ∈ g.support
· exact h' x hx
· rw [not_mem_support.mp hx, ← not_mem_support]
exact fun H => hx (h H)
#align equiv.perm.support_congr Equiv.Perm.support_congr
theorem support_mul_le (f g : Perm α) : (f * g).support ≤ f.support ⊔ g.support := fun x => by
simp only [sup_eq_union]
rw [mem_union, mem_support, mem_support, mem_support, mul_apply, ← not_and_or, not_imp_not]
rintro ⟨hf, hg⟩
rw [hg, hf]
#align equiv.perm.support_mul_le Equiv.Perm.support_mul_le
theorem exists_mem_support_of_mem_support_prod {l : List (Perm α)} {x : α}
(hx : x ∈ l.prod.support) : ∃ f : Perm α, f ∈ l ∧ x ∈ f.support := by
contrapose! hx
simp_rw [mem_support, not_not] at hx ⊢
induction' l with f l ih
· rfl
· rw [List.prod_cons, mul_apply, ih, hx]
· simp only [List.find?, List.mem_cons, true_or]
intros f' hf'
refine hx f' ?_
simp only [List.find?, List.mem_cons]
exact Or.inr hf'
#align equiv.perm.exists_mem_support_of_mem_support_prod Equiv.Perm.exists_mem_support_of_mem_support_prod
theorem support_pow_le (σ : Perm α) (n : ℕ) : (σ ^ n).support ≤ σ.support := fun _ h1 =>
mem_support.mpr fun h2 => mem_support.mp h1 (pow_apply_eq_self_of_apply_eq_self h2 n)
#align equiv.perm.support_pow_le Equiv.Perm.support_pow_le
@[simp]
theorem support_inv (σ : Perm α) : support σ⁻¹ = σ.support := by
simp_rw [Finset.ext_iff, mem_support, not_iff_not, inv_eq_iff_eq.trans eq_comm, imp_true_iff]
#align equiv.perm.support_inv Equiv.Perm.support_inv
-- @[simp] -- Porting note (#10618): simp can prove this
theorem apply_mem_support {x : α} : f x ∈ f.support ↔ x ∈ f.support := by
rw [mem_support, mem_support, Ne, Ne, apply_eq_iff_eq]
#align equiv.perm.apply_mem_support Equiv.Perm.apply_mem_support
-- Porting note (#10756): new theorem
@[simp]
theorem apply_pow_apply_eq_iff (f : Perm α) (n : ℕ) {x : α} :
f ((f ^ n) x) = (f ^ n) x ↔ f x = x := by
rw [← mul_apply, Commute.self_pow f, mul_apply, apply_eq_iff_eq]
-- @[simp] -- Porting note (#10618): simp can prove this
theorem pow_apply_mem_support {n : ℕ} {x : α} : (f ^ n) x ∈ f.support ↔ x ∈ f.support := by
simp only [mem_support, ne_eq, apply_pow_apply_eq_iff]
#align equiv.perm.pow_apply_mem_support Equiv.Perm.pow_apply_mem_support
-- Porting note (#10756): new theorem
@[simp]
theorem apply_zpow_apply_eq_iff (f : Perm α) (n : ℤ) {x : α} :
f ((f ^ n) x) = (f ^ n) x ↔ f x = x := by
rw [← mul_apply, Commute.self_zpow f, mul_apply, apply_eq_iff_eq]
-- @[simp] -- Porting note (#10618): simp can prove this
theorem zpow_apply_mem_support {n : ℤ} {x : α} : (f ^ n) x ∈ f.support ↔ x ∈ f.support := by
simp only [mem_support, ne_eq, apply_zpow_apply_eq_iff]
#align equiv.perm.zpow_apply_mem_support Equiv.Perm.zpow_apply_mem_support
theorem pow_eq_on_of_mem_support (h : ∀ x ∈ f.support ∩ g.support, f x = g x) (k : ℕ) :
∀ x ∈ f.support ∩ g.support, (f ^ k) x = (g ^ k) x := by
induction' k with k hk
· simp
· intro x hx
rw [pow_succ, mul_apply, pow_succ, mul_apply, h _ hx, hk]
rwa [mem_inter, apply_mem_support, ← h _ hx, apply_mem_support, ← mem_inter]
#align equiv.perm.pow_eq_on_of_mem_support Equiv.Perm.pow_eq_on_of_mem_support
| Mathlib/GroupTheory/Perm/Support.lean | 398 | 400 | theorem disjoint_iff_disjoint_support : Disjoint f g ↔ _root_.Disjoint f.support g.support := by |
simp [disjoint_iff_eq_or_eq, disjoint_iff, disjoint_iff, Finset.ext_iff, not_and_or,
imp_iff_not_or]
|
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Fintype.Option
import Mathlib.Data.Fintype.Pi
import Mathlib.Data.Fintype.Sum
#align_import combinatorics.hales_jewett from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
open scoped Classical
universe u v
namespace Combinatorics
structure Line (α ι : Type*) where
idxFun : ι → Option α
proper : ∃ i, idxFun i = none
#align combinatorics.line Combinatorics.Line
namespace Line
-- This lets us treat a line `l : Line α ι` as a function `α → ι → α`.
instance (α ι) : CoeFun (Line α ι) fun _ => α → ι → α :=
⟨fun l x i => (l.idxFun i).getD x⟩
def IsMono {α ι κ} (C : (ι → α) → κ) (l : Line α ι) : Prop :=
∃ c, ∀ x, C (l x) = c
#align combinatorics.line.is_mono Combinatorics.Line.IsMono
def diagonal (α ι) [Nonempty ι] : Line α ι where
idxFun _ := none
proper := ⟨Classical.arbitrary ι, rfl⟩
#align combinatorics.line.diagonal Combinatorics.Line.diagonal
instance (α ι) [Nonempty ι] : Inhabited (Line α ι) :=
⟨diagonal α ι⟩
structure AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where
line : Line (Option α) ι
color : κ
has_color : ∀ x : α, C (line (some x)) = color
#align combinatorics.line.almost_mono Combinatorics.Line.AlmostMono
instance {α ι κ : Type*} [Nonempty ι] [Inhabited κ] :
Inhabited (AlmostMono fun _ : ι → Option α => (default : κ)) :=
⟨{ line := default
color := default
has_color := fun _ ↦ rfl}⟩
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
lines : Multiset (AlmostMono C)
focus : ι → Option α
is_focused : ∀ p ∈ lines, p.line none = focus
distinct_colors : (lines.map AlmostMono.color).Nodup
#align combinatorics.line.color_focused Combinatorics.Line.ColorFocused
instance {α ι κ} (C : (ι → Option α) → κ) : Inhabited (ColorFocused C) := by
refine ⟨⟨0, fun _ => none, fun h => ?_, Multiset.nodup_zero⟩⟩
simp only [Multiset.not_mem_zero, IsEmpty.forall_iff]
def map {α α' ι} (f : α → α') (l : Line α ι) : Line α' ι where
idxFun i := (l.idxFun i).map f
proper := ⟨l.proper.choose, by simp only [l.proper.choose_spec, Option.map_none']⟩
#align combinatorics.line.map Combinatorics.Line.map
def vertical {α ι ι'} (v : ι → α) (l : Line α ι') : Line α (Sum ι ι') where
idxFun := Sum.elim (some ∘ v) l.idxFun
proper := ⟨Sum.inr l.proper.choose, l.proper.choose_spec⟩
#align combinatorics.line.vertical Combinatorics.Line.vertical
def horizontal {α ι ι'} (l : Line α ι) (v : ι' → α) : Line α (Sum ι ι') where
idxFun := Sum.elim l.idxFun (some ∘ v)
proper := ⟨Sum.inl l.proper.choose, l.proper.choose_spec⟩
#align combinatorics.line.horizontal Combinatorics.Line.horizontal
def prod {α ι ι'} (l : Line α ι) (l' : Line α ι') : Line α (Sum ι ι') where
idxFun := Sum.elim l.idxFun l'.idxFun
proper := ⟨Sum.inl l.proper.choose, l.proper.choose_spec⟩
#align combinatorics.line.prod Combinatorics.Line.prod
theorem apply {α ι} (l : Line α ι) (x : α) : l x = fun i => (l.idxFun i).getD x :=
rfl
#align combinatorics.line.apply Combinatorics.Line.apply
theorem apply_none {α ι} (l : Line α ι) (x : α) (i : ι) (h : l.idxFun i = none) : l x i = x := by
simp only [Option.getD_none, h, l.apply]
#align combinatorics.line.apply_none Combinatorics.Line.apply_none
theorem apply_of_ne_none {α ι} (l : Line α ι) (x : α) (i : ι) (h : l.idxFun i ≠ none) :
some (l x i) = l.idxFun i := by rw [l.apply, Option.getD_of_ne_none h]
#align combinatorics.line.apply_of_ne_none Combinatorics.Line.apply_of_ne_none
@[simp]
theorem map_apply {α α' ι} (f : α → α') (l : Line α ι) (x : α) : l.map f (f x) = f ∘ l x := by
simp only [Line.apply, Line.map, Option.getD_map]
rfl
#align combinatorics.line.map_apply Combinatorics.Line.map_apply
@[simp]
| Mathlib/Combinatorics/HalesJewett.lean | 190 | 193 | theorem vertical_apply {α ι ι'} (v : ι → α) (l : Line α ι') (x : α) :
l.vertical v x = Sum.elim v (l x) := by |
funext i
cases i <;> rfl
|
import Mathlib.Analysis.Calculus.ContDiff.Bounds
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.LocallyConvex.WithSeminorms
import Mathlib.Analysis.Normed.Group.ZeroAtInfty
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
import Mathlib.Topology.Algebra.UniformFilterBasis
import Mathlib.Tactic.MoveAdd
#align_import analysis.schwartz_space from "leanprover-community/mathlib"@"e137999b2c6f2be388f4cd3bbf8523de1910cd2b"
noncomputable section
open scoped Nat NNReal
variable {𝕜 𝕜' D E F G V : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
variable [NormedAddCommGroup F] [NormedSpace ℝ F]
variable (E F)
structure SchwartzMap where
toFun : E → F
smooth' : ContDiff ℝ ⊤ toFun
decay' : ∀ k n : ℕ, ∃ C : ℝ, ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n toFun x‖ ≤ C
#align schwartz_map SchwartzMap
scoped[SchwartzMap] notation "𝓢(" E ", " F ")" => SchwartzMap E F
variable {E F}
namespace SchwartzMap
-- Porting note: removed
-- instance : Coe 𝓢(E, F) (E → F) := ⟨toFun⟩
instance instFunLike : FunLike 𝓢(E, F) E F where
coe f := f.toFun
coe_injective' f g h := by cases f; cases g; congr
#align schwartz_map.fun_like SchwartzMap.instFunLike
instance instCoeFun : CoeFun 𝓢(E, F) fun _ => E → F :=
DFunLike.hasCoeToFun
#align schwartz_map.has_coe_to_fun SchwartzMap.instCoeFun
theorem decay (f : 𝓢(E, F)) (k n : ℕ) :
∃ C : ℝ, 0 < C ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ C := by
rcases f.decay' k n with ⟨C, hC⟩
exact ⟨max C 1, by positivity, fun x => (hC x).trans (le_max_left _ _)⟩
#align schwartz_map.decay SchwartzMap.decay
theorem smooth (f : 𝓢(E, F)) (n : ℕ∞) : ContDiff ℝ n f :=
f.smooth'.of_le le_top
#align schwartz_map.smooth SchwartzMap.smooth
@[continuity]
protected theorem continuous (f : 𝓢(E, F)) : Continuous f :=
(f.smooth 0).continuous
#align schwartz_map.continuous SchwartzMap.continuous
instance instContinuousMapClass : ContinuousMapClass 𝓢(E, F) E F where
map_continuous := SchwartzMap.continuous
protected theorem differentiable (f : 𝓢(E, F)) : Differentiable ℝ f :=
(f.smooth 1).differentiable rfl.le
#align schwartz_map.differentiable SchwartzMap.differentiable
protected theorem differentiableAt (f : 𝓢(E, F)) {x : E} : DifferentiableAt ℝ f x :=
f.differentiable.differentiableAt
#align schwartz_map.differentiable_at SchwartzMap.differentiableAt
@[ext]
theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g :=
DFunLike.ext f g h
#align schwartz_map.ext SchwartzMap.ext
section Aux
theorem bounds_nonempty (k n : ℕ) (f : 𝓢(E, F)) :
∃ c : ℝ, c ∈ { c : ℝ | 0 ≤ c ∧ ∀ x : E, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } :=
let ⟨M, hMp, hMb⟩ := f.decay k n
⟨M, le_of_lt hMp, hMb⟩
#align schwartz_map.bounds_nonempty SchwartzMap.bounds_nonempty
theorem bounds_bddBelow (k n : ℕ) (f : 𝓢(E, F)) :
BddBelow { c | 0 ≤ c ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } :=
⟨0, fun _ ⟨hn, _⟩ => hn⟩
#align schwartz_map.bounds_bdd_below SchwartzMap.bounds_bddBelow
| Mathlib/Analysis/Distribution/SchwartzSpace.lean | 194 | 200 | theorem decay_add_le_aux (k n : ℕ) (f g : 𝓢(E, F)) (x : E) :
‖x‖ ^ k * ‖iteratedFDeriv ℝ n ((f : E → F) + (g : E → F)) x‖ ≤
‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ + ‖x‖ ^ k * ‖iteratedFDeriv ℝ n g x‖ := by |
rw [← mul_add]
refine mul_le_mul_of_nonneg_left ?_ (by positivity)
rw [iteratedFDeriv_add_apply (f.smooth _) (g.smooth _)]
exact norm_add_le _ _
|
import Mathlib.Init.Function
import Mathlib.Init.Order.Defs
#align_import data.bool.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
namespace Bool
@[deprecated (since := "2024-06-07")] alias decide_True := decide_true_eq_true
#align bool.to_bool_true decide_true_eq_true
@[deprecated (since := "2024-06-07")] alias decide_False := decide_false_eq_false
#align bool.to_bool_false decide_false_eq_false
#align bool.to_bool_coe Bool.decide_coe
@[deprecated (since := "2024-06-07")] alias coe_decide := decide_eq_true_iff
#align bool.coe_to_bool decide_eq_true_iff
@[deprecated decide_eq_true_iff (since := "2024-06-07")]
alias of_decide_iff := decide_eq_true_iff
#align bool.of_to_bool_iff decide_eq_true_iff
#align bool.tt_eq_to_bool_iff true_eq_decide_iff
#align bool.ff_eq_to_bool_iff false_eq_decide_iff
@[deprecated (since := "2024-06-07")] alias decide_not := decide_not
#align bool.to_bool_not decide_not
#align bool.to_bool_and Bool.decide_and
#align bool.to_bool_or Bool.decide_or
#align bool.to_bool_eq decide_eq_decide
@[deprecated (since := "2024-06-07")] alias not_false' := false_ne_true
#align bool.not_ff Bool.false_ne_true
@[deprecated (since := "2024-06-07")] alias eq_iff_eq_true_iff := eq_iff_iff
#align bool.default_bool Bool.default_bool
theorem dichotomy (b : Bool) : b = false ∨ b = true := by cases b <;> simp
#align bool.dichotomy Bool.dichotomy
theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b :=
⟨fun h ↦ ⟨h _, h _⟩, fun ⟨h₁, h₂⟩ x ↦ by cases b <;> cases x <;> assumption⟩
@[simp]
theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
forall_bool' false
#align bool.forall_bool Bool.forall_bool
theorem exists_bool' {p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b :=
⟨fun ⟨x, hx⟩ ↦ by cases x <;> cases b <;> first | exact .inl ‹_› | exact .inr ‹_›,
fun h ↦ by cases h <;> exact ⟨_, ‹_›⟩⟩
@[simp]
theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
exists_bool' false
#align bool.exists_bool Bool.exists_bool
#align bool.decidable_forall_bool Bool.instDecidableForallOfDecidablePred
#align bool.decidable_exists_bool Bool.instDecidableExistsOfDecidablePred
#align bool.cond_eq_ite Bool.cond_eq_ite
#align bool.cond_to_bool Bool.cond_decide
#align bool.cond_bnot Bool.cond_not
theorem not_ne_id : not ≠ id := fun h ↦ false_ne_true <| congrFun h true
#align bool.bnot_ne_id Bool.not_ne_id
#align bool.coe_bool_iff Bool.coe_iff_coe
@[deprecated (since := "2024-06-07")] alias eq_true_of_ne_false := eq_true_of_ne_false
#align bool.eq_tt_of_ne_ff eq_true_of_ne_false
@[deprecated (since := "2024-06-07")] alias eq_false_of_ne_true := eq_false_of_ne_true
#align bool.eq_ff_of_ne_tt eq_true_of_ne_false
#align bool.bor_comm Bool.or_comm
#align bool.bor_assoc Bool.or_assoc
#align bool.bor_left_comm Bool.or_left_comm
theorem or_inl {a b : Bool} (H : a) : a || b := by simp [H]
#align bool.bor_inl Bool.or_inl
theorem or_inr {a b : Bool} (H : b) : a || b := by cases a <;> simp [H]
#align bool.bor_inr Bool.or_inr
#align bool.band_comm Bool.and_comm
#align bool.band_assoc Bool.and_assoc
#align bool.band_left_comm Bool.and_left_comm
theorem and_elim_left : ∀ {a b : Bool}, a && b → a := by decide
#align bool.band_elim_left Bool.and_elim_left
theorem and_intro : ∀ {a b : Bool}, a → b → a && b := by decide
#align bool.band_intro Bool.and_intro
theorem and_elim_right : ∀ {a b : Bool}, a && b → b := by decide
#align bool.band_elim_right Bool.and_elim_right
#align bool.band_bor_distrib_left Bool.and_or_distrib_left
#align bool.band_bor_distrib_right Bool.and_or_distrib_right
#align bool.bor_band_distrib_left Bool.or_and_distrib_left
#align bool.bor_band_distrib_right Bool.or_and_distrib_right
#align bool.bnot_ff Bool.not_false
#align bool.bnot_tt Bool.not_true
lemma eq_not_iff : ∀ {a b : Bool}, a = !b ↔ a ≠ b := by decide
#align bool.eq_bnot_iff Bool.eq_not_iff
lemma not_eq_iff : ∀ {a b : Bool}, !a = b ↔ a ≠ b := by decide
#align bool.bnot_eq_iff Bool.not_eq_iff
#align bool.not_eq_bnot Bool.not_eq_not
#align bool.bnot_not_eq Bool.not_not_eq
theorem ne_not {a b : Bool} : a ≠ !b ↔ a = b :=
not_eq_not
#align bool.ne_bnot Bool.ne_not
@[deprecated (since := "2024-06-07")] alias not_ne := not_not_eq
#align bool.bnot_ne Bool.not_not_eq
lemma not_ne_self : ∀ b : Bool, (!b) ≠ b := by decide
#align bool.bnot_ne_self Bool.not_ne_self
lemma self_ne_not : ∀ b : Bool, b ≠ !b := by decide
#align bool.self_ne_bnot Bool.self_ne_not
lemma eq_or_eq_not : ∀ a b, a = b ∨ a = !b := by decide
#align bool.eq_or_eq_bnot Bool.eq_or_eq_not
-- Porting note: naming issue again: these two `not` are different.
theorem not_iff_not : ∀ {b : Bool}, !b ↔ ¬b := by simp
#align bool.bnot_iff_not Bool.not_iff_not
theorem eq_true_of_not_eq_false' {a : Bool} : !a = false → a = true := by
cases a <;> decide
#align bool.eq_tt_of_bnot_eq_ff Bool.eq_true_of_not_eq_false'
theorem eq_false_of_not_eq_true' {a : Bool} : !a = true → a = false := by
cases a <;> decide
#align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'
#align bool.band_bnot_self Bool.and_not_self
#align bool.bnot_band_self Bool.not_and_self
#align bool.bor_bnot_self Bool.or_not_self
#align bool.bnot_bor_self Bool.not_or_self
theorem bne_eq_xor : bne = xor := by funext a b; revert a b; decide
#align bool.bxor_comm Bool.xor_comm
attribute [simp] xor_assoc
#align bool.bxor_assoc Bool.xor_assoc
#align bool.bxor_left_comm Bool.xor_left_comm
#align bool.bxor_bnot_left Bool.not_xor
#align bool.bxor_bnot_right Bool.xor_not
#align bool.bxor_bnot_bnot Bool.not_xor_not
#align bool.bxor_ff_left Bool.false_xor
#align bool.bxor_ff_right Bool.xor_false
#align bool.band_bxor_distrib_left Bool.and_xor_distrib_left
#align bool.band_bxor_distrib_right Bool.and_xor_distrib_right
theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
#align bool.bxor_iff_ne Bool.xor_iff_ne
#align bool.bnot_band Bool.not_and
#align bool.bnot_bor Bool.not_or
#align bool.bnot_inj Bool.not_inj
instance linearOrder : LinearOrder Bool where
le_refl := by decide
le_trans := by decide
le_antisymm := by decide
le_total := by decide
decidableLE := inferInstance
decidableEq := inferInstance
decidableLT := inferInstance
lt_iff_le_not_le := by decide
max_def := by decide
min_def := by decide
#align bool.linear_order Bool.linearOrder
#align bool.ff_le Bool.false_le
#align bool.le_tt Bool.le_true
theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
#align bool.lt_iff Bool.lt_iff
@[simp]
theorem false_lt_true : false < true :=
lt_iff.2 ⟨rfl, rfl⟩
#align bool.ff_lt_tt Bool.false_lt_true
theorem le_iff_imp : ∀ {x y : Bool}, x ≤ y ↔ x → y := by decide
#align bool.le_iff_imp Bool.le_iff_imp
| Mathlib/Data/Bool/Basic.lean | 221 | 221 | theorem and_le_left : ∀ x y : Bool, (x && y) ≤ x := by | decide
|
import Mathlib.CategoryTheory.Limits.HasLimits
import Mathlib.CategoryTheory.Thin
#align_import category_theory.limits.shapes.wide_pullbacks from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
universe w w' v u
open CategoryTheory CategoryTheory.Limits Opposite
namespace CategoryTheory.Limits
variable (J : Type w)
def WidePullbackShape := Option J
#align category_theory.limits.wide_pullback_shape CategoryTheory.Limits.WidePullbackShape
-- Porting note: strangely this could be synthesized
instance : Inhabited (WidePullbackShape J) where
default := none
def WidePushoutShape := Option J
#align category_theory.limits.wide_pushout_shape CategoryTheory.Limits.WidePushoutShape
instance : Inhabited (WidePushoutShape J) where
default := none
variable (C : Type u) [Category.{v} C]
abbrev HasWidePullbacks : Prop :=
∀ J : Type w, HasLimitsOfShape (WidePullbackShape J) C
#align category_theory.limits.has_wide_pullbacks CategoryTheory.Limits.HasWidePullbacks
abbrev HasWidePushouts : Prop :=
∀ J : Type w, HasColimitsOfShape (WidePushoutShape J) C
#align category_theory.limits.has_wide_pushouts CategoryTheory.Limits.HasWidePushouts
variable {C J}
abbrev HasWidePullback (B : C) (objs : J → C) (arrows : ∀ j : J, objs j ⟶ B) : Prop :=
HasLimit (WidePullbackShape.wideCospan B objs arrows)
#align category_theory.limits.has_wide_pullback CategoryTheory.Limits.HasWidePullback
abbrev HasWidePushout (B : C) (objs : J → C) (arrows : ∀ j : J, B ⟶ objs j) : Prop :=
HasColimit (WidePushoutShape.wideSpan B objs arrows)
#align category_theory.limits.has_wide_pushout CategoryTheory.Limits.HasWidePushout
noncomputable abbrev widePullback (B : C) (objs : J → C) (arrows : ∀ j : J, objs j ⟶ B)
[HasWidePullback B objs arrows] : C :=
limit (WidePullbackShape.wideCospan B objs arrows)
#align category_theory.limits.wide_pullback CategoryTheory.Limits.widePullback
noncomputable abbrev widePushout (B : C) (objs : J → C) (arrows : ∀ j : J, B ⟶ objs j)
[HasWidePushout B objs arrows] : C :=
colimit (WidePushoutShape.wideSpan B objs arrows)
#align category_theory.limits.wide_pushout CategoryTheory.Limits.widePushout
namespace WidePullback
variable {C : Type u} [Category.{v} C] {B : C} {objs : J → C} (arrows : ∀ j : J, objs j ⟶ B)
variable [HasWidePullback B objs arrows]
noncomputable abbrev π (j : J) : widePullback _ _ arrows ⟶ objs j :=
limit.π (WidePullbackShape.wideCospan _ _ _) (Option.some j)
#align category_theory.limits.wide_pullback.π CategoryTheory.Limits.WidePullback.π
noncomputable abbrev base : widePullback _ _ arrows ⟶ B :=
limit.π (WidePullbackShape.wideCospan _ _ _) Option.none
#align category_theory.limits.wide_pullback.base CategoryTheory.Limits.WidePullback.base
@[reassoc (attr := simp)]
theorem π_arrow (j : J) : π arrows j ≫ arrows _ = base arrows := by
apply limit.w (WidePullbackShape.wideCospan _ _ _) (WidePullbackShape.Hom.term j)
#align category_theory.limits.wide_pullback.π_arrow CategoryTheory.Limits.WidePullback.π_arrow
variable {arrows}
noncomputable abbrev lift {X : C} (f : X ⟶ B) (fs : ∀ j : J, X ⟶ objs j)
(w : ∀ j, fs j ≫ arrows j = f) : X ⟶ widePullback _ _ arrows :=
limit.lift (WidePullbackShape.wideCospan _ _ _) (WidePullbackShape.mkCone f fs <| w)
#align category_theory.limits.wide_pullback.lift CategoryTheory.Limits.WidePullback.lift
variable (arrows)
variable {X : C} (f : X ⟶ B) (fs : ∀ j : J, X ⟶ objs j) (w : ∀ j, fs j ≫ arrows j = f)
-- Porting note (#10618): simp can prove this so removed simp attribute
@[reassoc]
theorem lift_π (j : J) : lift f fs w ≫ π arrows j = fs _ := by
simp only [limit.lift_π, WidePullbackShape.mkCone_pt, WidePullbackShape.mkCone_π_app]
#align category_theory.limits.wide_pullback.lift_π CategoryTheory.Limits.WidePullback.lift_π
-- Porting note (#10618): simp can prove this so removed simp attribute
@[reassoc]
theorem lift_base : lift f fs w ≫ base arrows = f := by
simp only [limit.lift_π, WidePullbackShape.mkCone_pt, WidePullbackShape.mkCone_π_app]
#align category_theory.limits.wide_pullback.lift_base CategoryTheory.Limits.WidePullback.lift_base
| Mathlib/CategoryTheory/Limits/Shapes/WidePullbacks.lean | 368 | 376 | theorem eq_lift_of_comp_eq (g : X ⟶ widePullback _ _ arrows) :
(∀ j : J, g ≫ π arrows j = fs j) → g ≫ base arrows = f → g = lift f fs w := by |
intro h1 h2
apply
(limit.isLimit (WidePullbackShape.wideCospan B objs arrows)).uniq
(WidePullbackShape.mkCone f fs <| w)
rintro (_ | _)
· apply h2
· apply h1
|
import Mathlib.Data.Matrix.Block
import Mathlib.Data.Matrix.Notation
import Mathlib.Data.Matrix.RowCol
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.GroupTheory.Perm.Fin
import Mathlib.LinearAlgebra.Alternating.Basic
#align_import linear_algebra.matrix.determinant from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
universe u v w z
open Equiv Equiv.Perm Finset Function
namespace Matrix
open Matrix
variable {m n : Type*} [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m]
variable {R : Type v} [CommRing R]
local notation "ε " σ:arg => ((sign σ : ℤ) : R)
def detRowAlternating : (n → R) [⋀^n]→ₗ[R] R :=
MultilinearMap.alternatization ((MultilinearMap.mkPiAlgebra R n R).compLinearMap LinearMap.proj)
#align matrix.det_row_alternating Matrix.detRowAlternating
abbrev det (M : Matrix n n R) : R :=
detRowAlternating M
#align matrix.det Matrix.det
theorem det_apply (M : Matrix n n R) : M.det = ∑ σ : Perm n, Equiv.Perm.sign σ • ∏ i, M (σ i) i :=
MultilinearMap.alternatization_apply _ M
#align matrix.det_apply Matrix.det_apply
-- This is what the old definition was. We use it to avoid having to change the old proofs below
theorem det_apply' (M : Matrix n n R) : M.det = ∑ σ : Perm n, ε σ * ∏ i, M (σ i) i := by
simp [det_apply, Units.smul_def]
#align matrix.det_apply' Matrix.det_apply'
@[simp]
theorem det_diagonal {d : n → R} : det (diagonal d) = ∏ i, d i := by
rw [det_apply']
refine (Finset.sum_eq_single 1 ?_ ?_).trans ?_
· rintro σ - h2
cases' not_forall.1 (mt Equiv.ext h2) with x h3
convert mul_zero (ε σ)
apply Finset.prod_eq_zero (mem_univ x)
exact if_neg h3
· simp
· simp
#align matrix.det_diagonal Matrix.det_diagonal
-- @[simp] -- Porting note (#10618): simp can prove this
theorem det_zero (_ : Nonempty n) : det (0 : Matrix n n R) = 0 :=
(detRowAlternating : (n → R) [⋀^n]→ₗ[R] R).map_zero
#align matrix.det_zero Matrix.det_zero
@[simp]
theorem det_one : det (1 : Matrix n n R) = 1 := by rw [← diagonal_one]; simp [-diagonal_one]
#align matrix.det_one Matrix.det_one
theorem det_isEmpty [IsEmpty n] {A : Matrix n n R} : det A = 1 := by simp [det_apply]
#align matrix.det_is_empty Matrix.det_isEmpty
@[simp]
theorem coe_det_isEmpty [IsEmpty n] : (det : Matrix n n R → R) = Function.const _ 1 := by
ext
exact det_isEmpty
#align matrix.coe_det_is_empty Matrix.coe_det_isEmpty
theorem det_eq_one_of_card_eq_zero {A : Matrix n n R} (h : Fintype.card n = 0) : det A = 1 :=
haveI : IsEmpty n := Fintype.card_eq_zero_iff.mp h
det_isEmpty
#align matrix.det_eq_one_of_card_eq_zero Matrix.det_eq_one_of_card_eq_zero
@[simp]
theorem det_unique {n : Type*} [Unique n] [DecidableEq n] [Fintype n] (A : Matrix n n R) :
det A = A default default := by simp [det_apply, univ_unique]
#align matrix.det_unique Matrix.det_unique
theorem det_eq_elem_of_subsingleton [Subsingleton n] (A : Matrix n n R) (k : n) :
det A = A k k := by
have := uniqueOfSubsingleton k
convert det_unique A
#align matrix.det_eq_elem_of_subsingleton Matrix.det_eq_elem_of_subsingleton
theorem det_eq_elem_of_card_eq_one {A : Matrix n n R} (h : Fintype.card n = 1) (k : n) :
det A = A k k :=
haveI : Subsingleton n := Fintype.card_le_one_iff_subsingleton.mp h.le
det_eq_elem_of_subsingleton _ _
#align matrix.det_eq_elem_of_card_eq_one Matrix.det_eq_elem_of_card_eq_one
theorem det_mul_aux {M N : Matrix n n R} {p : n → n} (H : ¬Bijective p) :
(∑ σ : Perm n, ε σ * ∏ x, M (σ x) (p x) * N (p x) x) = 0 := by
obtain ⟨i, j, hpij, hij⟩ : ∃ i j, p i = p j ∧ i ≠ j := by
rw [← Finite.injective_iff_bijective, Injective] at H
push_neg at H
exact H
exact
sum_involution (fun σ _ => σ * Equiv.swap i j)
(fun σ _ => by
have : (∏ x, M (σ x) (p x)) = ∏ x, M ((σ * Equiv.swap i j) x) (p x) :=
Fintype.prod_equiv (swap i j) _ _ (by simp [apply_swap_eq_self hpij])
simp [this, sign_swap hij, -sign_swap', prod_mul_distrib])
(fun σ _ _ => (not_congr mul_swap_eq_iff).mpr hij) (fun _ _ => mem_univ _) fun σ _ =>
mul_swap_involutive i j σ
#align matrix.det_mul_aux Matrix.det_mul_aux
@[simp]
theorem det_mul (M N : Matrix n n R) : det (M * N) = det M * det N :=
calc
det (M * N) = ∑ p : n → n, ∑ σ : Perm n, ε σ * ∏ i, M (σ i) (p i) * N (p i) i := by
simp only [det_apply', mul_apply, prod_univ_sum, mul_sum, Fintype.piFinset_univ]
rw [Finset.sum_comm]
_ =
∑ p ∈ (@univ (n → n) _).filter Bijective,
∑ σ : Perm n, ε σ * ∏ i, M (σ i) (p i) * N (p i) i :=
(Eq.symm <|
sum_subset (filter_subset _ _) fun f _ hbij =>
det_mul_aux <| by simpa only [true_and_iff, mem_filter, mem_univ] using hbij)
_ = ∑ τ : Perm n, ∑ σ : Perm n, ε σ * ∏ i, M (σ i) (τ i) * N (τ i) i :=
sum_bij (fun p h ↦ Equiv.ofBijective p (mem_filter.1 h).2) (fun _ _ ↦ mem_univ _)
(fun _ _ _ _ h ↦ by injection h)
(fun b _ ↦ ⟨b, mem_filter.2 ⟨mem_univ _, b.bijective⟩, coe_fn_injective rfl⟩) fun _ _ ↦ rfl
_ = ∑ σ : Perm n, ∑ τ : Perm n, (∏ i, N (σ i) i) * ε τ * ∏ j, M (τ j) (σ j) := by
simp only [mul_comm, mul_left_comm, prod_mul_distrib, mul_assoc]
_ = ∑ σ : Perm n, ∑ τ : Perm n, (∏ i, N (σ i) i) * (ε σ * ε τ) * ∏ i, M (τ i) i :=
(sum_congr rfl fun σ _ =>
Fintype.sum_equiv (Equiv.mulRight σ⁻¹) _ _ fun τ => by
have : (∏ j, M (τ j) (σ j)) = ∏ j, M ((τ * σ⁻¹) j) j := by
rw [← (σ⁻¹ : _ ≃ _).prod_comp]
simp only [Equiv.Perm.coe_mul, apply_inv_self, Function.comp_apply]
have h : ε σ * ε (τ * σ⁻¹) = ε τ :=
calc
ε σ * ε (τ * σ⁻¹) = ε (τ * σ⁻¹ * σ) := by
rw [mul_comm, sign_mul (τ * σ⁻¹)]
simp only [Int.cast_mul, Units.val_mul]
_ = ε τ := by simp only [inv_mul_cancel_right]
simp_rw [Equiv.coe_mulRight, h]
simp only [this])
_ = det M * det N := by
simp only [det_apply', Finset.mul_sum, mul_comm, mul_left_comm, mul_assoc]
#align matrix.det_mul Matrix.det_mul
def detMonoidHom : Matrix n n R →* R where
toFun := det
map_one' := det_one
map_mul' := det_mul
#align matrix.det_monoid_hom Matrix.detMonoidHom
@[simp]
theorem coe_detMonoidHom : (detMonoidHom : Matrix n n R → R) = det :=
rfl
#align matrix.coe_det_monoid_hom Matrix.coe_detMonoidHom
theorem det_mul_comm (M N : Matrix m m R) : det (M * N) = det (N * M) := by
rw [det_mul, det_mul, mul_comm]
#align matrix.det_mul_comm Matrix.det_mul_comm
theorem det_mul_left_comm (M N P : Matrix m m R) : det (M * (N * P)) = det (N * (M * P)) := by
rw [← Matrix.mul_assoc, ← Matrix.mul_assoc, det_mul, det_mul_comm M N, ← det_mul]
#align matrix.det_mul_left_comm Matrix.det_mul_left_comm
theorem det_mul_right_comm (M N P : Matrix m m R) : det (M * N * P) = det (M * P * N) := by
rw [Matrix.mul_assoc, Matrix.mul_assoc, det_mul, det_mul_comm N P, ← det_mul]
#align matrix.det_mul_right_comm Matrix.det_mul_right_comm
-- TODO(mathlib4#6607): fix elaboration so that the ascription isn't needed
theorem det_units_conj (M : (Matrix m m R)ˣ) (N : Matrix m m R) :
det ((M : Matrix _ _ _) * N * (↑M⁻¹ : Matrix _ _ _)) = det N := by
rw [det_mul_right_comm, Units.mul_inv, one_mul]
#align matrix.det_units_conj Matrix.det_units_conj
-- TODO(mathlib4#6607): fix elaboration so that the ascription isn't needed
theorem det_units_conj' (M : (Matrix m m R)ˣ) (N : Matrix m m R) :
det ((↑M⁻¹ : Matrix _ _ _) * N * (↑M : Matrix _ _ _)) = det N :=
det_units_conj M⁻¹ N
#align matrix.det_units_conj' Matrix.det_units_conj'
@[simp]
theorem det_transpose (M : Matrix n n R) : Mᵀ.det = M.det := by
rw [det_apply', det_apply']
refine Fintype.sum_bijective _ inv_involutive.bijective _ _ ?_
intro σ
rw [sign_inv]
congr 1
apply Fintype.prod_equiv σ
intros
simp
#align matrix.det_transpose Matrix.det_transpose
theorem det_permute (σ : Perm n) (M : Matrix n n R) :
(M.submatrix σ id).det = Perm.sign σ * M.det :=
((detRowAlternating : (n → R) [⋀^n]→ₗ[R] R).map_perm M σ).trans (by simp [Units.smul_def])
#align matrix.det_permute Matrix.det_permute
theorem det_permute' (σ : Perm n) (M : Matrix n n R) :
(M.submatrix id σ).det = Perm.sign σ * M.det := by
rw [← det_transpose, transpose_submatrix, det_permute, det_transpose]
@[simp]
theorem det_submatrix_equiv_self (e : n ≃ m) (A : Matrix m m R) :
det (A.submatrix e e) = det A := by
rw [det_apply', det_apply']
apply Fintype.sum_equiv (Equiv.permCongr e)
intro σ
rw [Equiv.Perm.sign_permCongr e σ]
congr 1
apply Fintype.prod_equiv e
intro i
rw [Equiv.permCongr_apply, Equiv.symm_apply_apply, submatrix_apply]
#align matrix.det_submatrix_equiv_self Matrix.det_submatrix_equiv_self
theorem det_reindex_self (e : m ≃ n) (A : Matrix m m R) : det (reindex e e A) = det A :=
det_submatrix_equiv_self e.symm A
#align matrix.det_reindex_self Matrix.det_reindex_self
theorem det_smul (A : Matrix n n R) (c : R) : det (c • A) = c ^ Fintype.card n * det A :=
calc
det (c • A) = det ((diagonal fun _ => c) * A) := by rw [smul_eq_diagonal_mul]
_ = det (diagonal fun _ => c) * det A := det_mul _ _
_ = c ^ Fintype.card n * det A := by simp [card_univ]
#align matrix.det_smul Matrix.det_smul
@[simp]
theorem det_smul_of_tower {α} [Monoid α] [DistribMulAction α R] [IsScalarTower α R R]
[SMulCommClass α R R] (c : α) (A : Matrix n n R) :
det (c • A) = c ^ Fintype.card n • det A := by
rw [← smul_one_smul R c A, det_smul, smul_pow, one_pow, smul_mul_assoc, one_mul]
#align matrix.det_smul_of_tower Matrix.det_smul_of_tower
theorem det_neg (A : Matrix n n R) : det (-A) = (-1) ^ Fintype.card n * det A := by
rw [← det_smul, neg_one_smul]
#align matrix.det_neg Matrix.det_neg
theorem det_neg_eq_smul (A : Matrix n n R) :
det (-A) = (-1 : Units ℤ) ^ Fintype.card n • det A := by
rw [← det_smul_of_tower, Units.neg_smul, one_smul]
#align matrix.det_neg_eq_smul Matrix.det_neg_eq_smul
theorem det_mul_row (v : n → R) (A : Matrix n n R) :
det (of fun i j => v j * A i j) = (∏ i, v i) * det A :=
calc
det (of fun i j => v j * A i j) = det (A * diagonal v) :=
congr_arg det <| by
ext
simp [mul_comm]
_ = (∏ i, v i) * det A := by rw [det_mul, det_diagonal, mul_comm]
#align matrix.det_mul_row Matrix.det_mul_row
theorem det_mul_column (v : n → R) (A : Matrix n n R) :
det (of fun i j => v i * A i j) = (∏ i, v i) * det A :=
MultilinearMap.map_smul_univ _ v A
#align matrix.det_mul_column Matrix.det_mul_column
@[simp]
theorem det_pow (M : Matrix m m R) (n : ℕ) : det (M ^ n) = det M ^ n :=
(detMonoidHom : Matrix m m R →* R).map_pow M n
#align matrix.det_pow Matrix.det_pow
@[simp]
theorem det_conjTranspose [StarRing R] (M : Matrix m m R) : det Mᴴ = star (det M) :=
((starRingEnd R).map_det _).symm.trans <| congr_arg star M.det_transpose
#align matrix.det_conj_transpose Matrix.det_conjTranspose
theorem det_updateRow_add (M : Matrix n n R) (j : n) (u v : n → R) :
det (updateRow M j <| u + v) = det (updateRow M j u) + det (updateRow M j v) :=
(detRowAlternating : (n → R) [⋀^n]→ₗ[R] R).map_add M j u v
#align matrix.det_update_row_add Matrix.det_updateRow_add
theorem det_updateColumn_add (M : Matrix n n R) (j : n) (u v : n → R) :
det (updateColumn M j <| u + v) = det (updateColumn M j u) + det (updateColumn M j v) := by
rw [← det_transpose, ← updateRow_transpose, det_updateRow_add]
simp [updateRow_transpose, det_transpose]
#align matrix.det_update_column_add Matrix.det_updateColumn_add
theorem det_updateRow_smul (M : Matrix n n R) (j : n) (s : R) (u : n → R) :
det (updateRow M j <| s • u) = s * det (updateRow M j u) :=
(detRowAlternating : (n → R) [⋀^n]→ₗ[R] R).map_smul M j s u
#align matrix.det_update_row_smul Matrix.det_updateRow_smul
theorem det_updateColumn_smul (M : Matrix n n R) (j : n) (s : R) (u : n → R) :
det (updateColumn M j <| s • u) = s * det (updateColumn M j u) := by
rw [← det_transpose, ← updateRow_transpose, det_updateRow_smul]
simp [updateRow_transpose, det_transpose]
#align matrix.det_update_column_smul Matrix.det_updateColumn_smul
theorem det_updateRow_smul' (M : Matrix n n R) (j : n) (s : R) (u : n → R) :
det (updateRow (s • M) j u) = s ^ (Fintype.card n - 1) * det (updateRow M j u) :=
MultilinearMap.map_update_smul _ M j s u
#align matrix.det_update_row_smul' Matrix.det_updateRow_smul'
theorem det_updateColumn_smul' (M : Matrix n n R) (j : n) (s : R) (u : n → R) :
det (updateColumn (s • M) j u) = s ^ (Fintype.card n - 1) * det (updateColumn M j u) := by
rw [← det_transpose, ← updateRow_transpose, transpose_smul, det_updateRow_smul']
simp [updateRow_transpose, det_transpose]
#align matrix.det_update_column_smul' Matrix.det_updateColumn_smul'
theorem det_updateRow_sum_aux (M : Matrix n n R) {j : n} (s : Finset n) (hj : j ∉ s) (c : n → R)
(a : R) :
(M.updateRow j (a • M j + ∑ k ∈ s, (c k) • M k)).det = a • M.det := by
induction s using Finset.induction_on with
| empty => rw [Finset.sum_empty, add_zero, smul_eq_mul, det_updateRow_smul, updateRow_eq_self]
| @insert k _ hk h_ind =>
have h : k ≠ j := fun h ↦ (h ▸ hj) (Finset.mem_insert_self _ _)
rw [Finset.sum_insert hk, add_comm ((c k) • M k), ← add_assoc, det_updateRow_add,
det_updateRow_smul, det_updateRow_eq_zero h, mul_zero, add_zero, h_ind]
exact fun h ↦ hj (Finset.mem_insert_of_mem h)
theorem det_updateRow_sum (A : Matrix n n R) (j : n) (c : n → R) :
(A.updateRow j (∑ k, (c k) • A k)).det = (c j) • A.det := by
convert det_updateRow_sum_aux A (Finset.univ.erase j) (Finset.univ.not_mem_erase j) c (c j)
rw [← Finset.univ.add_sum_erase _ (Finset.mem_univ j)]
theorem det_updateColumn_sum (A : Matrix n n R) (j : n) (c : n → R) :
(A.updateColumn j (fun k ↦ ∑ i, (c i) • A k i)).det = (c j) • A.det := by
rw [← det_transpose, ← updateRow_transpose, ← det_transpose A]
convert det_updateRow_sum A.transpose j c
simp only [smul_eq_mul, Finset.sum_apply, Pi.smul_apply, transpose_apply]
@[simp]
| Mathlib/LinearAlgebra/Matrix/Determinant/Basic.lean | 599 | 664 | theorem det_blockDiagonal {o : Type*} [Fintype o] [DecidableEq o] (M : o → Matrix n n R) :
(blockDiagonal M).det = ∏ k, (M k).det := by |
-- Rewrite the determinants as a sum over permutations.
simp_rw [det_apply']
-- The right hand side is a product of sums, rewrite it as a sum of products.
rw [Finset.prod_sum]
simp_rw [Finset.prod_attach_univ, Finset.univ_pi_univ]
-- We claim that the only permutations contributing to the sum are those that
-- preserve their second component.
let preserving_snd : Finset (Equiv.Perm (n × o)) :=
Finset.univ.filter fun σ => ∀ x, (σ x).snd = x.snd
have mem_preserving_snd :
∀ {σ : Equiv.Perm (n × o)}, σ ∈ preserving_snd ↔ ∀ x, (σ x).snd = x.snd := fun {σ} =>
Finset.mem_filter.trans ⟨fun h => h.2, fun h => ⟨Finset.mem_univ _, h⟩⟩
rw [← Finset.sum_subset (Finset.subset_univ preserving_snd) _]
-- And that these are in bijection with `o → Equiv.Perm m`.
· refine (Finset.sum_bij (fun σ _ => prodCongrLeft fun k ↦ σ k (mem_univ k)) ?_ ?_ ?_ ?_).symm
· intro σ _
rw [mem_preserving_snd]
rintro ⟨-, x⟩
simp only [prodCongrLeft_apply]
· intro σ _ σ' _ eq
ext x hx k
simp only at eq
have :
∀ k x,
prodCongrLeft (fun k => σ k (Finset.mem_univ _)) (k, x) =
prodCongrLeft (fun k => σ' k (Finset.mem_univ _)) (k, x) :=
fun k x => by rw [eq]
simp only [prodCongrLeft_apply, Prod.mk.inj_iff] at this
exact (this k x).1
· intro σ hσ
rw [mem_preserving_snd] at hσ
have hσ' : ∀ x, (σ⁻¹ x).snd = x.snd := by
intro x
conv_rhs => rw [← Perm.apply_inv_self σ x, hσ]
have mk_apply_eq : ∀ k x, ((σ (x, k)).fst, k) = σ (x, k) := by
intro k x
ext
· simp only
· simp only [hσ]
have mk_inv_apply_eq : ∀ k x, ((σ⁻¹ (x, k)).fst, k) = σ⁻¹ (x, k) := by
intro k x
conv_lhs => rw [← Perm.apply_inv_self σ (x, k)]
ext
· simp only [apply_inv_self]
· simp only [hσ']
refine ⟨fun k _ => ⟨fun x => (σ (x, k)).fst, fun x => (σ⁻¹ (x, k)).fst, ?_, ?_⟩, ?_, ?_⟩
· intro x
simp only [mk_apply_eq, inv_apply_self]
· intro x
simp only [mk_inv_apply_eq, apply_inv_self]
· apply Finset.mem_univ
· ext ⟨k, x⟩
· simp only [coe_fn_mk, prodCongrLeft_apply]
· simp only [prodCongrLeft_apply, hσ]
· intro σ _
rw [Finset.prod_mul_distrib, ← Finset.univ_product_univ, Finset.prod_product_right]
simp only [sign_prodCongrLeft, Units.coe_prod, Int.cast_prod, blockDiagonal_apply_eq,
prodCongrLeft_apply]
· intro σ _ hσ
rw [mem_preserving_snd] at hσ
obtain ⟨⟨k, x⟩, hkx⟩ := not_forall.mp hσ
rw [Finset.prod_eq_zero (Finset.mem_univ (k, x)), mul_zero]
rw [blockDiagonal_apply_ne]
exact hkx
|
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Monomial
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.WithBot
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.Data.Nat.SuccPred
#align_import data.polynomial.degree.definitions from "leanprover-community/mathlib"@"808ea4ebfabeb599f21ec4ae87d6dc969597887f"
-- Porting note: `Mathlib.Data.Nat.Cast.WithTop` should be imported for `Nat.cast_withBot`.
set_option linter.uppercaseLean3 false
noncomputable section
open Finsupp Finset
open Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b c d : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p : R[X]}
def nextCoeff (p : R[X]) : R :=
if p.natDegree = 0 then 0 else p.coeff (p.natDegree - 1)
#align polynomial.next_coeff Polynomial.nextCoeff
lemma nextCoeff_eq_zero :
p.nextCoeff = 0 ↔ p.natDegree = 0 ∨ 0 < p.natDegree ∧ p.coeff (p.natDegree - 1) = 0 := by
simp [nextCoeff, or_iff_not_imp_left, pos_iff_ne_zero]; aesop
lemma nextCoeff_ne_zero : p.nextCoeff ≠ 0 ↔ p.natDegree ≠ 0 ∧ p.coeff (p.natDegree - 1) ≠ 0 := by
simp [nextCoeff]
@[simp]
theorem nextCoeff_C_eq_zero (c : R) : nextCoeff (C c) = 0 := by
rw [nextCoeff]
simp
#align polynomial.next_coeff_C_eq_zero Polynomial.nextCoeff_C_eq_zero
theorem nextCoeff_of_natDegree_pos (hp : 0 < p.natDegree) :
nextCoeff p = p.coeff (p.natDegree - 1) := by
rw [nextCoeff, if_neg]
contrapose! hp
simpa
#align polynomial.next_coeff_of_pos_nat_degree Polynomial.nextCoeff_of_natDegree_pos
variable {p q : R[X]} {ι : Type*}
theorem coeff_natDegree_eq_zero_of_degree_lt (h : degree p < degree q) :
coeff p (natDegree q) = 0 :=
coeff_eq_zero_of_degree_lt (lt_of_lt_of_le h degree_le_natDegree)
#align polynomial.coeff_nat_degree_eq_zero_of_degree_lt Polynomial.coeff_natDegree_eq_zero_of_degree_lt
theorem ne_zero_of_degree_gt {n : WithBot ℕ} (h : n < degree p) : p ≠ 0 :=
mt degree_eq_bot.2 h.ne_bot
#align polynomial.ne_zero_of_degree_gt Polynomial.ne_zero_of_degree_gt
theorem ne_zero_of_degree_ge_degree (hpq : p.degree ≤ q.degree) (hp : p ≠ 0) : q ≠ 0 :=
Polynomial.ne_zero_of_degree_gt
(lt_of_lt_of_le (bot_lt_iff_ne_bot.mpr (by rwa [Ne, Polynomial.degree_eq_bot])) hpq :
q.degree > ⊥)
#align polynomial.ne_zero_of_degree_ge_degree Polynomial.ne_zero_of_degree_ge_degree
theorem ne_zero_of_natDegree_gt {n : ℕ} (h : n < natDegree p) : p ≠ 0 := fun H => by
simp [H, Nat.not_lt_zero] at h
#align polynomial.ne_zero_of_nat_degree_gt Polynomial.ne_zero_of_natDegree_gt
theorem degree_lt_degree (h : natDegree p < natDegree q) : degree p < degree q := by
by_cases hp : p = 0
· simp [hp]
rw [bot_lt_iff_ne_bot]
intro hq
simp [hp, degree_eq_bot.mp hq, lt_irrefl] at h
· rwa [degree_eq_natDegree hp, degree_eq_natDegree <| ne_zero_of_natDegree_gt h, Nat.cast_lt]
#align polynomial.degree_lt_degree Polynomial.degree_lt_degree
theorem natDegree_lt_natDegree_iff (hp : p ≠ 0) : natDegree p < natDegree q ↔ degree p < degree q :=
⟨degree_lt_degree, fun h ↦ by
have hq : q ≠ 0 := ne_zero_of_degree_gt h
rwa [degree_eq_natDegree hp, degree_eq_natDegree hq, Nat.cast_lt] at h⟩
#align polynomial.nat_degree_lt_nat_degree_iff Polynomial.natDegree_lt_natDegree_iff
theorem eq_C_of_degree_le_zero (h : degree p ≤ 0) : p = C (coeff p 0) := by
ext (_ | n)
· simp
rw [coeff_C, if_neg (Nat.succ_ne_zero _), coeff_eq_zero_of_degree_lt]
exact h.trans_lt (WithBot.coe_lt_coe.2 n.succ_pos)
#align polynomial.eq_C_of_degree_le_zero Polynomial.eq_C_of_degree_le_zero
theorem eq_C_of_degree_eq_zero (h : degree p = 0) : p = C (coeff p 0) :=
eq_C_of_degree_le_zero h.le
#align polynomial.eq_C_of_degree_eq_zero Polynomial.eq_C_of_degree_eq_zero
theorem degree_le_zero_iff : degree p ≤ 0 ↔ p = C (coeff p 0) :=
⟨eq_C_of_degree_le_zero, fun h => h.symm ▸ degree_C_le⟩
#align polynomial.degree_le_zero_iff Polynomial.degree_le_zero_iff
theorem degree_add_le (p q : R[X]) : degree (p + q) ≤ max (degree p) (degree q) := by
simpa only [degree, ← support_toFinsupp, toFinsupp_add]
using AddMonoidAlgebra.sup_support_add_le _ _ _
#align polynomial.degree_add_le Polynomial.degree_add_le
theorem degree_add_le_of_degree_le {p q : R[X]} {n : ℕ} (hp : degree p ≤ n) (hq : degree q ≤ n) :
degree (p + q) ≤ n :=
(degree_add_le p q).trans <| max_le hp hq
#align polynomial.degree_add_le_of_degree_le Polynomial.degree_add_le_of_degree_le
theorem degree_add_le_of_le {a b : WithBot ℕ} (hp : degree p ≤ a) (hq : degree q ≤ b) :
degree (p + q) ≤ max a b :=
(p.degree_add_le q).trans <| max_le_max ‹_› ‹_›
theorem natDegree_add_le (p q : R[X]) : natDegree (p + q) ≤ max (natDegree p) (natDegree q) := by
cases' le_max_iff.1 (degree_add_le p q) with h h <;> simp [natDegree_le_natDegree h]
#align polynomial.nat_degree_add_le Polynomial.natDegree_add_le
theorem natDegree_add_le_of_degree_le {p q : R[X]} {n : ℕ} (hp : natDegree p ≤ n)
(hq : natDegree q ≤ n) : natDegree (p + q) ≤ n :=
(natDegree_add_le p q).trans <| max_le hp hq
#align polynomial.nat_degree_add_le_of_degree_le Polynomial.natDegree_add_le_of_degree_le
theorem natDegree_add_le_of_le (hp : natDegree p ≤ m) (hq : natDegree q ≤ n) :
natDegree (p + q) ≤ max m n :=
(p.natDegree_add_le q).trans <| max_le_max ‹_› ‹_›
@[simp]
theorem leadingCoeff_zero : leadingCoeff (0 : R[X]) = 0 :=
rfl
#align polynomial.leading_coeff_zero Polynomial.leadingCoeff_zero
@[simp]
theorem leadingCoeff_eq_zero : leadingCoeff p = 0 ↔ p = 0 :=
⟨fun h =>
Classical.by_contradiction fun hp =>
mt mem_support_iff.1 (Classical.not_not.2 h) (mem_of_max (degree_eq_natDegree hp)),
fun h => h.symm ▸ leadingCoeff_zero⟩
#align polynomial.leading_coeff_eq_zero Polynomial.leadingCoeff_eq_zero
theorem leadingCoeff_ne_zero : leadingCoeff p ≠ 0 ↔ p ≠ 0 := by rw [Ne, leadingCoeff_eq_zero]
#align polynomial.leading_coeff_ne_zero Polynomial.leadingCoeff_ne_zero
theorem leadingCoeff_eq_zero_iff_deg_eq_bot : leadingCoeff p = 0 ↔ degree p = ⊥ := by
rw [leadingCoeff_eq_zero, degree_eq_bot]
#align polynomial.leading_coeff_eq_zero_iff_deg_eq_bot Polynomial.leadingCoeff_eq_zero_iff_deg_eq_bot
lemma natDegree_le_pred (hf : p.natDegree ≤ n) (hn : p.coeff n = 0) : p.natDegree ≤ n - 1 := by
obtain _ | n := n
· exact hf
· refine (Nat.le_succ_iff_eq_or_le.1 hf).resolve_left fun h ↦ ?_
rw [← Nat.succ_eq_add_one, ← h, coeff_natDegree, leadingCoeff_eq_zero] at hn
aesop
theorem natDegree_mem_support_of_nonzero (H : p ≠ 0) : p.natDegree ∈ p.support := by
rw [mem_support_iff]
exact (not_congr leadingCoeff_eq_zero).mpr H
#align polynomial.nat_degree_mem_support_of_nonzero Polynomial.natDegree_mem_support_of_nonzero
theorem natDegree_eq_support_max' (h : p ≠ 0) :
p.natDegree = p.support.max' (nonempty_support_iff.mpr h) :=
(le_max' _ _ <| natDegree_mem_support_of_nonzero h).antisymm <|
max'_le _ _ _ le_natDegree_of_mem_supp
#align polynomial.nat_degree_eq_support_max' Polynomial.natDegree_eq_support_max'
theorem natDegree_C_mul_X_pow_le (a : R) (n : ℕ) : natDegree (C a * X ^ n) ≤ n :=
natDegree_le_iff_degree_le.2 <| degree_C_mul_X_pow_le _ _
#align polynomial.nat_degree_C_mul_X_pow_le Polynomial.natDegree_C_mul_X_pow_le
theorem degree_add_eq_left_of_degree_lt (h : degree q < degree p) : degree (p + q) = degree p :=
le_antisymm (max_eq_left_of_lt h ▸ degree_add_le _ _) <|
degree_le_degree <| by
rw [coeff_add, coeff_natDegree_eq_zero_of_degree_lt h, add_zero]
exact mt leadingCoeff_eq_zero.1 (ne_zero_of_degree_gt h)
#align polynomial.degree_add_eq_left_of_degree_lt Polynomial.degree_add_eq_left_of_degree_lt
theorem degree_add_eq_right_of_degree_lt (h : degree p < degree q) : degree (p + q) = degree q := by
rw [add_comm, degree_add_eq_left_of_degree_lt h]
#align polynomial.degree_add_eq_right_of_degree_lt Polynomial.degree_add_eq_right_of_degree_lt
theorem natDegree_add_eq_left_of_natDegree_lt (h : natDegree q < natDegree p) :
natDegree (p + q) = natDegree p :=
natDegree_eq_of_degree_eq (degree_add_eq_left_of_degree_lt (degree_lt_degree h))
#align polynomial.nat_degree_add_eq_left_of_nat_degree_lt Polynomial.natDegree_add_eq_left_of_natDegree_lt
theorem natDegree_add_eq_right_of_natDegree_lt (h : natDegree p < natDegree q) :
natDegree (p + q) = natDegree q :=
natDegree_eq_of_degree_eq (degree_add_eq_right_of_degree_lt (degree_lt_degree h))
#align polynomial.nat_degree_add_eq_right_of_nat_degree_lt Polynomial.natDegree_add_eq_right_of_natDegree_lt
theorem degree_add_C (hp : 0 < degree p) : degree (p + C a) = degree p :=
add_comm (C a) p ▸ degree_add_eq_right_of_degree_lt <| lt_of_le_of_lt degree_C_le hp
#align polynomial.degree_add_C Polynomial.degree_add_C
@[simp] theorem natDegree_add_C {a : R} : (p + C a).natDegree = p.natDegree := by
rcases eq_or_ne p 0 with rfl | hp
· simp
by_cases hpd : p.degree ≤ 0
· rw [eq_C_of_degree_le_zero hpd, ← C_add, natDegree_C, natDegree_C]
· rw [not_le, degree_eq_natDegree hp, Nat.cast_pos, ← natDegree_C a] at hpd
exact natDegree_add_eq_left_of_natDegree_lt hpd
@[simp] theorem natDegree_C_add {a : R} : (C a + p).natDegree = p.natDegree := by
simp [add_comm _ p]
theorem degree_add_eq_of_leadingCoeff_add_ne_zero (h : leadingCoeff p + leadingCoeff q ≠ 0) :
degree (p + q) = max p.degree q.degree :=
le_antisymm (degree_add_le _ _) <|
match lt_trichotomy (degree p) (degree q) with
| Or.inl hlt => by
rw [degree_add_eq_right_of_degree_lt hlt, max_eq_right_of_lt hlt]
| Or.inr (Or.inl HEq) =>
le_of_not_gt fun hlt : max (degree p) (degree q) > degree (p + q) =>
h <|
show leadingCoeff p + leadingCoeff q = 0 by
rw [HEq, max_self] at hlt
rw [leadingCoeff, leadingCoeff, natDegree_eq_of_degree_eq HEq, ← coeff_add]
exact coeff_natDegree_eq_zero_of_degree_lt hlt
| Or.inr (Or.inr hlt) => by
rw [degree_add_eq_left_of_degree_lt hlt, max_eq_left_of_lt hlt]
#align polynomial.degree_add_eq_of_leading_coeff_add_ne_zero Polynomial.degree_add_eq_of_leadingCoeff_add_ne_zero
lemma natDegree_eq_of_natDegree_add_lt_left (p q : R[X])
(H : natDegree (p + q) < natDegree p) : natDegree p = natDegree q := by
by_contra h
cases Nat.lt_or_lt_of_ne h with
| inl h => exact lt_asymm h (by rwa [natDegree_add_eq_right_of_natDegree_lt h] at H)
| inr h =>
rw [natDegree_add_eq_left_of_natDegree_lt h] at H
exact LT.lt.false H
lemma natDegree_eq_of_natDegree_add_lt_right (p q : R[X])
(H : natDegree (p + q) < natDegree q) : natDegree p = natDegree q :=
(natDegree_eq_of_natDegree_add_lt_left q p (add_comm p q ▸ H)).symm
lemma natDegree_eq_of_natDegree_add_eq_zero (p q : R[X])
(H : natDegree (p + q) = 0) : natDegree p = natDegree q := by
by_cases h₁ : natDegree p = 0; on_goal 1 => by_cases h₂ : natDegree q = 0
· exact h₁.trans h₂.symm
· apply natDegree_eq_of_natDegree_add_lt_right; rwa [H, Nat.pos_iff_ne_zero]
· apply natDegree_eq_of_natDegree_add_lt_left; rwa [H, Nat.pos_iff_ne_zero]
theorem degree_erase_le (p : R[X]) (n : ℕ) : degree (p.erase n) ≤ degree p := by
rcases p with ⟨p⟩
simp only [erase_def, degree, coeff, support]
-- Porting note: simpler convert-free proof to be explicit about definition unfolding
apply sup_mono
rw [Finsupp.support_erase]
apply Finset.erase_subset
#align polynomial.degree_erase_le Polynomial.degree_erase_le
theorem degree_erase_lt (hp : p ≠ 0) : degree (p.erase (natDegree p)) < degree p := by
apply lt_of_le_of_ne (degree_erase_le _ _)
rw [degree_eq_natDegree hp, degree, support_erase]
exact fun h => not_mem_erase _ _ (mem_of_max h)
#align polynomial.degree_erase_lt Polynomial.degree_erase_lt
theorem degree_update_le (p : R[X]) (n : ℕ) (a : R) : degree (p.update n a) ≤ max (degree p) n := by
classical
rw [degree, support_update]
split_ifs
· exact (Finset.max_mono (erase_subset _ _)).trans (le_max_left _ _)
· rw [max_insert, max_comm]
exact le_rfl
#align polynomial.degree_update_le Polynomial.degree_update_le
theorem degree_sum_le (s : Finset ι) (f : ι → R[X]) :
degree (∑ i ∈ s, f i) ≤ s.sup fun b => degree (f b) :=
Finset.cons_induction_on s (by simp only [sum_empty, sup_empty, degree_zero, le_refl])
fun a s has ih =>
calc
degree (∑ i ∈ cons a s has, f i) ≤ max (degree (f a)) (degree (∑ i ∈ s, f i)) := by
rw [Finset.sum_cons]; exact degree_add_le _ _
_ ≤ _ := by rw [sup_cons, sup_eq_max]; exact max_le_max le_rfl ih
#align polynomial.degree_sum_le Polynomial.degree_sum_le
theorem degree_mul_le (p q : R[X]) : degree (p * q) ≤ degree p + degree q := by
simpa only [degree, ← support_toFinsupp, toFinsupp_mul]
using AddMonoidAlgebra.sup_support_mul_le (WithBot.coe_add _ _).le _ _
#align polynomial.degree_mul_le Polynomial.degree_mul_le
theorem degree_mul_le_of_le {a b : WithBot ℕ} (hp : degree p ≤ a) (hq : degree q ≤ b) :
degree (p * q) ≤ a + b :=
(p.degree_mul_le _).trans <| add_le_add ‹_› ‹_›
theorem degree_pow_le (p : R[X]) : ∀ n : ℕ, degree (p ^ n) ≤ n • degree p
| 0 => by rw [pow_zero, zero_nsmul]; exact degree_one_le
| n + 1 =>
calc
degree (p ^ (n + 1)) ≤ degree (p ^ n) + degree p := by
rw [pow_succ]; exact degree_mul_le _ _
_ ≤ _ := by rw [succ_nsmul]; exact add_le_add_right (degree_pow_le _ _) _
#align polynomial.degree_pow_le Polynomial.degree_pow_le
theorem degree_pow_le_of_le {a : WithBot ℕ} (b : ℕ) (hp : degree p ≤ a) :
degree (p ^ b) ≤ b * a := by
induction b with
| zero => simp [degree_one_le]
| succ n hn =>
rw [Nat.cast_succ, add_mul, one_mul, pow_succ]
exact degree_mul_le_of_le hn hp
@[simp]
theorem leadingCoeff_monomial (a : R) (n : ℕ) : leadingCoeff (monomial n a) = a := by
classical
by_cases ha : a = 0
· simp only [ha, (monomial n).map_zero, leadingCoeff_zero]
· rw [leadingCoeff, natDegree_monomial, if_neg ha, coeff_monomial]
simp
#align polynomial.leading_coeff_monomial Polynomial.leadingCoeff_monomial
theorem leadingCoeff_C_mul_X_pow (a : R) (n : ℕ) : leadingCoeff (C a * X ^ n) = a := by
rw [C_mul_X_pow_eq_monomial, leadingCoeff_monomial]
#align polynomial.leading_coeff_C_mul_X_pow Polynomial.leadingCoeff_C_mul_X_pow
theorem leadingCoeff_C_mul_X (a : R) : leadingCoeff (C a * X) = a := by
simpa only [pow_one] using leadingCoeff_C_mul_X_pow a 1
#align polynomial.leading_coeff_C_mul_X Polynomial.leadingCoeff_C_mul_X
@[simp]
theorem leadingCoeff_C (a : R) : leadingCoeff (C a) = a :=
leadingCoeff_monomial a 0
#align polynomial.leading_coeff_C Polynomial.leadingCoeff_C
-- @[simp] -- Porting note (#10618): simp can prove this
theorem leadingCoeff_X_pow (n : ℕ) : leadingCoeff ((X : R[X]) ^ n) = 1 := by
simpa only [C_1, one_mul] using leadingCoeff_C_mul_X_pow (1 : R) n
#align polynomial.leading_coeff_X_pow Polynomial.leadingCoeff_X_pow
-- @[simp] -- Porting note (#10618): simp can prove this
theorem leadingCoeff_X : leadingCoeff (X : R[X]) = 1 := by
simpa only [pow_one] using @leadingCoeff_X_pow R _ 1
#align polynomial.leading_coeff_X Polynomial.leadingCoeff_X
@[simp]
theorem monic_X_pow (n : ℕ) : Monic (X ^ n : R[X]) :=
leadingCoeff_X_pow n
#align polynomial.monic_X_pow Polynomial.monic_X_pow
@[simp]
theorem monic_X : Monic (X : R[X]) :=
leadingCoeff_X
#align polynomial.monic_X Polynomial.monic_X
-- @[simp] -- Porting note (#10618): simp can prove this
theorem leadingCoeff_one : leadingCoeff (1 : R[X]) = 1 :=
leadingCoeff_C 1
#align polynomial.leading_coeff_one Polynomial.leadingCoeff_one
@[simp]
theorem monic_one : Monic (1 : R[X]) :=
leadingCoeff_C _
#align polynomial.monic_one Polynomial.monic_one
theorem Monic.ne_zero {R : Type*} [Semiring R] [Nontrivial R] {p : R[X]} (hp : p.Monic) :
p ≠ 0 := by
rintro rfl
simp [Monic] at hp
#align polynomial.monic.ne_zero Polynomial.Monic.ne_zero
theorem Monic.ne_zero_of_ne (h : (0 : R) ≠ 1) {p : R[X]} (hp : p.Monic) : p ≠ 0 := by
nontriviality R
exact hp.ne_zero
#align polynomial.monic.ne_zero_of_ne Polynomial.Monic.ne_zero_of_ne
theorem monic_of_natDegree_le_of_coeff_eq_one (n : ℕ) (pn : p.natDegree ≤ n) (p1 : p.coeff n = 1) :
Monic p := by
unfold Monic
nontriviality
refine (congr_arg _ <| natDegree_eq_of_le_of_coeff_ne_zero pn ?_).trans p1
exact ne_of_eq_of_ne p1 one_ne_zero
#align polynomial.monic_of_nat_degree_le_of_coeff_eq_one Polynomial.monic_of_natDegree_le_of_coeff_eq_one
theorem monic_of_degree_le_of_coeff_eq_one (n : ℕ) (pn : p.degree ≤ n) (p1 : p.coeff n = 1) :
Monic p :=
monic_of_natDegree_le_of_coeff_eq_one n (natDegree_le_of_degree_le pn) p1
#align polynomial.monic_of_degree_le_of_coeff_eq_one Polynomial.monic_of_degree_le_of_coeff_eq_one
theorem Monic.ne_zero_of_polynomial_ne {r} (hp : Monic p) (hne : q ≠ r) : p ≠ 0 :=
haveI := Nontrivial.of_polynomial_ne hne
hp.ne_zero
#align polynomial.monic.ne_zero_of_polynomial_ne Polynomial.Monic.ne_zero_of_polynomial_ne
theorem leadingCoeff_add_of_degree_lt (h : degree p < degree q) :
leadingCoeff (p + q) = leadingCoeff q := by
have : coeff p (natDegree q) = 0 := coeff_natDegree_eq_zero_of_degree_lt h
simp only [leadingCoeff, natDegree_eq_of_degree_eq (degree_add_eq_right_of_degree_lt h), this,
coeff_add, zero_add]
#align polynomial.leading_coeff_add_of_degree_lt Polynomial.leadingCoeff_add_of_degree_lt
theorem leadingCoeff_add_of_degree_lt' (h : degree q < degree p) :
leadingCoeff (p + q) = leadingCoeff p := by
rw [add_comm]
exact leadingCoeff_add_of_degree_lt h
theorem leadingCoeff_add_of_degree_eq (h : degree p = degree q)
(hlc : leadingCoeff p + leadingCoeff q ≠ 0) :
leadingCoeff (p + q) = leadingCoeff p + leadingCoeff q := by
have : natDegree (p + q) = natDegree p := by
apply natDegree_eq_of_degree_eq
rw [degree_add_eq_of_leadingCoeff_add_ne_zero hlc, h, max_self]
simp only [leadingCoeff, this, natDegree_eq_of_degree_eq h, coeff_add]
#align polynomial.leading_coeff_add_of_degree_eq Polynomial.leadingCoeff_add_of_degree_eq
@[simp]
theorem coeff_mul_degree_add_degree (p q : R[X]) :
coeff (p * q) (natDegree p + natDegree q) = leadingCoeff p * leadingCoeff q :=
calc
coeff (p * q) (natDegree p + natDegree q) =
∑ x ∈ antidiagonal (natDegree p + natDegree q), coeff p x.1 * coeff q x.2 :=
coeff_mul _ _ _
_ = coeff p (natDegree p) * coeff q (natDegree q) := by
refine Finset.sum_eq_single (natDegree p, natDegree q) ?_ ?_
· rintro ⟨i, j⟩ h₁ h₂
rw [mem_antidiagonal] at h₁
by_cases H : natDegree p < i
· rw [coeff_eq_zero_of_degree_lt
(lt_of_le_of_lt degree_le_natDegree (WithBot.coe_lt_coe.2 H)),
zero_mul]
· rw [not_lt_iff_eq_or_lt] at H
cases' H with H H
· subst H
rw [add_left_cancel_iff] at h₁
dsimp at h₁
subst h₁
exact (h₂ rfl).elim
· suffices natDegree q < j by
rw [coeff_eq_zero_of_degree_lt
(lt_of_le_of_lt degree_le_natDegree (WithBot.coe_lt_coe.2 this)),
mul_zero]
by_contra! H'
exact
ne_of_lt (Nat.lt_of_lt_of_le (Nat.add_lt_add_right H j) (Nat.add_le_add_left H' _))
h₁
· intro H
exfalso
apply H
rw [mem_antidiagonal]
#align polynomial.coeff_mul_degree_add_degree Polynomial.coeff_mul_degree_add_degree
theorem degree_mul' (h : leadingCoeff p * leadingCoeff q ≠ 0) :
degree (p * q) = degree p + degree q :=
have hp : p ≠ 0 := by refine mt ?_ h; exact fun hp => by rw [hp, leadingCoeff_zero, zero_mul]
have hq : q ≠ 0 := by refine mt ?_ h; exact fun hq => by rw [hq, leadingCoeff_zero, mul_zero]
le_antisymm (degree_mul_le _ _)
(by
rw [degree_eq_natDegree hp, degree_eq_natDegree hq]
refine le_degree_of_ne_zero (n := natDegree p + natDegree q) ?_
rwa [coeff_mul_degree_add_degree])
#align polynomial.degree_mul' Polynomial.degree_mul'
theorem Monic.degree_mul (hq : Monic q) : degree (p * q) = degree p + degree q :=
letI := Classical.decEq R
if hp : p = 0 then by simp [hp]
else degree_mul' <| by rwa [hq.leadingCoeff, mul_one, Ne, leadingCoeff_eq_zero]
#align polynomial.monic.degree_mul Polynomial.Monic.degree_mul
theorem natDegree_mul' (h : leadingCoeff p * leadingCoeff q ≠ 0) :
natDegree (p * q) = natDegree p + natDegree q :=
have hp : p ≠ 0 := mt leadingCoeff_eq_zero.2 fun h₁ => h <| by rw [h₁, zero_mul]
have hq : q ≠ 0 := mt leadingCoeff_eq_zero.2 fun h₁ => h <| by rw [h₁, mul_zero]
natDegree_eq_of_degree_eq_some <| by
rw [degree_mul' h, Nat.cast_add, degree_eq_natDegree hp, degree_eq_natDegree hq]
#align polynomial.nat_degree_mul' Polynomial.natDegree_mul'
theorem leadingCoeff_mul' (h : leadingCoeff p * leadingCoeff q ≠ 0) :
leadingCoeff (p * q) = leadingCoeff p * leadingCoeff q := by
unfold leadingCoeff
rw [natDegree_mul' h, coeff_mul_degree_add_degree]
rfl
#align polynomial.leading_coeff_mul' Polynomial.leadingCoeff_mul'
theorem monomial_natDegree_leadingCoeff_eq_self (h : p.support.card ≤ 1) :
monomial p.natDegree p.leadingCoeff = p := by
classical
rcases card_support_le_one_iff_monomial.1 h with ⟨n, a, rfl⟩
by_cases ha : a = 0 <;> simp [ha]
#align polynomial.monomial_nat_degree_leading_coeff_eq_self Polynomial.monomial_natDegree_leadingCoeff_eq_self
theorem C_mul_X_pow_eq_self (h : p.support.card ≤ 1) : C p.leadingCoeff * X ^ p.natDegree = p := by
rw [C_mul_X_pow_eq_monomial, monomial_natDegree_leadingCoeff_eq_self h]
#align polynomial.C_mul_X_pow_eq_self Polynomial.C_mul_X_pow_eq_self
theorem leadingCoeff_pow' : leadingCoeff p ^ n ≠ 0 → leadingCoeff (p ^ n) = leadingCoeff p ^ n :=
Nat.recOn n (by simp) fun n ih h => by
have h₁ : leadingCoeff p ^ n ≠ 0 := fun h₁ => h <| by rw [pow_succ, h₁, zero_mul]
have h₂ : leadingCoeff p * leadingCoeff (p ^ n) ≠ 0 := by rwa [pow_succ', ← ih h₁] at h
rw [pow_succ', pow_succ', leadingCoeff_mul' h₂, ih h₁]
#align polynomial.leading_coeff_pow' Polynomial.leadingCoeff_pow'
theorem degree_pow' : ∀ {n : ℕ}, leadingCoeff p ^ n ≠ 0 → degree (p ^ n) = n • degree p
| 0 => fun h => by rw [pow_zero, ← C_1] at *; rw [degree_C h, zero_nsmul]
| n + 1 => fun h => by
have h₁ : leadingCoeff p ^ n ≠ 0 := fun h₁ => h <| by rw [pow_succ, h₁, zero_mul]
have h₂ : leadingCoeff (p ^ n) * leadingCoeff p ≠ 0 := by
rwa [pow_succ, ← leadingCoeff_pow' h₁] at h
rw [pow_succ, degree_mul' h₂, succ_nsmul, degree_pow' h₁]
#align polynomial.degree_pow' Polynomial.degree_pow'
theorem natDegree_pow' {n : ℕ} (h : leadingCoeff p ^ n ≠ 0) : natDegree (p ^ n) = n * natDegree p :=
letI := Classical.decEq R
if hp0 : p = 0 then
if hn0 : n = 0 then by simp [*] else by rw [hp0, zero_pow hn0]; simp
else
have hpn : p ^ n ≠ 0 := fun hpn0 => by
have h1 := h
rw [← leadingCoeff_pow' h1, hpn0, leadingCoeff_zero] at h; exact h rfl
Option.some_inj.1 <|
show (natDegree (p ^ n) : WithBot ℕ) = (n * natDegree p : ℕ) by
rw [← degree_eq_natDegree hpn, degree_pow' h, degree_eq_natDegree hp0]; simp
#align polynomial.nat_degree_pow' Polynomial.natDegree_pow'
theorem leadingCoeff_monic_mul {p q : R[X]} (hp : Monic p) :
leadingCoeff (p * q) = leadingCoeff q := by
rcases eq_or_ne q 0 with (rfl | H)
· simp
· rw [leadingCoeff_mul', hp.leadingCoeff, one_mul]
rwa [hp.leadingCoeff, one_mul, Ne, leadingCoeff_eq_zero]
#align polynomial.leading_coeff_monic_mul Polynomial.leadingCoeff_monic_mul
theorem leadingCoeff_mul_monic {p q : R[X]} (hq : Monic q) :
leadingCoeff (p * q) = leadingCoeff p :=
letI := Classical.decEq R
Decidable.byCases
(fun H : leadingCoeff p = 0 => by
rw [H, leadingCoeff_eq_zero.1 H, zero_mul, leadingCoeff_zero])
fun H : leadingCoeff p ≠ 0 => by
rw [leadingCoeff_mul', hq.leadingCoeff, mul_one]
rwa [hq.leadingCoeff, mul_one]
#align polynomial.leading_coeff_mul_monic Polynomial.leadingCoeff_mul_monic
@[simp]
theorem leadingCoeff_mul_X_pow {p : R[X]} {n : ℕ} : leadingCoeff (p * X ^ n) = leadingCoeff p :=
leadingCoeff_mul_monic (monic_X_pow n)
#align polynomial.leading_coeff_mul_X_pow Polynomial.leadingCoeff_mul_X_pow
@[simp]
theorem leadingCoeff_mul_X {p : R[X]} : leadingCoeff (p * X) = leadingCoeff p :=
leadingCoeff_mul_monic monic_X
#align polynomial.leading_coeff_mul_X Polynomial.leadingCoeff_mul_X
theorem natDegree_mul_le {p q : R[X]} : natDegree (p * q) ≤ natDegree p + natDegree q := by
apply natDegree_le_of_degree_le
apply le_trans (degree_mul_le p q)
rw [Nat.cast_add]
apply add_le_add <;> apply degree_le_natDegree
#align polynomial.nat_degree_mul_le Polynomial.natDegree_mul_le
theorem natDegree_mul_le_of_le (hp : natDegree p ≤ m) (hg : natDegree q ≤ n) :
natDegree (p * q) ≤ m + n :=
natDegree_mul_le.trans <| add_le_add ‹_› ‹_›
theorem natDegree_pow_le {p : R[X]} {n : ℕ} : (p ^ n).natDegree ≤ n * p.natDegree := by
induction' n with i hi
· simp
· rw [pow_succ, Nat.succ_mul]
apply le_trans natDegree_mul_le
exact add_le_add_right hi _
#align polynomial.nat_degree_pow_le Polynomial.natDegree_pow_le
theorem natDegree_pow_le_of_le (n : ℕ) (hp : natDegree p ≤ m) :
natDegree (p ^ n) ≤ n * m :=
natDegree_pow_le.trans (Nat.mul_le_mul le_rfl ‹_›)
@[simp]
theorem coeff_pow_mul_natDegree (p : R[X]) (n : ℕ) :
(p ^ n).coeff (n * p.natDegree) = p.leadingCoeff ^ n := by
induction' n with i hi
· simp
· rw [pow_succ, pow_succ, Nat.succ_mul]
by_cases hp1 : p.leadingCoeff ^ i = 0
· rw [hp1, zero_mul]
by_cases hp2 : p ^ i = 0
· rw [hp2, zero_mul, coeff_zero]
· apply coeff_eq_zero_of_natDegree_lt
have h1 : (p ^ i).natDegree < i * p.natDegree := by
refine lt_of_le_of_ne natDegree_pow_le fun h => hp2 ?_
rw [← h, hp1] at hi
exact leadingCoeff_eq_zero.mp hi
calc
(p ^ i * p).natDegree ≤ (p ^ i).natDegree + p.natDegree := natDegree_mul_le
_ < i * p.natDegree + p.natDegree := add_lt_add_right h1 _
· rw [← natDegree_pow' hp1, ← leadingCoeff_pow' hp1]
exact coeff_mul_degree_add_degree _ _
#align polynomial.coeff_pow_mul_nat_degree Polynomial.coeff_pow_mul_natDegree
| Mathlib/Algebra/Polynomial/Degree/Definitions.lean | 1,142 | 1,154 | theorem coeff_mul_add_eq_of_natDegree_le {df dg : ℕ} {f g : R[X]}
(hdf : natDegree f ≤ df) (hdg : natDegree g ≤ dg) :
(f * g).coeff (df + dg) = f.coeff df * g.coeff dg := by |
rw [coeff_mul, Finset.sum_eq_single_of_mem (df, dg)]
· rw [mem_antidiagonal]
rintro ⟨df', dg'⟩ hmem hne
obtain h | hdf' := lt_or_le df df'
· rw [coeff_eq_zero_of_natDegree_lt (hdf.trans_lt h), zero_mul]
obtain h | hdg' := lt_or_le dg dg'
· rw [coeff_eq_zero_of_natDegree_lt (hdg.trans_lt h), mul_zero]
obtain ⟨rfl, rfl⟩ :=
(add_eq_add_iff_eq_and_eq hdf' hdg').mp (mem_antidiagonal.1 hmem)
exact (hne rfl).elim
|
import Mathlib.Order.MinMax
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.Says
#align_import data.set.intervals.basic from "leanprover-community/mathlib"@"3ba15165bd6927679be7c22d6091a87337e3cd0c"
open Function
open OrderDual (toDual ofDual)
variable {α β : Type*}
namespace Set
section PartialOrder
variable [PartialOrder α] {a b c : α}
@[simp]
theorem Icc_self (a : α) : Icc a a = {a} :=
Set.ext <| by simp [Icc, le_antisymm_iff, and_comm]
#align set.Icc_self Set.Icc_self
instance instIccUnique : Unique (Set.Icc a a) where
default := ⟨a, by simp⟩
uniq y := Subtype.ext <| by simpa using y.2
@[simp]
theorem Icc_eq_singleton_iff : Icc a b = {c} ↔ a = c ∧ b = c := by
refine ⟨fun h => ?_, ?_⟩
· have hab : a ≤ b := nonempty_Icc.1 (h.symm.subst <| singleton_nonempty c)
exact
⟨eq_of_mem_singleton <| h.subst <| left_mem_Icc.2 hab,
eq_of_mem_singleton <| h.subst <| right_mem_Icc.2 hab⟩
· rintro ⟨rfl, rfl⟩
exact Icc_self _
#align set.Icc_eq_singleton_iff Set.Icc_eq_singleton_iff
lemma subsingleton_Icc_of_ge (hba : b ≤ a) : Set.Subsingleton (Icc a b) :=
fun _x ⟨hax, hxb⟩ _y ⟨hay, hyb⟩ ↦ le_antisymm
(le_implies_le_of_le_of_le hxb hay hba) (le_implies_le_of_le_of_le hyb hax hba)
#align set.subsingleton_Icc_of_ge Set.subsingleton_Icc_of_ge
@[simp] lemma subsingleton_Icc_iff {α : Type*} [LinearOrder α] {a b : α} :
Set.Subsingleton (Icc a b) ↔ b ≤ a := by
refine ⟨fun h ↦ ?_, subsingleton_Icc_of_ge⟩
contrapose! h
simp only [ge_iff_le, gt_iff_lt, not_subsingleton_iff]
exact ⟨a, ⟨le_refl _, h.le⟩, b, ⟨h.le, le_refl _⟩, h.ne⟩
@[simp]
theorem Icc_diff_left : Icc a b \ {a} = Ioc a b :=
ext fun x => by simp [lt_iff_le_and_ne, eq_comm, and_right_comm]
#align set.Icc_diff_left Set.Icc_diff_left
@[simp]
theorem Icc_diff_right : Icc a b \ {b} = Ico a b :=
ext fun x => by simp [lt_iff_le_and_ne, and_assoc]
#align set.Icc_diff_right Set.Icc_diff_right
@[simp]
theorem Ico_diff_left : Ico a b \ {a} = Ioo a b :=
ext fun x => by simp [and_right_comm, ← lt_iff_le_and_ne, eq_comm]
#align set.Ico_diff_left Set.Ico_diff_left
@[simp]
theorem Ioc_diff_right : Ioc a b \ {b} = Ioo a b :=
ext fun x => by simp [and_assoc, ← lt_iff_le_and_ne]
#align set.Ioc_diff_right Set.Ioc_diff_right
@[simp]
theorem Icc_diff_both : Icc a b \ {a, b} = Ioo a b := by
rw [insert_eq, ← diff_diff, Icc_diff_left, Ioc_diff_right]
#align set.Icc_diff_both Set.Icc_diff_both
@[simp]
theorem Ici_diff_left : Ici a \ {a} = Ioi a :=
ext fun x => by simp [lt_iff_le_and_ne, eq_comm]
#align set.Ici_diff_left Set.Ici_diff_left
@[simp]
theorem Iic_diff_right : Iic a \ {a} = Iio a :=
ext fun x => by simp [lt_iff_le_and_ne]
#align set.Iic_diff_right Set.Iic_diff_right
@[simp]
theorem Ico_diff_Ioo_same (h : a < b) : Ico a b \ Ioo a b = {a} := by
rw [← Ico_diff_left, diff_diff_cancel_left (singleton_subset_iff.2 <| left_mem_Ico.2 h)]
#align set.Ico_diff_Ioo_same Set.Ico_diff_Ioo_same
@[simp]
theorem Ioc_diff_Ioo_same (h : a < b) : Ioc a b \ Ioo a b = {b} := by
rw [← Ioc_diff_right, diff_diff_cancel_left (singleton_subset_iff.2 <| right_mem_Ioc.2 h)]
#align set.Ioc_diff_Ioo_same Set.Ioc_diff_Ioo_same
@[simp]
theorem Icc_diff_Ico_same (h : a ≤ b) : Icc a b \ Ico a b = {b} := by
rw [← Icc_diff_right, diff_diff_cancel_left (singleton_subset_iff.2 <| right_mem_Icc.2 h)]
#align set.Icc_diff_Ico_same Set.Icc_diff_Ico_same
@[simp]
theorem Icc_diff_Ioc_same (h : a ≤ b) : Icc a b \ Ioc a b = {a} := by
rw [← Icc_diff_left, diff_diff_cancel_left (singleton_subset_iff.2 <| left_mem_Icc.2 h)]
#align set.Icc_diff_Ioc_same Set.Icc_diff_Ioc_same
@[simp]
| Mathlib/Order/Interval/Set/Basic.lean | 860 | 862 | theorem Icc_diff_Ioo_same (h : a ≤ b) : Icc a b \ Ioo a b = {a, b} := by |
rw [← Icc_diff_both, diff_diff_cancel_left]
simp [insert_subset_iff, h]
|
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
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
simpa [(· ∘ ·)] using tendsto_neg_atTop_atBot.comp this
#align filter.tendsto.at_bot_mul Filter.Tendsto.atBot_mul
theorem Filter.Tendsto.atBot_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atBot)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by
have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul_neg hC hg
simpa [(· ∘ ·)] using tendsto_neg_atBot_atTop.comp this
#align filter.tendsto.at_bot_mul_neg Filter.Tendsto.atBot_mul_neg
theorem Filter.Tendsto.mul_atBot {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atBot) : Tendsto (fun x => f x * g x) l atBot := by
simpa only [mul_comm] using hg.atBot_mul hC hf
#align filter.tendsto.mul_at_bot Filter.Tendsto.mul_atBot
theorem Filter.Tendsto.neg_mul_atBot {C : 𝕜} (hC : C < 0) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atBot) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atBot_mul_neg hC hf
#align filter.tendsto.neg_mul_at_bot Filter.Tendsto.neg_mul_atBot
@[simp]
lemma inv_atTop₀ : (atTop : Filter 𝕜)⁻¹ = 𝓝[>] 0 :=
(((atTop_basis_Ioi' (0 : 𝕜)).map _).comp_surjective inv_surjective).eq_of_same_basis <|
(nhdsWithin_Ioi_basis _).congr (by simp) fun a ha ↦ by simp [inv_Ioi (inv_pos.2 ha)]
@[simp] lemma inv_nhdsWithin_Ioi_zero : (𝓝[>] (0 : 𝕜))⁻¹ = atTop := by
rw [← inv_atTop₀, inv_inv]
theorem tendsto_inv_zero_atTop : Tendsto (fun x : 𝕜 => x⁻¹) (𝓝[>] (0 : 𝕜)) atTop :=
inv_nhdsWithin_Ioi_zero.le
#align tendsto_inv_zero_at_top tendsto_inv_zero_atTop
theorem tendsto_inv_atTop_zero' : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝[>] (0 : 𝕜)) :=
inv_atTop₀.le
#align tendsto_inv_at_top_zero' tendsto_inv_atTop_zero'
theorem tendsto_inv_atTop_zero : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝 0) :=
tendsto_inv_atTop_zero'.mono_right inf_le_left
#align tendsto_inv_at_top_zero tendsto_inv_atTop_zero
theorem Filter.Tendsto.div_atTop {a : 𝕜} (h : Tendsto f l (𝓝 a)) (hg : Tendsto g l atTop) :
Tendsto (fun x => f x / g x) l (𝓝 0) := by
simp only [div_eq_mul_inv]
exact mul_zero a ▸ h.mul (tendsto_inv_atTop_zero.comp hg)
#align filter.tendsto.div_at_top Filter.Tendsto.div_atTop
theorem Filter.Tendsto.inv_tendsto_atTop (h : Tendsto f l atTop) : Tendsto f⁻¹ l (𝓝 0) :=
tendsto_inv_atTop_zero.comp h
#align filter.tendsto.inv_tendsto_at_top Filter.Tendsto.inv_tendsto_atTop
theorem Filter.Tendsto.inv_tendsto_zero (h : Tendsto f l (𝓝[>] 0)) : Tendsto f⁻¹ l atTop :=
tendsto_inv_zero_atTop.comp h
#align filter.tendsto.inv_tendsto_zero Filter.Tendsto.inv_tendsto_zero
theorem tendsto_pow_neg_atTop {n : ℕ} (hn : n ≠ 0) :
Tendsto (fun x : 𝕜 => x ^ (-(n : ℤ))) atTop (𝓝 0) := by
simpa only [zpow_neg, zpow_natCast] using (@tendsto_pow_atTop 𝕜 _ _ hn).inv_tendsto_atTop
#align tendsto_pow_neg_at_top tendsto_pow_neg_atTop
theorem tendsto_zpow_atTop_zero {n : ℤ} (hn : n < 0) :
Tendsto (fun x : 𝕜 => x ^ n) atTop (𝓝 0) := by
lift -n to ℕ using le_of_lt (neg_pos.mpr hn) with N h
rw [← neg_pos, ← h, Nat.cast_pos] at hn
simpa only [h, neg_neg] using tendsto_pow_neg_atTop hn.ne'
#align tendsto_zpow_at_top_zero tendsto_zpow_atTop_zero
theorem tendsto_const_mul_zpow_atTop_zero {n : ℤ} {c : 𝕜} (hn : n < 0) :
Tendsto (fun x => c * x ^ n) atTop (𝓝 0) :=
mul_zero c ▸ Filter.Tendsto.const_mul c (tendsto_zpow_atTop_zero hn)
#align tendsto_const_mul_zpow_at_top_zero tendsto_const_mul_zpow_atTop_zero
theorem tendsto_const_mul_pow_nhds_iff' {n : ℕ} {c d : 𝕜} :
Tendsto (fun x : 𝕜 => c * x ^ n) atTop (𝓝 d) ↔ (c = 0 ∨ n = 0) ∧ c = d := by
rcases eq_or_ne n 0 with (rfl | hn)
· simp [tendsto_const_nhds_iff]
rcases lt_trichotomy c 0 with (hc | rfl | hc)
· have := tendsto_const_mul_pow_atBot_iff.2 ⟨hn, hc⟩
simp [not_tendsto_nhds_of_tendsto_atBot this, hc.ne, hn]
· simp [tendsto_const_nhds_iff]
· have := tendsto_const_mul_pow_atTop_iff.2 ⟨hn, hc⟩
simp [not_tendsto_nhds_of_tendsto_atTop this, hc.ne', hn]
#align tendsto_const_mul_pow_nhds_iff' tendsto_const_mul_pow_nhds_iff'
| Mathlib/Topology/Algebra/Order/Field.lean | 189 | 191 | theorem tendsto_const_mul_pow_nhds_iff {n : ℕ} {c d : 𝕜} (hc : c ≠ 0) :
Tendsto (fun x : 𝕜 => c * x ^ n) atTop (𝓝 d) ↔ n = 0 ∧ c = d := by |
simp [tendsto_const_mul_pow_nhds_iff', hc]
|
import Mathlib.Order.CompleteLattice
import Mathlib.Order.Cover
import Mathlib.Order.Iterate
import Mathlib.Order.WellFounded
#align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
open Function OrderDual Set
variable {α β : Type*}
@[ext]
class SuccOrder (α : Type*) [Preorder α] where
succ : α → α
le_succ : ∀ a, a ≤ succ a
max_of_succ_le {a} : succ a ≤ a → IsMax a
succ_le_of_lt {a b} : a < b → succ a ≤ b
le_of_lt_succ {a b} : a < succ b → a ≤ b
#align succ_order SuccOrder
#align succ_order.ext_iff SuccOrder.ext_iff
#align succ_order.ext SuccOrder.ext
@[ext]
class PredOrder (α : Type*) [Preorder α] where
pred : α → α
pred_le : ∀ a, pred a ≤ a
min_of_le_pred {a} : a ≤ pred a → IsMin a
le_pred_of_lt {a b} : a < b → a ≤ pred b
le_of_pred_lt {a b} : pred a < b → a ≤ b
#align pred_order PredOrder
#align pred_order.ext PredOrder.ext
#align pred_order.ext_iff PredOrder.ext_iff
instance [Preorder α] [SuccOrder α] :
PredOrder αᵒᵈ where
pred := toDual ∘ SuccOrder.succ ∘ ofDual
pred_le := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
SuccOrder.le_succ, implies_true]
min_of_le_pred h := by apply SuccOrder.max_of_succ_le h
le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h
le_of_pred_lt := SuccOrder.le_of_lt_succ
instance [Preorder α] [PredOrder α] :
SuccOrder αᵒᵈ where
succ := toDual ∘ PredOrder.pred ∘ ofDual
le_succ := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
PredOrder.pred_le, implies_true]
max_of_succ_le h := by apply PredOrder.min_of_le_pred h
succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h
le_of_lt_succ := PredOrder.le_of_pred_lt
namespace Order
section Preorder
variable [Preorder α] [SuccOrder α] {a b : α}
def succ : α → α :=
SuccOrder.succ
#align order.succ Order.succ
theorem le_succ : ∀ a : α, a ≤ succ a :=
SuccOrder.le_succ
#align order.le_succ Order.le_succ
theorem max_of_succ_le {a : α} : succ a ≤ a → IsMax a :=
SuccOrder.max_of_succ_le
#align order.max_of_succ_le Order.max_of_succ_le
theorem succ_le_of_lt {a b : α} : a < b → succ a ≤ b :=
SuccOrder.succ_le_of_lt
#align order.succ_le_of_lt Order.succ_le_of_lt
theorem le_of_lt_succ {a b : α} : a < succ b → a ≤ b :=
SuccOrder.le_of_lt_succ
#align order.le_of_lt_succ Order.le_of_lt_succ
@[simp]
theorem succ_le_iff_isMax : succ a ≤ a ↔ IsMax a :=
⟨max_of_succ_le, fun h => h <| le_succ _⟩
#align order.succ_le_iff_is_max Order.succ_le_iff_isMax
@[simp]
theorem lt_succ_iff_not_isMax : a < succ a ↔ ¬IsMax a :=
⟨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le h⟩
#align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax
alias ⟨_, lt_succ_of_not_isMax⟩ := lt_succ_iff_not_isMax
#align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax
theorem wcovBy_succ (a : α) : a ⩿ succ a :=
⟨le_succ a, fun _ hb => (succ_le_of_lt hb).not_lt⟩
#align order.wcovby_succ Order.wcovBy_succ
theorem covBy_succ_of_not_isMax (h : ¬IsMax a) : a ⋖ succ a :=
(wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h
#align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax
theorem lt_succ_iff_of_not_isMax (ha : ¬IsMax a) : b < succ a ↔ b ≤ a :=
⟨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax ha⟩
#align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax
theorem succ_le_iff_of_not_isMax (ha : ¬IsMax a) : succ a ≤ b ↔ a < b :=
⟨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_lt⟩
#align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax
lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : ¬ IsMax b) : succ a < succ b :=
(lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h
theorem succ_lt_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) :
succ a < succ b ↔ a < b := by
rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha]
#align order.succ_lt_succ_iff_of_not_is_max Order.succ_lt_succ_iff_of_not_isMax
theorem succ_le_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) :
succ a ≤ succ b ↔ a ≤ b := by
rw [succ_le_iff_of_not_isMax ha, lt_succ_iff_of_not_isMax hb]
#align order.succ_le_succ_iff_of_not_is_max Order.succ_le_succ_iff_of_not_isMax
@[simp, mono]
theorem succ_le_succ (h : a ≤ b) : succ a ≤ succ b := by
by_cases hb : IsMax b
· by_cases hba : b ≤ a
· exact (hb <| hba.trans <| le_succ _).trans (le_succ _)
· exact succ_le_of_lt ((h.lt_of_not_le hba).trans_le <| le_succ b)
· rwa [succ_le_iff_of_not_isMax fun ha => hb <| ha.mono h, lt_succ_iff_of_not_isMax hb]
#align order.succ_le_succ Order.succ_le_succ
theorem succ_mono : Monotone (succ : α → α) := fun _ _ => succ_le_succ
#align order.succ_mono Order.succ_mono
theorem le_succ_iterate (k : ℕ) (x : α) : x ≤ succ^[k] x := by
conv_lhs => rw [(by simp only [Function.iterate_id, id] : x = id^[k] x)]
exact Monotone.le_iterate_of_le succ_mono le_succ k x
#align order.le_succ_iterate Order.le_succ_iterate
theorem isMax_iterate_succ_of_eq_of_lt {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
(h_lt : n < m) : IsMax (succ^[n] a) := by
refine max_of_succ_le (le_trans ?_ h_eq.symm.le)
have : succ (succ^[n] a) = succ^[n + 1] a := by rw [Function.iterate_succ', comp]
rw [this]
have h_le : n + 1 ≤ m := Nat.succ_le_of_lt h_lt
exact Monotone.monotone_iterate_of_le_map succ_mono (le_succ a) h_le
#align order.is_max_iterate_succ_of_eq_of_lt Order.isMax_iterate_succ_of_eq_of_lt
theorem isMax_iterate_succ_of_eq_of_ne {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
(h_ne : n ≠ m) : IsMax (succ^[n] a) := by
rcases le_total n m with h | h
· exact isMax_iterate_succ_of_eq_of_lt h_eq (lt_of_le_of_ne h h_ne)
· rw [h_eq]
exact isMax_iterate_succ_of_eq_of_lt h_eq.symm (lt_of_le_of_ne h h_ne.symm)
#align order.is_max_iterate_succ_of_eq_of_ne Order.isMax_iterate_succ_of_eq_of_ne
theorem Iio_succ_of_not_isMax (ha : ¬IsMax a) : Iio (succ a) = Iic a :=
Set.ext fun _ => lt_succ_iff_of_not_isMax ha
#align order.Iio_succ_of_not_is_max Order.Iio_succ_of_not_isMax
theorem Ici_succ_of_not_isMax (ha : ¬IsMax a) : Ici (succ a) = Ioi a :=
Set.ext fun _ => succ_le_iff_of_not_isMax ha
#align order.Ici_succ_of_not_is_max Order.Ici_succ_of_not_isMax
| Mathlib/Order/SuccPred/Basic.lean | 331 | 332 | theorem Ico_succ_right_of_not_isMax (hb : ¬IsMax b) : Ico a (succ b) = Icc a b := by |
rw [← Ici_inter_Iio, Iio_succ_of_not_isMax hb, Ici_inter_Iic]
|
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section Factorial
variable {m n : ℕ}
@[simp] theorem factorial_zero : 0! = 1 :=
rfl
#align nat.factorial_zero Nat.factorial_zero
theorem factorial_succ (n : ℕ) : (n + 1)! = (n + 1) * n ! :=
rfl
#align nat.factorial_succ Nat.factorial_succ
@[simp] theorem factorial_one : 1! = 1 :=
rfl
#align nat.factorial_one Nat.factorial_one
@[simp] theorem factorial_two : 2! = 2 :=
rfl
#align nat.factorial_two Nat.factorial_two
theorem mul_factorial_pred (hn : 0 < n) : n * (n - 1)! = n ! :=
Nat.sub_add_cancel (Nat.succ_le_of_lt hn) ▸ rfl
#align nat.mul_factorial_pred Nat.mul_factorial_pred
theorem factorial_pos : ∀ n, 0 < n !
| 0 => Nat.zero_lt_one
| succ n => Nat.mul_pos (succ_pos _) (factorial_pos n)
#align nat.factorial_pos Nat.factorial_pos
theorem factorial_ne_zero (n : ℕ) : n ! ≠ 0 :=
ne_of_gt (factorial_pos _)
#align nat.factorial_ne_zero Nat.factorial_ne_zero
theorem factorial_dvd_factorial {m n} (h : m ≤ n) : m ! ∣ n ! := by
induction' h with n _ ih
· exact Nat.dvd_refl _
· exact Nat.dvd_trans ih (Nat.dvd_mul_left _ _)
#align nat.factorial_dvd_factorial Nat.factorial_dvd_factorial
theorem dvd_factorial : ∀ {m n}, 0 < m → m ≤ n → m ∣ n !
| succ _, _, _, h => Nat.dvd_trans (Nat.dvd_mul_right _ _) (factorial_dvd_factorial h)
#align nat.dvd_factorial Nat.dvd_factorial
@[mono, gcongr]
theorem factorial_le {m n} (h : m ≤ n) : m ! ≤ n ! :=
le_of_dvd (factorial_pos _) (factorial_dvd_factorial h)
#align nat.factorial_le Nat.factorial_le
theorem factorial_mul_pow_le_factorial : ∀ {m n : ℕ}, m ! * (m + 1) ^ n ≤ (m + n)!
| m, 0 => by simp
| m, n + 1 => by
rw [← Nat.add_assoc, factorial_succ, Nat.mul_comm (_ + 1), Nat.pow_succ, ← Nat.mul_assoc]
exact Nat.mul_le_mul factorial_mul_pow_le_factorial (succ_le_succ (le_add_right _ _))
#align nat.factorial_mul_pow_le_factorial Nat.factorial_mul_pow_le_factorial
theorem factorial_lt (hn : 0 < n) : n ! < m ! ↔ n < m := by
refine ⟨fun h => not_le.mp fun hmn => Nat.not_le_of_lt h (factorial_le hmn), fun h => ?_⟩
have : ∀ {n}, 0 < n → n ! < (n + 1)! := by
intro k hk
rw [factorial_succ, succ_mul, Nat.lt_add_left_iff_pos]
exact Nat.mul_pos hk k.factorial_pos
induction' h with k hnk ih generalizing hn
· exact this hn
· exact lt_trans (ih hn) $ this <| lt_trans hn <| lt_of_succ_le hnk
#align nat.factorial_lt Nat.factorial_lt
@[gcongr]
lemma factorial_lt_of_lt {m n : ℕ} (hn : 0 < n) (h : n < m) : n ! < m ! := (factorial_lt hn).mpr h
@[simp] lemma one_lt_factorial : 1 < n ! ↔ 1 < n := factorial_lt Nat.one_pos
#align nat.one_lt_factorial Nat.one_lt_factorial
@[simp]
theorem factorial_eq_one : n ! = 1 ↔ n ≤ 1 := by
constructor
· intro h
rw [← not_lt, ← one_lt_factorial, h]
apply lt_irrefl
· rintro (_|_|_) <;> rfl
#align nat.factorial_eq_one Nat.factorial_eq_one
theorem factorial_inj (hn : 1 < n) : n ! = m ! ↔ n = m := by
refine ⟨fun h => ?_, congr_arg _⟩
obtain hnm | rfl | hnm := lt_trichotomy n m
· rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm
cases lt_irrefl _ hnm
· rfl
rw [← one_lt_factorial, h, one_lt_factorial] at hn
rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm
cases lt_irrefl _ hnm
#align nat.factorial_inj Nat.factorial_inj
theorem factorial_inj' (h : 1 < n ∨ 1 < m) : n ! = m ! ↔ n = m := by
obtain hn|hm := h
· exact factorial_inj hn
· rw [eq_comm, factorial_inj hm, eq_comm]
theorem self_le_factorial : ∀ n : ℕ, n ≤ n !
| 0 => Nat.zero_le _
| k + 1 => Nat.le_mul_of_pos_right _ (Nat.one_le_of_lt k.factorial_pos)
#align nat.self_le_factorial Nat.self_le_factorial
theorem lt_factorial_self {n : ℕ} (hi : 3 ≤ n) : n < n ! := by
have : 0 < n := by omega
have hn : 1 < pred n := le_pred_of_lt (succ_le_iff.mp hi)
rw [← succ_pred_eq_of_pos ‹0 < n›, factorial_succ]
exact (Nat.lt_mul_iff_one_lt_right (pred n).succ_pos).2
((Nat.lt_of_lt_of_le hn (self_le_factorial _)))
#align nat.lt_factorial_self Nat.lt_factorial_self
theorem add_factorial_succ_lt_factorial_add_succ {i : ℕ} (n : ℕ) (hi : 2 ≤ i) :
i + (n + 1)! < (i + n + 1)! := by
rw [factorial_succ (i + _), Nat.add_mul, Nat.one_mul]
have := (i + n).self_le_factorial
refine Nat.add_lt_add_of_lt_of_le (Nat.lt_of_le_of_lt ?_ ((Nat.lt_mul_iff_one_lt_right ?_).2 ?_))
(factorial_le ?_) <;> omega
#align nat.add_factorial_succ_lt_factorial_add_succ Nat.add_factorial_succ_lt_factorial_add_succ
theorem add_factorial_lt_factorial_add {i n : ℕ} (hi : 2 ≤ i) (hn : 1 ≤ n) :
i + n ! < (i + n)! := by
cases hn
· rw [factorial_one]
exact lt_factorial_self (succ_le_succ hi)
exact add_factorial_succ_lt_factorial_add_succ _ hi
#align nat.add_factorial_lt_factorial_add Nat.add_factorial_lt_factorial_add
theorem add_factorial_succ_le_factorial_add_succ (i : ℕ) (n : ℕ) :
i + (n + 1)! ≤ (i + (n + 1))! := by
cases (le_or_lt (2 : ℕ) i)
· rw [← Nat.add_assoc]
apply Nat.le_of_lt
apply add_factorial_succ_lt_factorial_add_succ
assumption
· match i with
| 0 => simp
| 1 =>
rw [← Nat.add_assoc, factorial_succ (1 + n), Nat.add_mul, Nat.one_mul, Nat.add_comm 1 n,
Nat.add_le_add_iff_right]
exact Nat.mul_pos n.succ_pos n.succ.factorial_pos
| succ (succ n) => contradiction
#align nat.add_factorial_succ_le_factorial_add_succ Nat.add_factorial_succ_le_factorial_add_succ
| Mathlib/Data/Nat/Factorial/Basic.lean | 182 | 185 | theorem add_factorial_le_factorial_add (i : ℕ) {n : ℕ} (n1 : 1 ≤ n) : i + n ! ≤ (i + n)! := by |
cases' n1 with h
· exact self_le_factorial _
exact add_factorial_succ_le_factorial_add_succ i h
|
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Limits.Constructions.BinaryProducts
#align_import category_theory.limits.constructions.zero_objects from "leanprover-community/mathlib"@"52a270e2ea4e342c2587c106f8be904524214a4b"
noncomputable section
open CategoryTheory
variable {C : Type*} [Category C]
namespace CategoryTheory.Limits
variable [HasZeroObject C] [HasZeroMorphisms C]
open ZeroObject
def binaryFanZeroLeft (X : C) : BinaryFan (0 : C) X :=
BinaryFan.mk 0 (𝟙 X)
#align category_theory.limits.binary_fan_zero_left CategoryTheory.Limits.binaryFanZeroLeft
def binaryFanZeroLeftIsLimit (X : C) : IsLimit (binaryFanZeroLeft X) :=
BinaryFan.isLimitMk (fun s => BinaryFan.snd s) (by aesop_cat) (by aesop_cat)
(fun s m _ h₂ => by simpa using h₂)
#align category_theory.limits.binary_fan_zero_left_is_limit CategoryTheory.Limits.binaryFanZeroLeftIsLimit
instance hasBinaryProduct_zero_left (X : C) : HasBinaryProduct (0 : C) X :=
HasLimit.mk ⟨_, binaryFanZeroLeftIsLimit X⟩
#align category_theory.limits.has_binary_product_zero_left CategoryTheory.Limits.hasBinaryProduct_zero_left
def zeroProdIso (X : C) : (0 : C) ⨯ X ≅ X :=
limit.isoLimitCone ⟨_, binaryFanZeroLeftIsLimit X⟩
#align category_theory.limits.zero_prod_iso CategoryTheory.Limits.zeroProdIso
@[simp]
theorem zeroProdIso_hom (X : C) : (zeroProdIso X).hom = prod.snd :=
rfl
#align category_theory.limits.zero_prod_iso_hom CategoryTheory.Limits.zeroProdIso_hom
@[simp]
theorem zeroProdIso_inv_snd (X : C) : (zeroProdIso X).inv ≫ prod.snd = 𝟙 X := by
dsimp [zeroProdIso, binaryFanZeroLeft]
simp
#align category_theory.limits.zero_prod_iso_inv_snd CategoryTheory.Limits.zeroProdIso_inv_snd
def binaryFanZeroRight (X : C) : BinaryFan X (0 : C) :=
BinaryFan.mk (𝟙 X) 0
#align category_theory.limits.binary_fan_zero_right CategoryTheory.Limits.binaryFanZeroRight
def binaryFanZeroRightIsLimit (X : C) : IsLimit (binaryFanZeroRight X) :=
BinaryFan.isLimitMk (fun s => BinaryFan.fst s) (by aesop_cat) (by aesop_cat)
(fun s m h₁ _ => by simpa using h₁)
#align category_theory.limits.binary_fan_zero_right_is_limit CategoryTheory.Limits.binaryFanZeroRightIsLimit
instance hasBinaryProduct_zero_right (X : C) : HasBinaryProduct X (0 : C) :=
HasLimit.mk ⟨_, binaryFanZeroRightIsLimit X⟩
#align category_theory.limits.has_binary_product_zero_right CategoryTheory.Limits.hasBinaryProduct_zero_right
def prodZeroIso (X : C) : X ⨯ (0 : C) ≅ X :=
limit.isoLimitCone ⟨_, binaryFanZeroRightIsLimit X⟩
#align category_theory.limits.prod_zero_iso CategoryTheory.Limits.prodZeroIso
@[simp]
theorem prodZeroIso_hom (X : C) : (prodZeroIso X).hom = prod.fst :=
rfl
#align category_theory.limits.prod_zero_iso_hom CategoryTheory.Limits.prodZeroIso_hom
@[simp]
theorem prodZeroIso_iso_inv_snd (X : C) : (prodZeroIso X).inv ≫ prod.fst = 𝟙 X := by
dsimp [prodZeroIso, binaryFanZeroRight]
simp
#align category_theory.limits.prod_zero_iso_iso_inv_snd CategoryTheory.Limits.prodZeroIso_iso_inv_snd
def binaryCofanZeroLeft (X : C) : BinaryCofan (0 : C) X :=
BinaryCofan.mk 0 (𝟙 X)
#align category_theory.limits.binary_cofan_zero_left CategoryTheory.Limits.binaryCofanZeroLeft
def binaryCofanZeroLeftIsColimit (X : C) : IsColimit (binaryCofanZeroLeft X) :=
BinaryCofan.isColimitMk (fun s => BinaryCofan.inr s) (by aesop_cat) (by aesop_cat)
(fun s m _ h₂ => by simpa using h₂)
#align category_theory.limits.binary_cofan_zero_left_is_colimit CategoryTheory.Limits.binaryCofanZeroLeftIsColimit
instance hasBinaryCoproduct_zero_left (X : C) : HasBinaryCoproduct (0 : C) X :=
HasColimit.mk ⟨_, binaryCofanZeroLeftIsColimit X⟩
#align category_theory.limits.has_binary_coproduct_zero_left CategoryTheory.Limits.hasBinaryCoproduct_zero_left
def zeroCoprodIso (X : C) : (0 : C) ⨿ X ≅ X :=
colimit.isoColimitCocone ⟨_, binaryCofanZeroLeftIsColimit X⟩
#align category_theory.limits.zero_coprod_iso CategoryTheory.Limits.zeroCoprodIso
@[simp]
theorem inr_zeroCoprodIso_hom (X : C) : coprod.inr ≫ (zeroCoprodIso X).hom = 𝟙 X := by
dsimp [zeroCoprodIso, binaryCofanZeroLeft]
simp
#align category_theory.limits.inr_zero_coprod_iso_hom CategoryTheory.Limits.inr_zeroCoprodIso_hom
@[simp]
theorem zeroCoprodIso_inv (X : C) : (zeroCoprodIso X).inv = coprod.inr :=
rfl
#align category_theory.limits.zero_coprod_iso_inv CategoryTheory.Limits.zeroCoprodIso_inv
def binaryCofanZeroRight (X : C) : BinaryCofan X (0 : C) :=
BinaryCofan.mk (𝟙 X) 0
#align category_theory.limits.binary_cofan_zero_right CategoryTheory.Limits.binaryCofanZeroRight
def binaryCofanZeroRightIsColimit (X : C) : IsColimit (binaryCofanZeroRight X) :=
BinaryCofan.isColimitMk (fun s => BinaryCofan.inl s) (by aesop_cat) (by aesop_cat)
(fun s m h₁ _ => by simpa using h₁)
#align category_theory.limits.binary_cofan_zero_right_is_colimit CategoryTheory.Limits.binaryCofanZeroRightIsColimit
instance hasBinaryCoproduct_zero_right (X : C) : HasBinaryCoproduct X (0 : C) :=
HasColimit.mk ⟨_, binaryCofanZeroRightIsColimit X⟩
#align category_theory.limits.has_binary_coproduct_zero_right CategoryTheory.Limits.hasBinaryCoproduct_zero_right
def coprodZeroIso (X : C) : X ⨿ (0 : C) ≅ X :=
colimit.isoColimitCocone ⟨_, binaryCofanZeroRightIsColimit X⟩
#align category_theory.limits.coprod_zero_iso CategoryTheory.Limits.coprodZeroIso
@[simp]
theorem inr_coprodZeroIso_hom (X : C) : coprod.inl ≫ (coprodZeroIso X).hom = 𝟙 X := by
dsimp [coprodZeroIso, binaryCofanZeroRight]
simp
#align category_theory.limits.inr_coprod_zeroiso_hom CategoryTheory.Limits.inr_coprodZeroIso_hom
@[simp]
theorem coprodZeroIso_inv (X : C) : (coprodZeroIso X).inv = coprod.inl :=
rfl
#align category_theory.limits.coprod_zero_iso_inv CategoryTheory.Limits.coprodZeroIso_inv
instance hasPullback_over_zero (X Y : C) [HasBinaryProduct X Y] :
HasPullback (0 : X ⟶ 0) (0 : Y ⟶ 0) :=
HasLimit.mk
⟨_, isPullbackOfIsTerminalIsProduct _ _ _ _ HasZeroObject.zeroIsTerminal (prodIsProd X Y)⟩
#align category_theory.limits.has_pullback_over_zero CategoryTheory.Limits.hasPullback_over_zero
def pullbackZeroZeroIso (X Y : C) [HasBinaryProduct X Y] :
pullback (0 : X ⟶ 0) (0 : Y ⟶ 0) ≅ X ⨯ Y :=
limit.isoLimitCone
⟨_, isPullbackOfIsTerminalIsProduct _ _ _ _ HasZeroObject.zeroIsTerminal (prodIsProd X Y)⟩
#align category_theory.limits.pullback_zero_zero_iso CategoryTheory.Limits.pullbackZeroZeroIso
@[simp]
theorem pullbackZeroZeroIso_inv_fst (X Y : C) [HasBinaryProduct X Y] :
(pullbackZeroZeroIso X Y).inv ≫ pullback.fst = prod.fst := by
dsimp [pullbackZeroZeroIso]
simp
#align category_theory.limits.pullback_zero_zero_iso_inv_fst CategoryTheory.Limits.pullbackZeroZeroIso_inv_fst
@[simp]
theorem pullbackZeroZeroIso_inv_snd (X Y : C) [HasBinaryProduct X Y] :
(pullbackZeroZeroIso X Y).inv ≫ pullback.snd = prod.snd := by
dsimp [pullbackZeroZeroIso]
simp
#align category_theory.limits.pullback_zero_zero_iso_inv_snd CategoryTheory.Limits.pullbackZeroZeroIso_inv_snd
@[simp]
theorem pullbackZeroZeroIso_hom_fst (X Y : C) [HasBinaryProduct X Y] :
(pullbackZeroZeroIso X Y).hom ≫ prod.fst = pullback.fst := by simp [← Iso.eq_inv_comp]
#align category_theory.limits.pullback_zero_zero_iso_hom_fst CategoryTheory.Limits.pullbackZeroZeroIso_hom_fst
@[simp]
theorem pullbackZeroZeroIso_hom_snd (X Y : C) [HasBinaryProduct X Y] :
(pullbackZeroZeroIso X Y).hom ≫ prod.snd = pullback.snd := by simp [← Iso.eq_inv_comp]
#align category_theory.limits.pullback_zero_zero_iso_hom_snd CategoryTheory.Limits.pullbackZeroZeroIso_hom_snd
instance hasPushout_over_zero (X Y : C) [HasBinaryCoproduct X Y] :
HasPushout (0 : 0 ⟶ X) (0 : 0 ⟶ Y) :=
HasColimit.mk
⟨_, isPushoutOfIsInitialIsCoproduct _ _ _ _ HasZeroObject.zeroIsInitial (coprodIsCoprod X Y)⟩
#align category_theory.limits.has_pushout_over_zero CategoryTheory.Limits.hasPushout_over_zero
def pushoutZeroZeroIso (X Y : C) [HasBinaryCoproduct X Y] :
pushout (0 : 0 ⟶ X) (0 : 0 ⟶ Y) ≅ X ⨿ Y :=
colimit.isoColimitCocone
⟨_, isPushoutOfIsInitialIsCoproduct _ _ _ _ HasZeroObject.zeroIsInitial (coprodIsCoprod X Y)⟩
#align category_theory.limits.pushout_zero_zero_iso CategoryTheory.Limits.pushoutZeroZeroIso
@[simp]
theorem inl_pushoutZeroZeroIso_hom (X Y : C) [HasBinaryCoproduct X Y] :
pushout.inl ≫ (pushoutZeroZeroIso X Y).hom = coprod.inl := by
dsimp [pushoutZeroZeroIso]
simp
#align category_theory.limits.inl_pushout_zero_zero_iso_hom CategoryTheory.Limits.inl_pushoutZeroZeroIso_hom
@[simp]
theorem inr_pushoutZeroZeroIso_hom (X Y : C) [HasBinaryCoproduct X Y] :
pushout.inr ≫ (pushoutZeroZeroIso X Y).hom = coprod.inr := by
dsimp [pushoutZeroZeroIso]
simp
#align category_theory.limits.inr_pushout_zero_zero_iso_hom CategoryTheory.Limits.inr_pushoutZeroZeroIso_hom
@[simp]
| Mathlib/CategoryTheory/Limits/Constructions/ZeroObjects.lean | 221 | 222 | theorem inl_pushoutZeroZeroIso_inv (X Y : C) [HasBinaryCoproduct X Y] :
coprod.inl ≫ (pushoutZeroZeroIso X Y).inv = pushout.inl := by | simp [Iso.comp_inv_eq]
|
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.Ideal.Prod
import Mathlib.RingTheory.Ideal.MinimalPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.Topology.Sets.Closeds
import Mathlib.Topology.Sober
#align_import algebraic_geometry.prime_spectrum.basic from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
noncomputable section
open scoped Classical
universe u v
variable (R : Type u) (S : Type v)
@[ext]
structure PrimeSpectrum [CommSemiring R] where
asIdeal : Ideal R
IsPrime : asIdeal.IsPrime
#align prime_spectrum PrimeSpectrum
attribute [instance] PrimeSpectrum.IsPrime
namespace PrimeSpectrum
section CommSemiRing
variable [CommSemiring R] [CommSemiring S]
variable {R S}
instance [Nontrivial R] : Nonempty <| PrimeSpectrum R :=
let ⟨I, hI⟩ := Ideal.exists_maximal R
⟨⟨I, hI.isPrime⟩⟩
instance [Subsingleton R] : IsEmpty (PrimeSpectrum R) :=
⟨fun x ↦ x.IsPrime.ne_top <| SetLike.ext' <| Subsingleton.eq_univ_of_nonempty x.asIdeal.nonempty⟩
#noalign prime_spectrum.punit
variable (R S)
@[simp]
def primeSpectrumProdOfSum : Sum (PrimeSpectrum R) (PrimeSpectrum S) → PrimeSpectrum (R × S)
| Sum.inl ⟨I, _⟩ => ⟨Ideal.prod I ⊤, Ideal.isPrime_ideal_prod_top⟩
| Sum.inr ⟨J, _⟩ => ⟨Ideal.prod ⊤ J, Ideal.isPrime_ideal_prod_top'⟩
#align prime_spectrum.prime_spectrum_prod_of_sum PrimeSpectrum.primeSpectrumProdOfSum
noncomputable def primeSpectrumProd :
PrimeSpectrum (R × S) ≃ Sum (PrimeSpectrum R) (PrimeSpectrum S) :=
Equiv.symm <|
Equiv.ofBijective (primeSpectrumProdOfSum R S) (by
constructor
· rintro (⟨I, hI⟩ | ⟨J, hJ⟩) (⟨I', hI'⟩ | ⟨J', hJ'⟩) h <;>
simp only [mk.injEq, Ideal.prod.ext_iff, primeSpectrumProdOfSum] at h
· simp only [h]
· exact False.elim (hI.ne_top h.left)
· exact False.elim (hJ.ne_top h.right)
· simp only [h]
· rintro ⟨I, hI⟩
rcases (Ideal.ideal_prod_prime I).mp hI with (⟨p, ⟨hp, rfl⟩⟩ | ⟨p, ⟨hp, rfl⟩⟩)
· exact ⟨Sum.inl ⟨p, hp⟩, rfl⟩
· exact ⟨Sum.inr ⟨p, hp⟩, rfl⟩)
#align prime_spectrum.prime_spectrum_prod PrimeSpectrum.primeSpectrumProd
variable {R S}
@[simp]
theorem primeSpectrumProd_symm_inl_asIdeal (x : PrimeSpectrum R) :
((primeSpectrumProd R S).symm <| Sum.inl x).asIdeal = Ideal.prod x.asIdeal ⊤ := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inl_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inl_asIdeal
@[simp]
theorem primeSpectrumProd_symm_inr_asIdeal (x : PrimeSpectrum S) :
((primeSpectrumProd R S).symm <| Sum.inr x).asIdeal = Ideal.prod ⊤ x.asIdeal := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inr_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inr_asIdeal
def zeroLocus (s : Set R) : Set (PrimeSpectrum R) :=
{ x | s ⊆ x.asIdeal }
#align prime_spectrum.zero_locus PrimeSpectrum.zeroLocus
@[simp]
theorem mem_zeroLocus (x : PrimeSpectrum R) (s : Set R) : x ∈ zeroLocus s ↔ s ⊆ x.asIdeal :=
Iff.rfl
#align prime_spectrum.mem_zero_locus PrimeSpectrum.mem_zeroLocus
@[simp]
theorem zeroLocus_span (s : Set R) : zeroLocus (Ideal.span s : Set R) = zeroLocus s := by
ext x
exact (Submodule.gi R R).gc s x.asIdeal
#align prime_spectrum.zero_locus_span PrimeSpectrum.zeroLocus_span
def vanishingIdeal (t : Set (PrimeSpectrum R)) : Ideal R :=
⨅ (x : PrimeSpectrum R) (_ : x ∈ t), x.asIdeal
#align prime_spectrum.vanishing_ideal PrimeSpectrum.vanishingIdeal
theorem coe_vanishingIdeal (t : Set (PrimeSpectrum R)) :
(vanishingIdeal t : Set R) = { f : R | ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal } := by
ext f
rw [vanishingIdeal, SetLike.mem_coe, Submodule.mem_iInf]
apply forall_congr'; intro x
rw [Submodule.mem_iInf]
#align prime_spectrum.coe_vanishing_ideal PrimeSpectrum.coe_vanishingIdeal
theorem mem_vanishingIdeal (t : Set (PrimeSpectrum R)) (f : R) :
f ∈ vanishingIdeal t ↔ ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal := by
rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq]
#align prime_spectrum.mem_vanishing_ideal PrimeSpectrum.mem_vanishingIdeal
@[simp]
theorem vanishingIdeal_singleton (x : PrimeSpectrum R) :
vanishingIdeal ({x} : Set (PrimeSpectrum R)) = x.asIdeal := by simp [vanishingIdeal]
#align prime_spectrum.vanishing_ideal_singleton PrimeSpectrum.vanishingIdeal_singleton
theorem subset_zeroLocus_iff_le_vanishingIdeal (t : Set (PrimeSpectrum R)) (I : Ideal R) :
t ⊆ zeroLocus I ↔ I ≤ vanishingIdeal t :=
⟨fun h _ k => (mem_vanishingIdeal _ _).mpr fun _ j => (mem_zeroLocus _ _).mpr (h j) k, fun h =>
fun x j => (mem_zeroLocus _ _).mpr (le_trans h fun _ h => ((mem_vanishingIdeal _ _).mp h) x j)⟩
#align prime_spectrum.subset_zero_locus_iff_le_vanishing_ideal PrimeSpectrum.subset_zeroLocus_iff_le_vanishingIdeal
theorem subset_vanishingIdeal_zeroLocus (s : Set R) : s ⊆ vanishingIdeal (zeroLocus s) :=
(gc_set R).le_u_l s
#align prime_spectrum.subset_vanishing_ideal_zero_locus PrimeSpectrum.subset_vanishingIdeal_zeroLocus
theorem le_vanishingIdeal_zeroLocus (I : Ideal R) : I ≤ vanishingIdeal (zeroLocus I) :=
(gc R).le_u_l I
#align prime_spectrum.le_vanishing_ideal_zero_locus PrimeSpectrum.le_vanishingIdeal_zeroLocus
@[simp]
theorem vanishingIdeal_zeroLocus_eq_radical (I : Ideal R) :
vanishingIdeal (zeroLocus (I : Set R)) = I.radical :=
Ideal.ext fun f => by
rw [mem_vanishingIdeal, Ideal.radical_eq_sInf, Submodule.mem_sInf]
exact ⟨fun h x hx => h ⟨x, hx.2⟩ hx.1, fun h x hx => h x.1 ⟨hx, x.2⟩⟩
#align prime_spectrum.vanishing_ideal_zero_locus_eq_radical PrimeSpectrum.vanishingIdeal_zeroLocus_eq_radical
@[simp]
theorem zeroLocus_radical (I : Ideal R) : zeroLocus (I.radical : Set R) = zeroLocus I :=
vanishingIdeal_zeroLocus_eq_radical I ▸ (gc R).l_u_l_eq_l I
#align prime_spectrum.zero_locus_radical PrimeSpectrum.zeroLocus_radical
theorem subset_zeroLocus_vanishingIdeal (t : Set (PrimeSpectrum R)) :
t ⊆ zeroLocus (vanishingIdeal t) :=
(gc R).l_u_le t
#align prime_spectrum.subset_zero_locus_vanishing_ideal PrimeSpectrum.subset_zeroLocus_vanishingIdeal
theorem zeroLocus_anti_mono {s t : Set R} (h : s ⊆ t) : zeroLocus t ⊆ zeroLocus s :=
(gc_set R).monotone_l h
#align prime_spectrum.zero_locus_anti_mono PrimeSpectrum.zeroLocus_anti_mono
theorem zeroLocus_anti_mono_ideal {s t : Ideal R} (h : s ≤ t) :
zeroLocus (t : Set R) ⊆ zeroLocus (s : Set R) :=
(gc R).monotone_l h
#align prime_spectrum.zero_locus_anti_mono_ideal PrimeSpectrum.zeroLocus_anti_mono_ideal
theorem vanishingIdeal_anti_mono {s t : Set (PrimeSpectrum R)} (h : s ⊆ t) :
vanishingIdeal t ≤ vanishingIdeal s :=
(gc R).monotone_u h
#align prime_spectrum.vanishing_ideal_anti_mono PrimeSpectrum.vanishingIdeal_anti_mono
theorem zeroLocus_subset_zeroLocus_iff (I J : Ideal R) :
zeroLocus (I : Set R) ⊆ zeroLocus (J : Set R) ↔ J ≤ I.radical := by
rw [subset_zeroLocus_iff_le_vanishingIdeal, vanishingIdeal_zeroLocus_eq_radical]
#align prime_spectrum.zero_locus_subset_zero_locus_iff PrimeSpectrum.zeroLocus_subset_zeroLocus_iff
theorem zeroLocus_subset_zeroLocus_singleton_iff (f g : R) :
zeroLocus ({f} : Set R) ⊆ zeroLocus {g} ↔ g ∈ (Ideal.span ({f} : Set R)).radical := by
rw [← zeroLocus_span {f}, ← zeroLocus_span {g}, zeroLocus_subset_zeroLocus_iff, Ideal.span_le,
Set.singleton_subset_iff, SetLike.mem_coe]
#align prime_spectrum.zero_locus_subset_zero_locus_singleton_iff PrimeSpectrum.zeroLocus_subset_zeroLocus_singleton_iff
theorem zeroLocus_bot : zeroLocus ((⊥ : Ideal R) : Set R) = Set.univ :=
(gc R).l_bot
#align prime_spectrum.zero_locus_bot PrimeSpectrum.zeroLocus_bot
@[simp]
theorem zeroLocus_singleton_zero : zeroLocus ({0} : Set R) = Set.univ :=
zeroLocus_bot
#align prime_spectrum.zero_locus_singleton_zero PrimeSpectrum.zeroLocus_singleton_zero
@[simp]
theorem zeroLocus_empty : zeroLocus (∅ : Set R) = Set.univ :=
(gc_set R).l_bot
#align prime_spectrum.zero_locus_empty PrimeSpectrum.zeroLocus_empty
@[simp]
theorem vanishingIdeal_univ : vanishingIdeal (∅ : Set (PrimeSpectrum R)) = ⊤ := by
simpa using (gc R).u_top
#align prime_spectrum.vanishing_ideal_univ PrimeSpectrum.vanishingIdeal_univ
theorem zeroLocus_empty_of_one_mem {s : Set R} (h : (1 : R) ∈ s) : zeroLocus s = ∅ := by
rw [Set.eq_empty_iff_forall_not_mem]
intro x hx
rw [mem_zeroLocus] at hx
have x_prime : x.asIdeal.IsPrime := by infer_instance
have eq_top : x.asIdeal = ⊤ := by
rw [Ideal.eq_top_iff_one]
exact hx h
apply x_prime.ne_top eq_top
#align prime_spectrum.zero_locus_empty_of_one_mem PrimeSpectrum.zeroLocus_empty_of_one_mem
@[simp]
theorem zeroLocus_singleton_one : zeroLocus ({1} : Set R) = ∅ :=
zeroLocus_empty_of_one_mem (Set.mem_singleton (1 : R))
#align prime_spectrum.zero_locus_singleton_one PrimeSpectrum.zeroLocus_singleton_one
theorem zeroLocus_empty_iff_eq_top {I : Ideal R} : zeroLocus (I : Set R) = ∅ ↔ I = ⊤ := by
constructor
· contrapose!
intro h
rcases Ideal.exists_le_maximal I h with ⟨M, hM, hIM⟩
exact ⟨⟨M, hM.isPrime⟩, hIM⟩
· rintro rfl
apply zeroLocus_empty_of_one_mem
trivial
#align prime_spectrum.zero_locus_empty_iff_eq_top PrimeSpectrum.zeroLocus_empty_iff_eq_top
@[simp]
theorem zeroLocus_univ : zeroLocus (Set.univ : Set R) = ∅ :=
zeroLocus_empty_of_one_mem (Set.mem_univ 1)
#align prime_spectrum.zero_locus_univ PrimeSpectrum.zeroLocus_univ
theorem vanishingIdeal_eq_top_iff {s : Set (PrimeSpectrum R)} : vanishingIdeal s = ⊤ ↔ s = ∅ := by
rw [← top_le_iff, ← subset_zeroLocus_iff_le_vanishingIdeal, Submodule.top_coe, zeroLocus_univ,
Set.subset_empty_iff]
#align prime_spectrum.vanishing_ideal_eq_top_iff PrimeSpectrum.vanishingIdeal_eq_top_iff
theorem zeroLocus_sup (I J : Ideal R) :
zeroLocus ((I ⊔ J : Ideal R) : Set R) = zeroLocus I ∩ zeroLocus J :=
(gc R).l_sup
#align prime_spectrum.zero_locus_sup PrimeSpectrum.zeroLocus_sup
theorem zeroLocus_union (s s' : Set R) : zeroLocus (s ∪ s') = zeroLocus s ∩ zeroLocus s' :=
(gc_set R).l_sup
#align prime_spectrum.zero_locus_union PrimeSpectrum.zeroLocus_union
theorem vanishingIdeal_union (t t' : Set (PrimeSpectrum R)) :
vanishingIdeal (t ∪ t') = vanishingIdeal t ⊓ vanishingIdeal t' :=
(gc R).u_inf
#align prime_spectrum.vanishing_ideal_union PrimeSpectrum.vanishingIdeal_union
theorem zeroLocus_iSup {ι : Sort*} (I : ι → Ideal R) :
zeroLocus ((⨆ i, I i : Ideal R) : Set R) = ⋂ i, zeroLocus (I i) :=
(gc R).l_iSup
#align prime_spectrum.zero_locus_supr PrimeSpectrum.zeroLocus_iSup
theorem zeroLocus_iUnion {ι : Sort*} (s : ι → Set R) :
zeroLocus (⋃ i, s i) = ⋂ i, zeroLocus (s i) :=
(gc_set R).l_iSup
#align prime_spectrum.zero_locus_Union PrimeSpectrum.zeroLocus_iUnion
theorem zeroLocus_bUnion (s : Set (Set R)) :
zeroLocus (⋃ s' ∈ s, s' : Set R) = ⋂ s' ∈ s, zeroLocus s' := by simp only [zeroLocus_iUnion]
#align prime_spectrum.zero_locus_bUnion PrimeSpectrum.zeroLocus_bUnion
theorem vanishingIdeal_iUnion {ι : Sort*} (t : ι → Set (PrimeSpectrum R)) :
vanishingIdeal (⋃ i, t i) = ⨅ i, vanishingIdeal (t i) :=
(gc R).u_iInf
#align prime_spectrum.vanishing_ideal_Union PrimeSpectrum.vanishingIdeal_iUnion
theorem zeroLocus_inf (I J : Ideal R) :
zeroLocus ((I ⊓ J : Ideal R) : Set R) = zeroLocus I ∪ zeroLocus J :=
Set.ext fun x => x.2.inf_le
#align prime_spectrum.zero_locus_inf PrimeSpectrum.zeroLocus_inf
theorem union_zeroLocus (s s' : Set R) :
zeroLocus s ∪ zeroLocus s' = zeroLocus (Ideal.span s ⊓ Ideal.span s' : Ideal R) := by
rw [zeroLocus_inf]
simp
#align prime_spectrum.union_zero_locus PrimeSpectrum.union_zeroLocus
theorem zeroLocus_mul (I J : Ideal R) :
zeroLocus ((I * J : Ideal R) : Set R) = zeroLocus I ∪ zeroLocus J :=
Set.ext fun x => x.2.mul_le
#align prime_spectrum.zero_locus_mul PrimeSpectrum.zeroLocus_mul
theorem zeroLocus_singleton_mul (f g : R) :
zeroLocus ({f * g} : Set R) = zeroLocus {f} ∪ zeroLocus {g} :=
Set.ext fun x => by simpa using x.2.mul_mem_iff_mem_or_mem
#align prime_spectrum.zero_locus_singleton_mul PrimeSpectrum.zeroLocus_singleton_mul
@[simp]
theorem zeroLocus_pow (I : Ideal R) {n : ℕ} (hn : n ≠ 0) :
zeroLocus ((I ^ n : Ideal R) : Set R) = zeroLocus I :=
zeroLocus_radical (I ^ n) ▸ (I.radical_pow hn).symm ▸ zeroLocus_radical I
#align prime_spectrum.zero_locus_pow PrimeSpectrum.zeroLocus_pow
@[simp]
theorem zeroLocus_singleton_pow (f : R) (n : ℕ) (hn : 0 < n) :
zeroLocus ({f ^ n} : Set R) = zeroLocus {f} :=
Set.ext fun x => by simpa using x.2.pow_mem_iff_mem n hn
#align prime_spectrum.zero_locus_singleton_pow PrimeSpectrum.zeroLocus_singleton_pow
theorem sup_vanishingIdeal_le (t t' : Set (PrimeSpectrum R)) :
vanishingIdeal t ⊔ vanishingIdeal t' ≤ vanishingIdeal (t ∩ t') := by
intro r
rw [Submodule.mem_sup, mem_vanishingIdeal]
rintro ⟨f, hf, g, hg, rfl⟩ x ⟨hxt, hxt'⟩
rw [mem_vanishingIdeal] at hf hg
apply Submodule.add_mem <;> solve_by_elim
#align prime_spectrum.sup_vanishing_ideal_le PrimeSpectrum.sup_vanishingIdeal_le
theorem mem_compl_zeroLocus_iff_not_mem {f : R} {I : PrimeSpectrum R} :
I ∈ (zeroLocus {f} : Set (PrimeSpectrum R))ᶜ ↔ f ∉ I.asIdeal := by
rw [Set.mem_compl_iff, mem_zeroLocus, Set.singleton_subset_iff]; rfl
#align prime_spectrum.mem_compl_zero_locus_iff_not_mem PrimeSpectrum.mem_compl_zeroLocus_iff_not_mem
instance zariskiTopology : TopologicalSpace (PrimeSpectrum R) :=
TopologicalSpace.ofClosed (Set.range PrimeSpectrum.zeroLocus) ⟨Set.univ, by simp⟩
(by
intro Zs h
rw [Set.sInter_eq_iInter]
choose f hf using fun i : Zs => h i.prop
simp only [← hf]
exact ⟨_, zeroLocus_iUnion _⟩)
(by
rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩
exact ⟨_, (union_zeroLocus s t).symm⟩)
#align prime_spectrum.zariski_topology PrimeSpectrum.zariskiTopology
theorem isOpen_iff (U : Set (PrimeSpectrum R)) : IsOpen U ↔ ∃ s, Uᶜ = zeroLocus s := by
simp only [@eq_comm _ Uᶜ]; rfl
#align prime_spectrum.is_open_iff PrimeSpectrum.isOpen_iff
theorem isClosed_iff_zeroLocus (Z : Set (PrimeSpectrum R)) : IsClosed Z ↔ ∃ s, Z = zeroLocus s := by
rw [← isOpen_compl_iff, isOpen_iff, compl_compl]
#align prime_spectrum.is_closed_iff_zero_locus PrimeSpectrum.isClosed_iff_zeroLocus
theorem isClosed_iff_zeroLocus_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, Z = zeroLocus I :=
(isClosed_iff_zeroLocus _).trans
⟨fun ⟨s, hs⟩ => ⟨_, (zeroLocus_span s).substr hs⟩, fun ⟨I, hI⟩ => ⟨I, hI⟩⟩
#align prime_spectrum.is_closed_iff_zero_locus_ideal PrimeSpectrum.isClosed_iff_zeroLocus_ideal
theorem isClosed_iff_zeroLocus_radical_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, I.IsRadical ∧ Z = zeroLocus I :=
(isClosed_iff_zeroLocus_ideal _).trans
⟨fun ⟨I, hI⟩ => ⟨_, I.radical_isRadical, (zeroLocus_radical I).substr hI⟩, fun ⟨I, _, hI⟩ =>
⟨I, hI⟩⟩
#align prime_spectrum.is_closed_iff_zero_locus_radical_ideal PrimeSpectrum.isClosed_iff_zeroLocus_radical_ideal
theorem isClosed_zeroLocus (s : Set R) : IsClosed (zeroLocus s) := by
rw [isClosed_iff_zeroLocus]
exact ⟨s, rfl⟩
#align prime_spectrum.is_closed_zero_locus PrimeSpectrum.isClosed_zeroLocus
theorem zeroLocus_vanishingIdeal_eq_closure (t : Set (PrimeSpectrum R)) :
zeroLocus (vanishingIdeal t : Set R) = closure t := by
rcases isClosed_iff_zeroLocus (closure t) |>.mp isClosed_closure with ⟨I, hI⟩
rw [subset_antisymm_iff, (isClosed_zeroLocus _).closure_subset_iff, hI,
subset_zeroLocus_iff_subset_vanishingIdeal, (gc R).u_l_u_eq_u,
← subset_zeroLocus_iff_subset_vanishingIdeal, ← hI]
exact ⟨subset_closure, subset_zeroLocus_vanishingIdeal t⟩
#align prime_spectrum.zero_locus_vanishing_ideal_eq_closure PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure
theorem vanishingIdeal_closure (t : Set (PrimeSpectrum R)) :
vanishingIdeal (closure t) = vanishingIdeal t :=
zeroLocus_vanishingIdeal_eq_closure t ▸ (gc R).u_l_u_eq_u t
#align prime_spectrum.vanishing_ideal_closure PrimeSpectrum.vanishingIdeal_closure
theorem closure_singleton (x) : closure ({x} : Set (PrimeSpectrum R)) = zeroLocus x.asIdeal := by
rw [← zeroLocus_vanishingIdeal_eq_closure, vanishingIdeal_singleton]
#align prime_spectrum.closure_singleton PrimeSpectrum.closure_singleton
theorem isClosed_singleton_iff_isMaximal (x : PrimeSpectrum R) :
IsClosed ({x} : Set (PrimeSpectrum R)) ↔ x.asIdeal.IsMaximal := by
rw [← closure_subset_iff_isClosed, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_singleton]
constructor <;> intro H
· rcases x.asIdeal.exists_le_maximal x.2.1 with ⟨m, hm, hxm⟩
exact (congr_arg asIdeal (@H ⟨m, hm.isPrime⟩ hxm)) ▸ hm
· exact fun p hp ↦ PrimeSpectrum.ext _ _ (H.eq_of_le p.2.1 hp).symm
#align prime_spectrum.is_closed_singleton_iff_is_maximal PrimeSpectrum.isClosed_singleton_iff_isMaximal
theorem isRadical_vanishingIdeal (s : Set (PrimeSpectrum R)) : (vanishingIdeal s).IsRadical := by
rw [← vanishingIdeal_closure, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_zeroLocus_eq_radical]
apply Ideal.radical_isRadical
#align prime_spectrum.is_radical_vanishing_ideal PrimeSpectrum.isRadical_vanishingIdeal
theorem vanishingIdeal_anti_mono_iff {s t : Set (PrimeSpectrum R)} (ht : IsClosed t) :
s ⊆ t ↔ vanishingIdeal t ≤ vanishingIdeal s :=
⟨vanishingIdeal_anti_mono, fun h => by
rw [← ht.closure_subset_iff, ← ht.closure_eq]
convert ← zeroLocus_anti_mono_ideal h <;> apply zeroLocus_vanishingIdeal_eq_closure⟩
#align prime_spectrum.vanishing_ideal_anti_mono_iff PrimeSpectrum.vanishingIdeal_anti_mono_iff
theorem vanishingIdeal_strict_anti_mono_iff {s t : Set (PrimeSpectrum R)} (hs : IsClosed s)
(ht : IsClosed t) : s ⊂ t ↔ vanishingIdeal t < vanishingIdeal s := by
rw [Set.ssubset_def, vanishingIdeal_anti_mono_iff hs, vanishingIdeal_anti_mono_iff ht,
lt_iff_le_not_le]
#align prime_spectrum.vanishing_ideal_strict_anti_mono_iff PrimeSpectrum.vanishingIdeal_strict_anti_mono_iff
def closedsEmbedding (R : Type*) [CommSemiring R] :
(TopologicalSpace.Closeds <| PrimeSpectrum R)ᵒᵈ ↪o Ideal R :=
OrderEmbedding.ofMapLEIff (fun s => vanishingIdeal ↑(OrderDual.ofDual s)) fun s _ =>
(vanishingIdeal_anti_mono_iff s.2).symm
#align prime_spectrum.closeds_embedding PrimeSpectrum.closedsEmbedding
theorem t1Space_iff_isField [IsDomain R] : T1Space (PrimeSpectrum R) ↔ IsField R := by
refine ⟨?_, fun h => ?_⟩
· intro h
have hbot : Ideal.IsPrime (⊥ : Ideal R) := Ideal.bot_prime
exact
Classical.not_not.1
(mt
(Ring.ne_bot_of_isMaximal_of_not_isField <|
(isClosed_singleton_iff_isMaximal _).1 (T1Space.t1 ⟨⊥, hbot⟩))
(by aesop))
· refine ⟨fun x => (isClosed_singleton_iff_isMaximal x).2 ?_⟩
by_cases hx : x.asIdeal = ⊥
· letI := h.toSemifield
exact hx.symm ▸ Ideal.bot_isMaximal
· exact absurd h (Ring.not_isField_iff_exists_prime.2 ⟨x.asIdeal, ⟨hx, x.2⟩⟩)
#align prime_spectrum.t1_space_iff_is_field PrimeSpectrum.t1Space_iff_isField
local notation "Z(" a ")" => zeroLocus (a : Set R)
theorem isIrreducible_zeroLocus_iff_of_radical (I : Ideal R) (hI : I.IsRadical) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.IsPrime := by
rw [Ideal.isPrime_iff, IsIrreducible]
apply and_congr
· rw [Set.nonempty_iff_ne_empty, Ne, zeroLocus_empty_iff_eq_top]
· trans ∀ x y : Ideal R, Z(I) ⊆ Z(x) ∪ Z(y) → Z(I) ⊆ Z(x) ∨ Z(I) ⊆ Z(y)
· simp_rw [isPreirreducible_iff_closed_union_closed, isClosed_iff_zeroLocus_ideal]
constructor
· rintro h x y
exact h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
· rintro h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
exact h x y
· simp_rw [← zeroLocus_inf, subset_zeroLocus_iff_le_vanishingIdeal,
vanishingIdeal_zeroLocus_eq_radical, hI.radical]
constructor
· simp_rw [← SetLike.mem_coe, ← Set.singleton_subset_iff, ← Ideal.span_le, ←
Ideal.span_singleton_mul_span_singleton]
refine fun h x y h' => h _ _ ?_
rw [← hI.radical_le_iff] at h' ⊢
simpa only [Ideal.radical_inf, Ideal.radical_mul] using h'
· simp_rw [or_iff_not_imp_left, SetLike.not_le_iff_exists]
rintro h s t h' ⟨x, hx, hx'⟩ y hy
exact h (h' ⟨Ideal.mul_mem_right _ _ hx, Ideal.mul_mem_left _ _ hy⟩) hx'
#align prime_spectrum.is_irreducible_zero_locus_iff_of_radical PrimeSpectrum.isIrreducible_zeroLocus_iff_of_radical
theorem isIrreducible_zeroLocus_iff (I : Ideal R) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.radical.IsPrime :=
zeroLocus_radical I ▸ isIrreducible_zeroLocus_iff_of_radical _ I.radical_isRadical
#align prime_spectrum.is_irreducible_zero_locus_iff PrimeSpectrum.isIrreducible_zeroLocus_iff
theorem isIrreducible_iff_vanishingIdeal_isPrime {s : Set (PrimeSpectrum R)} :
IsIrreducible s ↔ (vanishingIdeal s).IsPrime := by
rw [← isIrreducible_iff_closure, ← zeroLocus_vanishingIdeal_eq_closure,
isIrreducible_zeroLocus_iff_of_radical _ (isRadical_vanishingIdeal s)]
#align prime_spectrum.is_irreducible_iff_vanishing_ideal_is_prime PrimeSpectrum.isIrreducible_iff_vanishingIdeal_isPrime
lemma vanishingIdeal_isIrreducible :
vanishingIdeal (R := R) '' {s | IsIrreducible s} = {P | P.IsPrime} :=
Set.ext fun I ↦ ⟨fun ⟨_, hs, e⟩ ↦ e ▸ isIrreducible_iff_vanishingIdeal_isPrime.mp hs,
fun h ↦ ⟨zeroLocus I, (isIrreducible_zeroLocus_iff_of_radical _ h.isRadical).mpr h,
(vanishingIdeal_zeroLocus_eq_radical I).trans h.radical⟩⟩
lemma vanishingIdeal_isClosed_isIrreducible :
vanishingIdeal (R := R) '' {s | IsClosed s ∧ IsIrreducible s} = {P | P.IsPrime} := by
refine (subset_antisymm ?_ ?_).trans vanishingIdeal_isIrreducible
· exact Set.image_subset _ fun _ ↦ And.right
rintro _ ⟨s, hs, rfl⟩
exact ⟨closure s, ⟨isClosed_closure, hs.closure⟩, vanishingIdeal_closure s⟩
instance irreducibleSpace [IsDomain R] : IrreducibleSpace (PrimeSpectrum R) := by
rw [irreducibleSpace_def, Set.top_eq_univ, ← zeroLocus_bot, isIrreducible_zeroLocus_iff]
simpa using Ideal.bot_prime
instance quasiSober : QuasiSober (PrimeSpectrum R) :=
⟨fun {S} h₁ h₂ =>
⟨⟨_, isIrreducible_iff_vanishingIdeal_isPrime.1 h₁⟩, by
rw [IsGenericPoint, closure_singleton, zeroLocus_vanishingIdeal_eq_closure, h₂.closure_eq]⟩⟩
instance compactSpace : CompactSpace (PrimeSpectrum R) := by
refine compactSpace_of_finite_subfamily_closed fun S S_closed S_empty ↦ ?_
choose I hI using fun i ↦ (isClosed_iff_zeroLocus_ideal (S i)).mp (S_closed i)
simp_rw [hI, ← zeroLocus_iSup, zeroLocus_empty_iff_eq_top, ← top_le_iff] at S_empty ⊢
exact Ideal.isCompactElement_top.exists_finset_of_le_iSup _ _ S_empty
section SpecOfSurjective
open Function RingHom
variable [CommRing R] [CommRing S]
variable (f : R →+* S)
variable {R}
theorem comap_singleton_isClosed_of_surjective (f : R →+* S) (hf : Function.Surjective f)
(x : PrimeSpectrum S) (hx : IsClosed ({x} : Set (PrimeSpectrum S))) :
IsClosed ({comap f x} : Set (PrimeSpectrum R)) :=
haveI : x.asIdeal.IsMaximal := (isClosed_singleton_iff_isMaximal x).1 hx
(isClosed_singleton_iff_isMaximal _).2 (Ideal.comap_isMaximal_of_surjective f hf)
#align prime_spectrum.comap_singleton_is_closed_of_surjective PrimeSpectrum.comap_singleton_isClosed_of_surjective
theorem comap_singleton_isClosed_of_isIntegral (f : R →+* S) (hf : f.IsIntegral)
(x : PrimeSpectrum S) (hx : IsClosed ({x} : Set (PrimeSpectrum S))) :
IsClosed ({comap f x} : Set (PrimeSpectrum R)) :=
have := (isClosed_singleton_iff_isMaximal x).1 hx
(isClosed_singleton_iff_isMaximal _).2
(Ideal.isMaximal_comap_of_isIntegral_of_isMaximal' f hf x.asIdeal)
#align prime_spectrum.comap_singleton_is_closed_of_is_integral PrimeSpectrum.comap_singleton_isClosed_of_isIntegral
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Basic.lean | 729 | 745 | theorem image_comap_zeroLocus_eq_zeroLocus_comap (hf : Surjective f) (I : Ideal S) :
comap f '' zeroLocus I = zeroLocus (I.comap f) := by |
simp only [Set.ext_iff, Set.mem_image, mem_zeroLocus, SetLike.coe_subset_coe]
refine fun p => ⟨?_, fun h_I_p => ?_⟩
· rintro ⟨p, hp, rfl⟩ a ha
exact hp ha
· have hp : ker f ≤ p.asIdeal := (Ideal.comap_mono bot_le).trans h_I_p
refine ⟨⟨p.asIdeal.map f, Ideal.map_isPrime_of_surjective hf hp⟩, fun x hx => ?_, ?_⟩
· obtain ⟨x', rfl⟩ := hf x
exact Ideal.mem_map_of_mem f (h_I_p hx)
· ext x
rw [comap_asIdeal, Ideal.mem_comap, Ideal.mem_map_iff_of_surjective f hf]
refine ⟨?_, fun hx => ⟨x, hx, rfl⟩⟩
rintro ⟨x', hx', heq⟩
rw [← sub_sub_cancel x' x]
refine p.asIdeal.sub_mem hx' (hp ?_)
rwa [mem_ker, map_sub, sub_eq_zero]
|
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
theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} :
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m =
(∏ i, m i) • iteratedDerivWithin n f s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ]
simp
#align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin :
‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
#align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin
@[simp]
theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by
ext x
simp [iteratedDerivWithin]
#align iterated_deriv_within_zero iteratedDerivWithin_zero
@[simp]
theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) :
iteratedDerivWithin 1 f s x = derivWithin f s x := by
simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl
#align iterated_deriv_within_one iteratedDerivWithin_one
theorem contDiffOn_of_continuousOn_differentiableOn_deriv {n : ℕ∞}
(Hcont : ∀ m : ℕ, (m : ℕ∞) ≤ n → ContinuousOn (fun x => iteratedDerivWithin m f s x) s)
(Hdiff : ∀ m : ℕ, (m : ℕ∞) < n → DifferentiableOn 𝕜 (fun x => iteratedDerivWithin m f s x) s) :
ContDiffOn 𝕜 n f s := by
apply contDiffOn_of_continuousOn_differentiableOn
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_continuousOn_iff]
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
#align cont_diff_on_of_continuous_on_differentiable_on_deriv contDiffOn_of_continuousOn_differentiableOn_deriv
theorem contDiffOn_of_differentiableOn_deriv {n : ℕ∞}
(h : ∀ m : ℕ, (m : ℕ∞) ≤ n → DifferentiableOn 𝕜 (iteratedDerivWithin m f s) s) :
ContDiffOn 𝕜 n f s := by
apply contDiffOn_of_differentiableOn
simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
#align cont_diff_on_of_differentiable_on_deriv contDiffOn_of_differentiableOn_deriv
theorem ContDiffOn.continuousOn_iteratedDerivWithin {n : ℕ∞} {m : ℕ} (h : ContDiffOn 𝕜 n f s)
(hmn : (m : ℕ∞) ≤ n) (hs : UniqueDiffOn 𝕜 s) : ContinuousOn (iteratedDerivWithin m f s) s := by
simpa only [iteratedDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_continuousOn_iff] using
h.continuousOn_iteratedFDerivWithin hmn hs
#align cont_diff_on.continuous_on_iterated_deriv_within ContDiffOn.continuousOn_iteratedDerivWithin
theorem ContDiffWithinAt.differentiableWithinAt_iteratedDerivWithin {n : ℕ∞} {m : ℕ}
(h : ContDiffWithinAt 𝕜 n f s x) (hmn : (m : ℕ∞) < n) (hs : UniqueDiffOn 𝕜 (insert x s)) :
DifferentiableWithinAt 𝕜 (iteratedDerivWithin m f s) s x := by
simpa only [iteratedDerivWithin_eq_equiv_comp,
LinearIsometryEquiv.comp_differentiableWithinAt_iff] using
h.differentiableWithinAt_iteratedFDerivWithin hmn hs
#align cont_diff_within_at.differentiable_within_at_iterated_deriv_within ContDiffWithinAt.differentiableWithinAt_iteratedDerivWithin
theorem ContDiffOn.differentiableOn_iteratedDerivWithin {n : ℕ∞} {m : ℕ} (h : ContDiffOn 𝕜 n f s)
(hmn : (m : ℕ∞) < n) (hs : UniqueDiffOn 𝕜 s) :
DifferentiableOn 𝕜 (iteratedDerivWithin m f s) s := fun x hx =>
(h x hx).differentiableWithinAt_iteratedDerivWithin hmn <| by rwa [insert_eq_of_mem hx]
#align cont_diff_on.differentiable_on_iterated_deriv_within ContDiffOn.differentiableOn_iteratedDerivWithin
theorem contDiffOn_iff_continuousOn_differentiableOn_deriv {n : ℕ∞} (hs : UniqueDiffOn 𝕜 s) :
ContDiffOn 𝕜 n f s ↔ (∀ m : ℕ, (m : ℕ∞) ≤ n → ContinuousOn (iteratedDerivWithin m f s) s) ∧
∀ m : ℕ, (m : ℕ∞) < n → DifferentiableOn 𝕜 (iteratedDerivWithin m f s) s := by
simp only [contDiffOn_iff_continuousOn_differentiableOn hs, iteratedFDerivWithin_eq_equiv_comp,
LinearIsometryEquiv.comp_continuousOn_iff, LinearIsometryEquiv.comp_differentiableOn_iff]
#align cont_diff_on_iff_continuous_on_differentiable_on_deriv contDiffOn_iff_continuousOn_differentiableOn_deriv
theorem iteratedDerivWithin_succ {x : 𝕜} (hxs : UniqueDiffWithinAt 𝕜 s x) :
iteratedDerivWithin (n + 1) f s x = derivWithin (iteratedDerivWithin n f s) s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, iteratedFDerivWithin_succ_apply_left,
iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_fderivWithin _ hxs, derivWithin]
change ((ContinuousMultilinearMap.mkPiRing 𝕜 (Fin n) ((fderivWithin 𝕜
(iteratedDerivWithin n f s) s x : 𝕜 → F) 1) : (Fin n → 𝕜) → F) fun i : Fin n => 1) =
(fderivWithin 𝕜 (iteratedDerivWithin n f s) s x : 𝕜 → F) 1
simp
#align iterated_deriv_within_succ iteratedDerivWithin_succ
theorem iteratedDerivWithin_eq_iterate {x : 𝕜} (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) :
iteratedDerivWithin n f s x = (fun g : 𝕜 → F => derivWithin g s)^[n] f x := by
induction' n with n IH generalizing x
· simp
· rw [iteratedDerivWithin_succ (hs x hx), Function.iterate_succ']
exact derivWithin_congr (fun y hy => IH hy) (IH hx)
#align iterated_deriv_within_eq_iterate iteratedDerivWithin_eq_iterate
theorem iteratedDerivWithin_succ' {x : 𝕜} (hxs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) :
iteratedDerivWithin (n + 1) f s x = (iteratedDerivWithin n (derivWithin f s) s) x := by
rw [iteratedDerivWithin_eq_iterate hxs hx, iteratedDerivWithin_eq_iterate hxs hx]; rfl
#align iterated_deriv_within_succ' iteratedDerivWithin_succ'
theorem iteratedDeriv_eq_iteratedFDeriv :
iteratedDeriv n f x = (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_eq_iterated_fderiv iteratedDeriv_eq_iteratedFDeriv
theorem iteratedDeriv_eq_equiv_comp : iteratedDeriv n f =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDeriv 𝕜 n f := by
ext x; rfl
#align iterated_deriv_eq_equiv_comp iteratedDeriv_eq_equiv_comp
theorem iteratedFDeriv_eq_equiv_comp : iteratedFDeriv 𝕜 n f =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDeriv n f := by
rw [iteratedDeriv_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_eq_equiv_comp iteratedFDeriv_eq_equiv_comp
theorem iteratedFDeriv_apply_eq_iteratedDeriv_mul_prod {m : Fin n → 𝕜} :
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) m = (∏ i, m i) • iteratedDeriv n f x := by
rw [iteratedDeriv_eq_iteratedFDeriv, ← ContinuousMultilinearMap.map_smul_univ]; simp
#align iterated_fderiv_apply_eq_iterated_deriv_mul_prod iteratedFDeriv_apply_eq_iteratedDeriv_mul_prod
theorem norm_iteratedFDeriv_eq_norm_iteratedDeriv :
‖iteratedFDeriv 𝕜 n f x‖ = ‖iteratedDeriv n f x‖ := by
rw [iteratedDeriv_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
#align norm_iterated_fderiv_eq_norm_iterated_deriv norm_iteratedFDeriv_eq_norm_iteratedDeriv
@[simp]
theorem iteratedDeriv_zero : iteratedDeriv 0 f = f := by ext x; simp [iteratedDeriv]
#align iterated_deriv_zero iteratedDeriv_zero
@[simp]
theorem iteratedDeriv_one : iteratedDeriv 1 f = deriv f := by ext x; simp [iteratedDeriv]; rfl
#align iterated_deriv_one iteratedDeriv_one
theorem contDiff_iff_iteratedDeriv {n : ℕ∞} : ContDiff 𝕜 n f ↔
(∀ m : ℕ, (m : ℕ∞) ≤ n → Continuous (iteratedDeriv m f)) ∧
∀ m : ℕ, (m : ℕ∞) < n → Differentiable 𝕜 (iteratedDeriv m f) := by
simp only [contDiff_iff_continuous_differentiable, iteratedFDeriv_eq_equiv_comp,
LinearIsometryEquiv.comp_continuous_iff, LinearIsometryEquiv.comp_differentiable_iff]
#align cont_diff_iff_iterated_deriv contDiff_iff_iteratedDeriv
theorem contDiff_of_differentiable_iteratedDeriv {n : ℕ∞}
(h : ∀ m : ℕ, (m : ℕ∞) ≤ n → Differentiable 𝕜 (iteratedDeriv m f)) : ContDiff 𝕜 n f :=
contDiff_iff_iteratedDeriv.2 ⟨fun m hm => (h m hm).continuous, fun m hm => h m (le_of_lt hm)⟩
#align cont_diff_of_differentiable_iterated_deriv contDiff_of_differentiable_iteratedDeriv
theorem ContDiff.continuous_iteratedDeriv {n : ℕ∞} (m : ℕ) (h : ContDiff 𝕜 n f)
(hmn : (m : ℕ∞) ≤ n) : Continuous (iteratedDeriv m f) :=
(contDiff_iff_iteratedDeriv.1 h).1 m hmn
#align cont_diff.continuous_iterated_deriv ContDiff.continuous_iteratedDeriv
theorem ContDiff.differentiable_iteratedDeriv {n : ℕ∞} (m : ℕ) (h : ContDiff 𝕜 n f)
(hmn : (m : ℕ∞) < n) : Differentiable 𝕜 (iteratedDeriv m f) :=
(contDiff_iff_iteratedDeriv.1 h).2 m hmn
#align cont_diff.differentiable_iterated_deriv ContDiff.differentiable_iteratedDeriv
theorem iteratedDeriv_succ : iteratedDeriv (n + 1) f = deriv (iteratedDeriv n f) := by
ext x
rw [← iteratedDerivWithin_univ, ← iteratedDerivWithin_univ, ← derivWithin_univ]
exact iteratedDerivWithin_succ uniqueDiffWithinAt_univ
#align iterated_deriv_succ iteratedDeriv_succ
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 293 | 297 | theorem iteratedDeriv_eq_iterate : iteratedDeriv n f = deriv^[n] f := by |
ext x
rw [← iteratedDerivWithin_univ]
convert iteratedDerivWithin_eq_iterate uniqueDiffOn_univ (F := F) (mem_univ x)
simp [derivWithin_univ]
|
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine
import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle
#align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace EuclideanGeometry
open FiniteDimensional
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)]
theorem oangle_right_eq_arccos_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₂ p₃ p₁ = Real.arccos (dist p₃ p₂ / dist p₁ p₃) := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs,
angle_eq_arccos_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.oangle_right_eq_arccos_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_left_eq_arccos_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₃ p₁ p₂ = Real.arccos (dist p₁ p₂ / dist p₁ p₃) := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm,
angle_eq_arccos_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h),
dist_comm p₁ p₃]
#align euclidean_geometry.oangle_left_eq_arccos_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_right_eq_arcsin_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃) := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs,
angle_eq_arcsin_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(Or.inl (left_ne_of_oangle_eq_pi_div_two h))]
#align euclidean_geometry.oangle_right_eq_arcsin_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_left_eq_arcsin_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₃ p₁ p₂ = Real.arcsin (dist p₃ p₂ / dist p₁ p₃) := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm,
angle_eq_arcsin_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(Or.inr (left_ne_of_oangle_eq_pi_div_two h)),
dist_comm p₁ p₃]
#align euclidean_geometry.oangle_left_eq_arcsin_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_right_eq_arctan_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₂ p₃ p₁ = Real.arctan (dist p₁ p₂ / dist p₃ p₂) := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs,
angle_eq_arctan_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(right_ne_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.oangle_right_eq_arctan_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arctan_of_oangle_eq_pi_div_two
theorem oangle_left_eq_arctan_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
∡ p₃ p₁ p₂ = Real.arctan (dist p₃ p₂ / dist p₁ p₂) := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm,
angle_eq_arctan_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(left_ne_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.oangle_left_eq_arctan_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arctan_of_oangle_eq_pi_div_two
theorem cos_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.cos (∡ p₂ p₃ p₁) = dist p₃ p₂ / dist p₁ p₃ := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe,
cos_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.cos_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_right_of_oangle_eq_pi_div_two
theorem cos_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.cos (∡ p₃ p₁ p₂) = dist p₁ p₂ / dist p₁ p₃ := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.cos_coe,
cos_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h),
dist_comm p₁ p₃]
#align euclidean_geometry.cos_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_left_of_oangle_eq_pi_div_two
theorem sin_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.sin (∡ p₂ p₃ p₁) = dist p₁ p₂ / dist p₁ p₃ := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe,
sin_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(Or.inl (left_ne_of_oangle_eq_pi_div_two h))]
#align euclidean_geometry.sin_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_right_of_oangle_eq_pi_div_two
theorem sin_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.sin (∡ p₃ p₁ p₂) = dist p₃ p₂ / dist p₁ p₃ := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.sin_coe,
sin_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)
(Or.inr (left_ne_of_oangle_eq_pi_div_two h)),
dist_comm p₁ p₃]
#align euclidean_geometry.sin_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_left_of_oangle_eq_pi_div_two
theorem tan_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.tan (∡ p₂ p₃ p₁) = dist p₁ p₂ / dist p₃ p₂ := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe,
tan_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.tan_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_right_of_oangle_eq_pi_div_two
theorem tan_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) :
Real.Angle.tan (∡ p₃ p₁ p₂) = dist p₃ p₂ / dist p₁ p₂ := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.tan_coe,
tan_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.tan_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_left_of_oangle_eq_pi_div_two
theorem cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P}
(h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₂ p₃ p₁) * dist p₁ p₃ = dist p₃ p₂ := by
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe,
cos_angle_mul_dist_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two
theorem cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P}
(h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₃ p₁ p₂) * dist p₁ p₃ = dist p₁ p₂ := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.cos_coe, dist_comm p₁ p₃,
cos_angle_mul_dist_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
#align euclidean_geometry.cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two
| Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean | 709 | 713 | theorem sin_oangle_right_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P}
(h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.sin (∡ p₂ p₃ p₁) * dist p₁ p₃ = dist p₁ p₂ := by |
have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two]
rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe,
sin_angle_mul_dist_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)]
|
import Mathlib.Algebra.CharP.Pi
import Mathlib.Algebra.CharP.Quotient
import Mathlib.Algebra.CharP.Subring
import Mathlib.Algebra.Ring.Pi
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
import Mathlib.FieldTheory.Perfect
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.Algebra.Ring.Subring.Basic
import Mathlib.RingTheory.Valuation.Integers
#align_import ring_theory.perfection from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
universe u₁ u₂ u₃ u₄
open scoped NNReal
def Monoid.perfection (M : Type u₁) [CommMonoid M] (p : ℕ) : Submonoid (ℕ → M) where
carrier := { f | ∀ n, f (n + 1) ^ p = f n }
one_mem' _ := one_pow _
mul_mem' hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n)
#align monoid.perfection Monoid.perfection
def Ring.perfectionSubsemiring (R : Type u₁) [CommSemiring R] (p : ℕ) [hp : Fact p.Prime]
[CharP R p] : Subsemiring (ℕ → R) :=
{ Monoid.perfection R p with
zero_mem' := fun _ ↦ zero_pow hp.1.ne_zero
add_mem' := fun hf hg n => (frobenius_add R p _ _).trans <| congr_arg₂ _ (hf n) (hg n) }
#align ring.perfection_subsemiring Ring.perfectionSubsemiring
def Ring.perfectionSubring (R : Type u₁) [CommRing R] (p : ℕ) [hp : Fact p.Prime] [CharP R p] :
Subring (ℕ → R) :=
(Ring.perfectionSubsemiring R p).toSubring fun n => by
simp_rw [← frobenius_def, Pi.neg_apply, Pi.one_apply, RingHom.map_neg, RingHom.map_one]
#align ring.perfection_subring Ring.perfectionSubring
def Ring.Perfection (R : Type u₁) [CommSemiring R] (p : ℕ) : Type u₁ :=
{ f // ∀ n : ℕ, (f : ℕ → R) (n + 1) ^ p = f n }
#align ring.perfection Ring.Perfection
-- @[nolint has_nonempty_instance] -- Porting note(#5171): This linter does not exist yet.
structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
{P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
injective : ∀ ⦃x y : P⦄,
(∀ n, π (((frobeniusEquiv P p).symm)^[n] x) = π (((frobeniusEquiv P p).symm)^[n] y)) → x = y
surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n,
π (((frobeniusEquiv P p).symm)^[n] x) = f n
#align perfection_map PerfectionMap
section Perfectoid
variable (K : Type u₁) [Field K] (v : Valuation K ℝ≥0)
variable (O : Type u₂) [CommRing O] [Algebra O K] (hv : v.Integers O)
variable (p : ℕ)
-- Porting note: Specified all arguments explicitly
@[nolint unusedArguments] -- Porting note(#5171): removed `nolint has_nonempty_instance`
def ModP (K : Type u₁) [Field K] (v : Valuation K ℝ≥0) (O : Type u₂) [CommRing O] [Algebra O K]
(_ : v.Integers O) (p : ℕ) :=
O ⧸ (Ideal.span {(p : O)} : Ideal O)
#align mod_p ModP
variable [hp : Fact p.Prime] [hvp : Fact (v p ≠ 1)]
namespace ModP
instance commRing : CommRing (ModP K v O hv p) :=
Ideal.Quotient.commRing (Ideal.span {(p : O)} : Ideal O)
instance charP : CharP (ModP K v O hv p) p :=
CharP.quotient O p <| mt hv.one_of_isUnit <| (map_natCast (algebraMap O K) p).symm ▸ hvp.1
instance : Nontrivial (ModP K v O hv p) :=
CharP.nontrivial_of_char_ne_one hp.1.ne_one
section Classical
attribute [local instance] Classical.dec
noncomputable def preVal (x : ModP K v O hv p) : ℝ≥0 :=
if x = 0 then 0 else v (algebraMap O K x.out')
#align mod_p.pre_val ModP.preVal
variable {K v O hv p}
| Mathlib/RingTheory/Perfection.lean | 406 | 413 | theorem preVal_mk {x : O} (hx : (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0) :
preVal K v O hv p (Ideal.Quotient.mk _ x) = v (algebraMap O K x) := by |
obtain ⟨r, hr⟩ : ∃ (a : O), a * (p : O) = (Quotient.mk'' x).out' - x :=
Ideal.mem_span_singleton'.1 <| Ideal.Quotient.eq.1 <| Quotient.sound' <| Quotient.mk_out' _
refine (if_neg hx).trans (v.map_eq_of_sub_lt <| lt_of_not_le ?_)
erw [← RingHom.map_sub, ← hr, hv.le_iff_dvd]
exact fun hprx =>
hx (Ideal.Quotient.eq_zero_iff_mem.2 <| Ideal.mem_span_singleton.2 <| dvd_of_mul_left_dvd hprx)
|
import Mathlib.Order.Interval.Set.Monotone
import Mathlib.Probability.Process.HittingTime
import Mathlib.Probability.Martingale.Basic
import Mathlib.Tactic.AdaptationNote
#align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory Topology
namespace MeasureTheory
variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω}
noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) :
Ω → ι :=
hitting f (Set.Iic a) c N
#align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux
noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
(N : ι) : ℕ → Ω → ι
| 0 => ⊥
| n + 1 => fun ω =>
hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω
#align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime
noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
(N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω
#align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime
section
variable [Preorder ι] [OrderBot ι] [InfSet ι]
variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
@[simp]
theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ :=
rfl
#align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero
@[simp]
theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N :=
rfl
#align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero
theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω =
hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by
rw [upperCrossingTime]
#align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ
theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω =
hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by
simp only [upperCrossingTime_succ]
rfl
#align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq
end
variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω}
theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) :
stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by
obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl
exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩
#align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime
theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) :
b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by
obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl
exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩
#align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime
theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b)
(hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) :
upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by
refine lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h =>
not_le.2 hab <| le_trans ?_ (stoppedValue_lowerCrossingTime hn)
simp only [stoppedValue]
rw [← h]
exact stoppedValue_upperCrossingTime (h.symm ▸ hn)
#align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b)
(hn : upperCrossingTime a b f N (n + 1) ω ≠ N) :
lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by
refine lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h =>
not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) ?_
simp only [stoppedValue]
rw [← h]
exact stoppedValue_lowerCrossingTime (h.symm ▸ hn)
#align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime
theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) :
upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω :=
lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime
(lowerCrossingTime_lt_upperCrossingTime hab hn)
#align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ
theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) :
lowerCrossingTime a b f N m ω = N :=
le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm))
#align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize
theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) :
upperCrossingTime a b f N m ω = N :=
le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm))
#align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize
theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) :
lowerCrossingTime a b f N m ω = N :=
lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn)
#align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize'
theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) :
upperCrossingTime a b f N m ω = N :=
upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn)
#align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize'
-- `upperCrossingTime_bound_eq` provides an explicit bound
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
∃ n, upperCrossingTime a b f N n ω = N := by
by_contra h; push_neg at h
have : StrictMono fun n => upperCrossingTime a b f N n ω :=
strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _)
obtain ⟨_, ⟨k, rfl⟩, hk⟩ :
∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m :=
⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩,
lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
exact not_le.2 hk upperCrossingTime_le
#align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq
theorem upperCrossingTime_lt_bddAbove (hab : a < b) :
BddAbove {n | upperCrossingTime a b f N n ω < N} := by
obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab
refine ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => ?_⟩
by_contra hn'
exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk)
#align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove
theorem upperCrossingTime_lt_nonempty (hN : 0 < N) :
{n | upperCrossingTime a b f N n ω < N}.Nonempty :=
⟨0, hN⟩
#align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
upperCrossingTime a b f N N ω = N := by
by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab)
· refine le_antisymm upperCrossingTime_le ?_
have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω)
(Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by
refine strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab ?_
rw [Nat.lt_pred_iff] at hm
convert Nat.find_min _ hm
convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN')
· rw [not_lt] at hN'
exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab))
#align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq
theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) :
upperCrossingTime a b f N n ω = N :=
le_antisymm upperCrossingTime_le
(le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn))
#align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le
variable {ℱ : Filtration ℕ m0}
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) :
IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧
IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by
induction' n with k ih
· refine ⟨isStoppingTime_const _ 0, ?_⟩
simp [hitting_isStoppingTime hf measurableSet_Iic]
· obtain ⟨_, ih₂⟩ := ih
have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by
intro n
simp_rw [upperCrossingTime_succ_eq]
exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le)
measurableSet_Ici hf _
refine ⟨this, ?_⟩
intro n
exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le)
measurableSet_Iic hf _
#align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing
theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) :
IsStoppingTime ℱ (upperCrossingTime a b f N n) :=
hf.isStoppingTime_crossing.1
#align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime
theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) :
IsStoppingTime ℱ (lowerCrossingTime a b f N n) :=
hf.isStoppingTime_crossing.2
#align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime
noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ :=
∑ k ∈ Finset.range N,
(Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n
#align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat
theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω :=
Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _
#align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by
rw [upcrossingStrat, ← Finset.indicator_biUnion_apply]
· exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
intro i _ j _ hij
simp only [Set.Ico_disjoint_Ico]
obtain hij' | hij' := lt_or_gt_of_ne hij
· rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
max_eq_right (lowerCrossingTime_mono hij'.le :
lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
refine le_trans upperCrossingTime_le_lowerCrossingTime
(lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
· rw [gt_iff_lt] at hij'
rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
max_eq_left (lowerCrossingTime_mono hij'.le :
lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
refine le_trans upperCrossingTime_le_lowerCrossingTime
(lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
#align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) :
Adapted ℱ (upcrossingStrat a b f N) := by
intro n
change StronglyMeasurable[ℱ n] fun ω =>
∑ k ∈ Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩
{n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n
refine Finset.stronglyMeasurable_sum _ fun i _ =>
stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter ?_)
simp_rw [← not_le]
exact (hf.isStoppingTime_upperCrossingTime n).compl
#align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted
theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
(a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ =>
∑ k ∈ Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ :=
hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
upcrossingStrat_nonneg
#align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
(a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ =>
∑ k ∈ Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by
refine hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n))
(?_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) ?_
· exact fun n ω => sub_le_self _ upcrossingStrat_nonneg
· intro n ω
simp [upcrossingStrat_le_one]
#align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) :
μ[∑ k ∈ Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by
have h₁ : (0 : ℝ) ≤
μ[∑ k ∈ Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by
have := (hf.sum_sub_upcrossingStrat_mul a b N).setIntegral_le (zero_le n) MeasurableSet.univ
rw [integral_univ, integral_univ] at this
refine le_trans ?_ this
simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
have h₂ : μ[∑ k ∈ Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] =
μ[∑ k ∈ Finset.range n, (f (k + 1) - f k)] -
μ[∑ k ∈ Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by
simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply,
Pi.mul_apply]
refine integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _)
(integrable_finset_sum _ fun i _ => hf.integrable _)) ?_
convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1
ext; simp
rw [h₂, sub_nonneg] at h₁
refine le_trans h₁ ?_
simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl]
#align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le
noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
(N : ι) (ω : Ω) : ℕ :=
sSup {n | upperCrossingTime a b f N n ω < N}
#align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore
@[simp]
theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ}
{ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore]
#align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot
theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore]
#align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero
@[simp]
theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by
ext ω; exact upcrossingsBefore_zero
#align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero'
theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
(hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N :=
haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N :=
(upperCrossingTime_lt_nonempty hN).csSup_mem
((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab))
lt_of_le_of_lt (upperCrossingTime_mono hn) this
#align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore
theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b)
(hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by
refine le_antisymm upperCrossingTime_le (not_lt.1 ?_)
convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab)
#align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) :
upcrossingsBefore a b f N ω ≤ N := by
by_cases hN : N = 0
· subst hN
rw [upcrossingsBefore_zero]
· refine csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => ?_
by_contra hnN
exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le)
#align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
(h : lowerCrossingTime a b f N n ω < N) :
upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧
lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
have h' : upperCrossingTime a b f N n ω < N :=
lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h
induction' n with k ih
· simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true,
lowerCrossingTime_zero, true_and_iff, eq_comm]
refine hitting_eq_hitting_of_exists hNM ?_
rw [lowerCrossingTime, hitting_lt_iff] at h
· obtain ⟨j, hj₁, hj₂⟩ := h
exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
· exact le_rfl
· specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h)
(lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h')
have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by
rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h'
· simp only [upperCrossingTime_succ_eq]
obtain ⟨j, hj₁, hj₂⟩ := h'
rw [eq_comm, ih.2]
exact hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
· exact le_rfl
refine ⟨this, ?_⟩
simp only [lowerCrossingTime, eq_comm, this, Nat.succ_eq_add_one]
refine hitting_eq_hitting_of_exists hNM ?_
rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h
obtain ⟨j, hj₁, hj₂⟩ := h
exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
#align measure_theory.crossing_eq_crossing_of_lower_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_lowerCrossingTime_lt
theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
(h : upperCrossingTime a b f N (n + 1) ω < N) :
upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧
lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
have := (crossing_eq_crossing_of_lowerCrossingTime_lt hNM
(lt_of_le_of_lt lowerCrossingTime_le_upperCrossingTime_succ h)).2
refine ⟨?_, this⟩
rw [upperCrossingTime_succ_eq, upperCrossingTime_succ_eq, eq_comm, this]
refine hitting_eq_hitting_of_exists hNM ?_
rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h
· obtain ⟨j, hj₁, hj₂⟩ := h
exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
· exact le_rfl
#align measure_theory.crossing_eq_crossing_of_upper_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt
theorem upperCrossingTime_eq_upperCrossingTime_of_lt {M : ℕ} (hNM : N ≤ M)
(h : upperCrossingTime a b f N n ω < N) :
upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω := by
cases n
· simp
· exact (crossing_eq_crossing_of_upperCrossingTime_lt hNM h).1
#align measure_theory.upper_crossing_time_eq_upper_crossing_time_of_lt MeasureTheory.upperCrossingTime_eq_upperCrossingTime_of_lt
theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsBefore a b f N ω := by
intro N M hNM ω
simp only [upcrossingsBefore]
by_cases hemp : {n : ℕ | upperCrossingTime a b f N n ω < N}.Nonempty
· refine csSup_le_csSup (upperCrossingTime_lt_bddAbove hab) hemp fun n hn => ?_
rw [Set.mem_setOf_eq, upperCrossingTime_eq_upperCrossingTime_of_lt hNM hn]
exact lt_of_lt_of_le hn hNM
· rw [Set.not_nonempty_iff_eq_empty] at hemp
simp [hemp, csSup_empty, bot_eq_zero', zero_le']
#align measure_theory.upcrossings_before_mono MeasureTheory.upcrossingsBefore_mono
theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ} (hN₁ : N ≤ N₁)
(hN₁' : f N₁ ω < a) (hN₂ : N₁ ≤ N₂) (hN₂' : b < f N₂ ω) :
upcrossingsBefore a b f N ω < upcrossingsBefore a b f (N₂ + 1) ω := by
refine lt_of_lt_of_le (Nat.lt_succ_self _) (le_csSup (upperCrossingTime_lt_bddAbove hab) ?_)
rw [Set.mem_setOf_eq, upperCrossingTime_succ_eq, hitting_lt_iff _ le_rfl]
refine ⟨N₂, ⟨?_, Nat.lt_succ_self _⟩, hN₂'.le⟩
rw [lowerCrossingTime, hitting_le_iff_of_lt _ (Nat.lt_succ_self _)]
refine ⟨N₁, ⟨le_trans ?_ hN₁, hN₂⟩, hN₁'.le⟩
by_cases hN : 0 < N
· have : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N :=
Nat.sSup_mem (upperCrossingTime_lt_nonempty hN) (upperCrossingTime_lt_bddAbove hab)
rw [upperCrossingTime_eq_upperCrossingTime_of_lt (hN₁.trans (hN₂.trans <| Nat.le_succ _))
this]
exact this.le
· rw [not_lt, Nat.le_zero] at hN
rw [hN, upcrossingsBefore_zero, upperCrossingTime_zero]
rfl
#align measure_theory.upcrossings_before_lt_of_exists_upcrossing MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing
theorem lowerCrossingTime_lt_of_lt_upcrossingsBefore (hN : 0 < N) (hab : a < b)
(hn : n < upcrossingsBefore a b f N ω) : lowerCrossingTime a b f N n ω < N :=
lt_of_le_of_lt lowerCrossingTime_le_upperCrossingTime_succ
(upperCrossingTime_lt_of_le_upcrossingsBefore hN hab hn)
#align measure_theory.lower_crossing_time_lt_of_lt_upcrossings_before MeasureTheory.lowerCrossingTime_lt_of_lt_upcrossingsBefore
theorem le_sub_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
(hn : n < upcrossingsBefore a b f N ω) :
b - a ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N n) ω :=
sub_le_sub
(stoppedValue_upperCrossingTime (upperCrossingTime_lt_of_le_upcrossingsBefore hN hab hn).ne)
(stoppedValue_lowerCrossingTime (lowerCrossingTime_lt_of_lt_upcrossingsBefore hN hab hn).ne)
#align measure_theory.le_sub_of_le_upcrossings_before MeasureTheory.le_sub_of_le_upcrossingsBefore
theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) :
stoppedValue f (upperCrossingTime a b f N (n + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N n) ω = 0 := by
have : N ≤ upperCrossingTime a b f N n ω := by
rw [upcrossingsBefore] at hn
rw [← not_lt]
exact fun h => not_le.2 hn (le_csSup (upperCrossingTime_lt_bddAbove hab) h)
simp [stoppedValue, upperCrossingTime_stabilize' (Nat.le_succ n) this,
lowerCrossingTime_stabilize' le_rfl (le_trans this upperCrossingTime_le_lowerCrossingTime)]
#align measure_theory.sub_eq_zero_of_upcrossings_before_lt MeasureTheory.sub_eq_zero_of_upcrossingsBefore_lt
theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
(b - a) * upcrossingsBefore a b f N ω ≤
∑ k ∈ Finset.range N, upcrossingStrat a b f N k ω * (f (k + 1) - f k) ω := by
classical
by_cases hN : N = 0
· simp [hN]
simp_rw [upcrossingStrat, Finset.sum_mul, ←
Set.indicator_mul_left _ _ (fun x ↦ (f (x + 1) - f x) ω), Pi.one_apply, Pi.sub_apply, one_mul]
rw [Finset.sum_comm]
have h₁ : ∀ k, ∑ n ∈ Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω)
(upperCrossingTime a b f N (k + 1) ω)).indicator (fun m => f (m + 1) ω - f m ω) n =
stoppedValue f (upperCrossingTime a b f N (k + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N k) ω := by
intro k
rw [Finset.sum_indicator_eq_sum_filter, (_ : Finset.filter (fun i => i ∈ Set.Ico
(lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)) (Finset.range N) =
Finset.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)),
Finset.sum_Ico_eq_add_neg _ lowerCrossingTime_le_upperCrossingTime_succ,
Finset.sum_range_sub fun n => f n ω, Finset.sum_range_sub fun n => f n ω, neg_sub,
sub_add_sub_cancel]
· rfl
· ext i
simp only [Set.mem_Ico, Finset.mem_filter, Finset.mem_range, Finset.mem_Ico,
and_iff_right_iff_imp, and_imp]
exact fun _ h => lt_of_lt_of_le h upperCrossingTime_le
simp_rw [h₁]
have h₂ : ∑ _k ∈ Finset.range (upcrossingsBefore a b f N ω), (b - a) ≤
∑ k ∈ Finset.range N, (stoppedValue f (upperCrossingTime a b f N (k + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N k) ω) := by
calc
∑ _k ∈ Finset.range (upcrossingsBefore a b f N ω), (b - a) ≤
∑ k ∈ Finset.range (upcrossingsBefore a b f N ω),
(stoppedValue f (upperCrossingTime a b f N (k + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N k) ω) := by
refine Finset.sum_le_sum fun i hi =>
le_sub_of_le_upcrossingsBefore (zero_lt_iff.2 hN) hab ?_
rwa [Finset.mem_range] at hi
_ ≤ ∑ k ∈ Finset.range N, (stoppedValue f (upperCrossingTime a b f N (k + 1)) ω -
stoppedValue f (lowerCrossingTime a b f N k) ω) := by
refine Finset.sum_le_sum_of_subset_of_nonneg
(Finset.range_subset.2 (upcrossingsBefore_le f ω hab)) fun i _ hi => ?_
by_cases hi' : i = upcrossingsBefore a b f N ω
· subst hi'
simp only [stoppedValue]
rw [upperCrossingTime_eq_of_upcrossingsBefore_lt hab (Nat.lt_succ_self _)]
by_cases heq : lowerCrossingTime a b f N (upcrossingsBefore a b f N ω) ω = N
· rw [heq, sub_self]
· rw [sub_nonneg]
exact le_trans (stoppedValue_lowerCrossingTime heq) hf
· rw [sub_eq_zero_of_upcrossingsBefore_lt hab]
rw [Finset.mem_range, not_lt] at hi
exact lt_of_le_of_ne hi (Ne.symm hi')
refine le_trans ?_ h₂
rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
#align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
(hfN : ∀ ω, a ≤ f N ω) (hfzero : 0 ≤ f 0) (hab : a < b) :
(b - a) * μ[upcrossingsBefore a b f N] ≤ μ[f N] :=
calc
(b - a) * μ[upcrossingsBefore a b f N] ≤
μ[∑ k ∈ Finset.range N, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by
rw [← integral_mul_left]
refine integral_mono_of_nonneg ?_ ((hf.sum_upcrossingStrat_mul a b N).integrable N) ?_
· exact eventually_of_forall fun ω => mul_nonneg (sub_nonneg.2 hab.le) (Nat.cast_nonneg _)
· filter_upwards with ω
simpa using mul_upcrossingsBefore_le (hfN ω) hab
_ ≤ μ[f N] - μ[f 0] := hf.sum_mul_upcrossingStrat_le
_ ≤ μ[f N] := (sub_le_self_iff _).2 (integral_nonneg hfzero)
#align measure_theory.integral_mul_upcrossings_before_le_integral MeasureTheory.integral_mul_upcrossingsBefore_le_integral
theorem crossing_pos_eq (hab : a < b) :
upperCrossingTime 0 (b - a) (fun n ω => (f n ω - a)⁺) N n = upperCrossingTime a b f N n ∧
lowerCrossingTime 0 (b - a) (fun n ω => (f n ω - a)⁺) N n = lowerCrossingTime a b f N n := by
have hab' : 0 < b - a := sub_pos.2 hab
have hf : ∀ ω i, b - a ≤ (f i ω - a)⁺ ↔ b ≤ f i ω := by
intro i ω
refine ⟨fun h => ?_, fun h => ?_⟩
· rwa [← sub_le_sub_iff_right a, ←
posPart_eq_of_posPart_pos (lt_of_lt_of_le hab' h)]
· rw [← sub_le_sub_iff_right a] at h
rwa [posPart_eq_self.2 (le_trans hab'.le h)]
have hf' (ω i) : (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by rw [posPart_nonpos, sub_nonpos]
induction' n with k ih
· refine ⟨rfl, ?_⟩
#adaptation_note
simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting_def,
Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
ext ω
split_ifs with h₁ h₂ h₂
· simp_rw [hf']
· simp_rw [Set.mem_Iic, ← hf' _ _] at h₂
exact False.elim (h₂ h₁)
· simp_rw [Set.mem_Iic, hf' _ _] at h₁
exact False.elim (h₁ h₂)
· rfl
· have : upperCrossingTime 0 (b - a) (fun n ω => (f n ω - a)⁺) N (k + 1) =
upperCrossingTime a b f N (k + 1) := by
ext ω
simp only [upperCrossingTime_succ_eq, ← ih.2, hitting, Set.mem_Ici, tsub_le_iff_right]
split_ifs with h₁ h₂ h₂
· simp_rw [← sub_le_iff_le_add, hf ω]
· refine False.elim (h₂ ?_)
simp_all only [Set.mem_Ici, not_true_eq_false]
· refine False.elim (h₁ ?_)
simp_all only [Set.mem_Ici]
· rfl
refine ⟨this, ?_⟩
ext ω
simp only [lowerCrossingTime, this, hitting, Set.mem_Iic]
split_ifs with h₁ h₂ h₂
· simp_rw [hf' ω]
· refine False.elim (h₂ ?_)
simp_all only [Set.mem_Iic, not_true_eq_false]
· refine False.elim (h₁ ?_)
simp_all only [Set.mem_Iic]
· rfl
#align measure_theory.crossing_pos_eq MeasureTheory.crossing_pos_eq
theorem upcrossingsBefore_pos_eq (hab : a < b) :
upcrossingsBefore 0 (b - a) (fun n ω => (f n ω - a)⁺) N ω = upcrossingsBefore a b f N ω := by
simp_rw [upcrossingsBefore, (crossing_pos_eq hab).1]
#align measure_theory.upcrossings_before_pos_eq MeasureTheory.upcrossingsBefore_pos_eq
theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure μ]
(hf : Submartingale f ℱ μ) (hab : a < b) :
(b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] := by
refine le_trans (le_of_eq ?_)
(integral_mul_upcrossingsBefore_le_integral (hf.sub_martingale (martingale_const _ _ _)).pos
(fun ω => posPart_nonneg _)
(fun ω => posPart_nonneg _) (sub_pos.2 hab))
simp_rw [sub_zero, ← upcrossingsBefore_pos_eq hab]
rfl
#align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFiniteMeasure μ]
(a b : ℝ) (hf : Submartingale f ℱ μ) (N : ℕ) :
(b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] := by
by_cases hab : a < b
· exact mul_integral_upcrossingsBefore_le_integral_pos_part_aux hf hab
· rw [not_lt, ← sub_nonpos] at hab
exact le_trans (mul_nonpos_of_nonpos_of_nonneg hab (by positivity))
(integral_nonneg fun ω => posPart_nonneg _)
#align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
| Mathlib/Probability/Martingale/Upcrossing.lean | 778 | 801 | theorem upcrossingsBefore_eq_sum (hab : a < b) : upcrossingsBefore a b f N ω =
∑ i ∈ Finset.Ico 1 (N + 1), {n | upperCrossingTime a b f N n ω < N}.indicator 1 i := by |
by_cases hN : N = 0
· simp [hN]
rw [← Finset.sum_Ico_consecutive _ (Nat.succ_le_succ zero_le')
(Nat.succ_le_succ (upcrossingsBefore_le f ω hab))]
have h₁ : ∀ k ∈ Finset.Ico 1 (upcrossingsBefore a b f N ω + 1),
{n : ℕ | upperCrossingTime a b f N n ω < N}.indicator 1 k = 1 := by
rintro k hk
rw [Finset.mem_Ico] at hk
rw [Set.indicator_of_mem]
· rfl
· exact upperCrossingTime_lt_of_le_upcrossingsBefore (zero_lt_iff.2 hN) hab
(Nat.lt_succ_iff.1 hk.2)
have h₂ : ∀ k ∈ Finset.Ico (upcrossingsBefore a b f N ω + 1) (N + 1),
{n : ℕ | upperCrossingTime a b f N n ω < N}.indicator 1 k = 0 := by
rintro k hk
rw [Finset.mem_Ico, Nat.succ_le_iff] at hk
rw [Set.indicator_of_not_mem]
simp only [Set.mem_setOf_eq, not_lt]
exact (upperCrossingTime_eq_of_upcrossingsBefore_lt hab hk.1).symm.le
rw [Finset.sum_congr rfl h₁, Finset.sum_congr rfl h₂, Finset.sum_const, Finset.sum_const,
smul_eq_mul, mul_one, smul_eq_mul, mul_zero, Nat.card_Ico, Nat.add_succ_sub_one,
add_zero, add_zero]
|
import Mathlib.Geometry.Euclidean.Sphere.Basic
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
import Mathlib.Tactic.DeriveFintype
#align_import geometry.euclidean.circumcenter from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open scoped Classical
open RealInnerProductSpace
namespace Affine
namespace EuclideanGeometry
open Affine AffineSubspace FiniteDimensional
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P]
| Mathlib/Geometry/Euclidean/Circumcenter.lean | 728 | 735 | theorem cospherical_iff_exists_mem_of_complete {s : AffineSubspace ℝ P} {ps : Set P} (h : ps ⊆ s)
[Nonempty s] [HasOrthogonalProjection s.direction] :
Cospherical ps ↔ ∃ center ∈ s, ∃ radius : ℝ, ∀ p ∈ ps, dist p center = radius := by |
constructor
· rintro ⟨c, hcr⟩
rw [exists_dist_eq_iff_exists_dist_orthogonalProjection_eq h c] at hcr
exact ⟨orthogonalProjection s c, orthogonalProjection_mem _, hcr⟩
· exact fun ⟨c, _, hd⟩ => ⟨c, hd⟩
|
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.List.Perm
import Mathlib.Data.List.Range
#align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6"
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
open Nat
namespace List
@[simp]
theorem sublists'_nil : sublists' (@nil α) = [[]] :=
rfl
#align list.sublists'_nil List.sublists'_nil
@[simp]
theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
rfl
#align list.sublists'_singleton List.sublists'_singleton
#noalign list.map_sublists'_aux
#noalign list.sublists'_aux_append
#noalign list.sublists'_aux_eq_sublists'
-- Porting note: Not the same as `sublists'_aux` from Lean3
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
#align list.sublists'_aux List.sublists'Aux
theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray)
(fun r l => r.push (a :: l))).toList := by
intro r₁ r₂
rw [sublists'Aux, Array.foldl_eq_foldl_data]
have := List.foldl_hom Array.toList (fun r l => r.push (a :: l))
(fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp)
simpa using this
theorem sublists'_eq_sublists'Aux (l : List α) :
sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by
simp only [sublists', sublists'Aux_eq_array_foldl]
rw [← List.foldr_hom Array.toList]
· rfl
· intros _ _; congr <;> simp
theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)),
sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ :=
List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih r₂ => by
rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl]
simp [sublists'Aux]
-- Porting note: simp can prove `sublists'_singleton`
@[simp 900]
theorem sublists'_cons (a : α) (l : List α) :
sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) := by
simp [sublists'_eq_sublists'Aux, foldr_cons, sublists'Aux_eq_map]
#align list.sublists'_cons List.sublists'_cons
@[simp]
| Mathlib/Data/List/Sublists.lean | 82 | 93 | theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by |
induction' t with a t IH generalizing s
· simp only [sublists'_nil, mem_singleton]
exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩
simp only [sublists'_cons, mem_append, IH, mem_map]
constructor <;> intro h
· rcases h with (h | ⟨s, h, rfl⟩)
· exact sublist_cons_of_sublist _ h
· exact h.cons_cons _
· cases' h with _ _ _ h s _ _ h
· exact Or.inl h
· exact Or.inr ⟨s, h, rfl⟩
|
import Mathlib.Algebra.Associated
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.SMulWithZero
import Mathlib.Data.Nat.PartENat
import Mathlib.Tactic.Linarith
#align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
variable {α β : Type*}
open Nat Part
def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat :=
PartENat.find fun n => ¬a ^ (n + 1) ∣ b
#align multiplicity multiplicity
namespace multiplicity
section Monoid
variable [Monoid α] [Monoid β]
abbrev Finite (a b : α) : Prop :=
∃ n : ℕ, ¬a ^ (n + 1) ∣ b
#align multiplicity.finite multiplicity.Finite
theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} :
Finite a b ↔ (multiplicity a b).Dom :=
Iff.rfl
#align multiplicity.finite_iff_dom multiplicity.finite_iff_dom
theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b :=
Iff.rfl
#align multiplicity.finite_def multiplicity.finite_def
theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ =>
hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩
#align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right
@[norm_cast]
theorem Int.natCast_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by
apply Part.ext'
· rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ]
norm_cast
· intro h1 h2
apply _root_.le_antisymm <;>
· apply Nat.find_mono
norm_cast
simp
#align multiplicity.int.coe_nat_multiplicity multiplicity.Int.natCast_multiplicity
@[deprecated (since := "2024-04-05")] alias Int.coe_nat_multiplicity := Int.natCast_multiplicity
theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b :=
⟨fun h n =>
Nat.casesOn n
(by
rw [_root_.pow_zero]
exact one_dvd _)
(by simpa [Finite, Classical.not_not] using h),
by simp [Finite, multiplicity, Classical.not_not]; tauto⟩
#align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall
theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a :=
let ⟨n, hn⟩ := h
hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1)
#align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite
theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ =>
⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩
#align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right
variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)]
theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} :
(k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by
rw [← PartENat.some_eq_natCast]
exact
Nat.casesOn k
(fun _ => by
rw [_root_.pow_zero]
exact one_dvd _)
fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk
#align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity
theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b :=
pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get])
#align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd
theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by
rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h)
#align multiplicity.is_greatest multiplicity.is_greatest
theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) :
¬a ^ m ∣ b :=
is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm)
#align multiplicity.is_greatest' multiplicity.is_greatest'
theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) :
0 < (multiplicity a b).get hfin := by
refine zero_lt_iff.2 fun h => ?_
simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h)
#align multiplicity.pos_of_dvd multiplicity.pos_of_dvd
theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) :
(k : PartENat) = multiplicity a b :=
le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by
have : Finite a b := ⟨k, hsucc⟩
rw [PartENat.le_coe_iff]
exact ⟨this, Nat.find_min' _ hsucc⟩
#align multiplicity.unique multiplicity.unique
| Mathlib/RingTheory/Multiplicity.lean | 137 | 139 | theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) :
k = get (multiplicity a b) ⟨k, hsucc⟩ := by |
rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc]
|
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Zip
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Infix
#align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u
variable {α : Type u}
open Nat Function
namespace List
theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by simp [rotate]
#align list.rotate_mod List.rotate_mod
@[simp]
theorem rotate_nil (n : ℕ) : ([] : List α).rotate n = [] := by simp [rotate]
#align list.rotate_nil List.rotate_nil
@[simp]
theorem rotate_zero (l : List α) : l.rotate 0 = l := by simp [rotate]
#align list.rotate_zero List.rotate_zero
-- Porting note: removing simp, simp can prove it
theorem rotate'_nil (n : ℕ) : ([] : List α).rotate' n = [] := by cases n <;> rfl
#align list.rotate'_nil List.rotate'_nil
@[simp]
theorem rotate'_zero (l : List α) : l.rotate' 0 = l := by cases l <;> rfl
#align list.rotate'_zero List.rotate'_zero
theorem rotate'_cons_succ (l : List α) (a : α) (n : ℕ) :
(a :: l : List α).rotate' n.succ = (l ++ [a]).rotate' n := by simp [rotate']
#align list.rotate'_cons_succ List.rotate'_cons_succ
@[simp]
theorem length_rotate' : ∀ (l : List α) (n : ℕ), (l.rotate' n).length = l.length
| [], _ => by simp
| a :: l, 0 => rfl
| a :: l, n + 1 => by rw [List.rotate', length_rotate' (l ++ [a]) n]; simp
#align list.length_rotate' List.length_rotate'
theorem rotate'_eq_drop_append_take :
∀ {l : List α} {n : ℕ}, n ≤ l.length → l.rotate' n = l.drop n ++ l.take n
| [], n, h => by simp [drop_append_of_le_length h]
| l, 0, h => by simp [take_append_of_le_length h]
| a :: l, n + 1, h => by
have hnl : n ≤ l.length := le_of_succ_le_succ h
have hnl' : n ≤ (l ++ [a]).length := by
rw [length_append, length_cons, List.length]; exact le_of_succ_le h
rw [rotate'_cons_succ, rotate'_eq_drop_append_take hnl', drop, take,
drop_append_of_le_length hnl, take_append_of_le_length hnl]; simp
#align list.rotate'_eq_drop_append_take List.rotate'_eq_drop_append_take
theorem rotate'_rotate' : ∀ (l : List α) (n m : ℕ), (l.rotate' n).rotate' m = l.rotate' (n + m)
| a :: l, 0, m => by simp
| [], n, m => by simp
| a :: l, n + 1, m => by
rw [rotate'_cons_succ, rotate'_rotate' _ n, Nat.add_right_comm, ← rotate'_cons_succ,
Nat.succ_eq_add_one]
#align list.rotate'_rotate' List.rotate'_rotate'
@[simp]
theorem rotate'_length (l : List α) : rotate' l l.length = l := by
rw [rotate'_eq_drop_append_take le_rfl]; simp
#align list.rotate'_length List.rotate'_length
@[simp]
theorem rotate'_length_mul (l : List α) : ∀ n : ℕ, l.rotate' (l.length * n) = l
| 0 => by simp
| n + 1 =>
calc
l.rotate' (l.length * (n + 1)) =
(l.rotate' (l.length * n)).rotate' (l.rotate' (l.length * n)).length := by
simp [-rotate'_length, Nat.mul_succ, rotate'_rotate']
_ = l := by rw [rotate'_length, rotate'_length_mul l n]
#align list.rotate'_length_mul List.rotate'_length_mul
theorem rotate'_mod (l : List α) (n : ℕ) : l.rotate' (n % l.length) = l.rotate' n :=
calc
l.rotate' (n % l.length) =
(l.rotate' (n % l.length)).rotate' ((l.rotate' (n % l.length)).length * (n / l.length)) :=
by rw [rotate'_length_mul]
_ = l.rotate' n := by rw [rotate'_rotate', length_rotate', Nat.mod_add_div]
#align list.rotate'_mod List.rotate'_mod
theorem rotate_eq_rotate' (l : List α) (n : ℕ) : l.rotate n = l.rotate' n :=
if h : l.length = 0 then by simp_all [length_eq_zero]
else by
rw [← rotate'_mod,
rotate'_eq_drop_append_take (le_of_lt (Nat.mod_lt _ (Nat.pos_of_ne_zero h)))];
simp [rotate]
#align list.rotate_eq_rotate' List.rotate_eq_rotate'
theorem rotate_cons_succ (l : List α) (a : α) (n : ℕ) :
(a :: l : List α).rotate (n + 1) = (l ++ [a]).rotate n := by
rw [rotate_eq_rotate', rotate_eq_rotate', rotate'_cons_succ]
#align list.rotate_cons_succ List.rotate_cons_succ
@[simp]
theorem mem_rotate : ∀ {l : List α} {a : α} {n : ℕ}, a ∈ l.rotate n ↔ a ∈ l
| [], _, n => by simp
| a :: l, _, 0 => by simp
| a :: l, _, n + 1 => by simp [rotate_cons_succ, mem_rotate, or_comm]
#align list.mem_rotate List.mem_rotate
@[simp]
theorem length_rotate (l : List α) (n : ℕ) : (l.rotate n).length = l.length := by
rw [rotate_eq_rotate', length_rotate']
#align list.length_rotate List.length_rotate
@[simp]
theorem rotate_replicate (a : α) (n : ℕ) (k : ℕ) : (replicate n a).rotate k = replicate n a :=
eq_replicate.2 ⟨by rw [length_rotate, length_replicate], fun b hb =>
eq_of_mem_replicate <| mem_rotate.1 hb⟩
#align list.rotate_replicate List.rotate_replicate
theorem rotate_eq_drop_append_take {l : List α} {n : ℕ} :
n ≤ l.length → l.rotate n = l.drop n ++ l.take n := by
rw [rotate_eq_rotate']; exact rotate'_eq_drop_append_take
#align list.rotate_eq_drop_append_take List.rotate_eq_drop_append_take
theorem rotate_eq_drop_append_take_mod {l : List α} {n : ℕ} :
l.rotate n = l.drop (n % l.length) ++ l.take (n % l.length) := by
rcases l.length.zero_le.eq_or_lt with hl | hl
· simp [eq_nil_of_length_eq_zero hl.symm]
rw [← rotate_eq_drop_append_take (n.mod_lt hl).le, rotate_mod]
#align list.rotate_eq_drop_append_take_mod List.rotate_eq_drop_append_take_mod
@[simp]
theorem rotate_append_length_eq (l l' : List α) : (l ++ l').rotate l.length = l' ++ l := by
rw [rotate_eq_rotate']
induction l generalizing l'
· simp
· simp_all [rotate']
#align list.rotate_append_length_eq List.rotate_append_length_eq
theorem rotate_rotate (l : List α) (n m : ℕ) : (l.rotate n).rotate m = l.rotate (n + m) := by
rw [rotate_eq_rotate', rotate_eq_rotate', rotate_eq_rotate', rotate'_rotate']
#align list.rotate_rotate List.rotate_rotate
@[simp]
theorem rotate_length (l : List α) : rotate l l.length = l := by
rw [rotate_eq_rotate', rotate'_length]
#align list.rotate_length List.rotate_length
@[simp]
theorem rotate_length_mul (l : List α) (n : ℕ) : l.rotate (l.length * n) = l := by
rw [rotate_eq_rotate', rotate'_length_mul]
#align list.rotate_length_mul List.rotate_length_mul
theorem rotate_perm (l : List α) (n : ℕ) : l.rotate n ~ l := by
rw [rotate_eq_rotate']
induction' n with n hn generalizing l
· simp
· cases' l with hd tl
· simp
· rw [rotate'_cons_succ]
exact (hn _).trans (perm_append_singleton _ _)
#align list.rotate_perm List.rotate_perm
@[simp]
theorem nodup_rotate {l : List α} {n : ℕ} : Nodup (l.rotate n) ↔ Nodup l :=
(rotate_perm l n).nodup_iff
#align list.nodup_rotate List.nodup_rotate
@[simp]
theorem rotate_eq_nil_iff {l : List α} {n : ℕ} : l.rotate n = [] ↔ l = [] := by
induction' n with n hn generalizing l
· simp
· cases' l with hd tl
· simp
· simp [rotate_cons_succ, hn]
#align list.rotate_eq_nil_iff List.rotate_eq_nil_iff
@[simp]
theorem nil_eq_rotate_iff {l : List α} {n : ℕ} : [] = l.rotate n ↔ [] = l := by
rw [eq_comm, rotate_eq_nil_iff, eq_comm]
#align list.nil_eq_rotate_iff List.nil_eq_rotate_iff
@[simp]
theorem rotate_singleton (x : α) (n : ℕ) : [x].rotate n = [x] :=
rotate_replicate x 1 n
#align list.rotate_singleton List.rotate_singleton
theorem zipWith_rotate_distrib {β γ : Type*} (f : α → β → γ) (l : List α) (l' : List β) (n : ℕ)
(h : l.length = l'.length) :
(zipWith f l l').rotate n = zipWith f (l.rotate n) (l'.rotate n) := by
rw [rotate_eq_drop_append_take_mod, rotate_eq_drop_append_take_mod,
rotate_eq_drop_append_take_mod, h, zipWith_append, ← zipWith_distrib_drop, ←
zipWith_distrib_take, List.length_zipWith, h, min_self]
rw [length_drop, length_drop, h]
#align list.zip_with_rotate_distrib List.zipWith_rotate_distrib
attribute [local simp] rotate_cons_succ
-- Porting note: removing @[simp], simp can prove it
theorem zipWith_rotate_one {β : Type*} (f : α → α → β) (x y : α) (l : List α) :
zipWith f (x :: y :: l) ((x :: y :: l).rotate 1) = f x y :: zipWith f (y :: l) (l ++ [x]) := by
simp
#align list.zip_with_rotate_one List.zipWith_rotate_one
theorem get?_rotate {l : List α} {n m : ℕ} (hml : m < l.length) :
(l.rotate n).get? m = l.get? ((m + n) % l.length) := by
rw [rotate_eq_drop_append_take_mod]
rcases lt_or_le m (l.drop (n % l.length)).length with hm | hm
· rw [get?_append hm, get?_drop, ← add_mod_mod]
rw [length_drop, Nat.lt_sub_iff_add_lt] at hm
rw [mod_eq_of_lt hm, Nat.add_comm]
· have hlt : n % length l < length l := mod_lt _ (m.zero_le.trans_lt hml)
rw [get?_append_right hm, get?_take, length_drop]
· congr 1
rw [length_drop] at hm
have hm' := Nat.sub_le_iff_le_add'.1 hm
have : n % length l + m - length l < length l := by
rw [Nat.sub_lt_iff_lt_add' hm']
exact Nat.add_lt_add hlt hml
conv_rhs => rw [Nat.add_comm m, ← mod_add_mod, mod_eq_sub_mod hm', mod_eq_of_lt this]
rw [← Nat.add_right_inj, ← Nat.add_sub_assoc, Nat.add_sub_sub_cancel, Nat.add_sub_cancel',
Nat.add_comm]
exacts [hm', hlt.le, hm]
· rwa [Nat.sub_lt_iff_lt_add hm, length_drop, Nat.sub_add_cancel hlt.le]
#align list.nth_rotate List.get?_rotate
-- Porting note (#10756): new lemma
theorem get_rotate (l : List α) (n : ℕ) (k : Fin (l.rotate n).length) :
(l.rotate n).get k =
l.get ⟨(k + n) % l.length, mod_lt _ (length_rotate l n ▸ k.1.zero_le.trans_lt k.2)⟩ := by
rw [← Option.some_inj, ← get?_eq_get, ← get?_eq_get, get?_rotate]
exact k.2.trans_eq (length_rotate _ _)
theorem head?_rotate {l : List α} {n : ℕ} (h : n < l.length) : head? (l.rotate n) = l.get? n := by
rw [← get?_zero, get?_rotate (n.zero_le.trans_lt h), Nat.zero_add, Nat.mod_eq_of_lt h]
#align list.head'_rotate List.head?_rotate
-- Porting note: moved down from its original location below `get_rotate` so that the
-- non-deprecated lemma does not use the deprecated version
set_option linter.deprecated false in
@[deprecated get_rotate (since := "2023-01-13")]
theorem nthLe_rotate (l : List α) (n k : ℕ) (hk : k < (l.rotate n).length) :
(l.rotate n).nthLe k hk =
l.nthLe ((k + n) % l.length) (mod_lt _ (length_rotate l n ▸ k.zero_le.trans_lt hk)) :=
get_rotate l n ⟨k, hk⟩
#align list.nth_le_rotate List.nthLe_rotate
set_option linter.deprecated false in
theorem nthLe_rotate_one (l : List α) (k : ℕ) (hk : k < (l.rotate 1).length) :
(l.rotate 1).nthLe k hk =
l.nthLe ((k + 1) % l.length) (mod_lt _ (length_rotate l 1 ▸ k.zero_le.trans_lt hk)) :=
nthLe_rotate l 1 k hk
#align list.nth_le_rotate_one List.nthLe_rotate_one
-- Porting note (#10756): new lemma
theorem get_eq_get_rotate (l : List α) (n : ℕ) (k : Fin l.length) :
l.get k = (l.rotate n).get ⟨(l.length - n % l.length + k) % l.length,
(Nat.mod_lt _ (k.1.zero_le.trans_lt k.2)).trans_eq (length_rotate _ _).symm⟩ := by
rw [get_rotate]
refine congr_arg l.get (Fin.eq_of_val_eq ?_)
simp only [mod_add_mod]
rw [← add_mod_mod, Nat.add_right_comm, Nat.sub_add_cancel, add_mod_left, mod_eq_of_lt]
exacts [k.2, (mod_lt _ (k.1.zero_le.trans_lt k.2)).le]
set_option linter.deprecated false in
@[deprecated get_eq_get_rotate]
theorem nthLe_rotate' (l : List α) (n k : ℕ) (hk : k < l.length) :
(l.rotate n).nthLe ((l.length - n % l.length + k) % l.length)
((Nat.mod_lt _ (k.zero_le.trans_lt hk)).trans_le (length_rotate _ _).ge) =
l.nthLe k hk :=
(get_eq_get_rotate l n ⟨k, hk⟩).symm
#align list.nth_le_rotate' List.nthLe_rotate'
theorem rotate_eq_self_iff_eq_replicate [hα : Nonempty α] :
∀ {l : List α}, (∀ n, l.rotate n = l) ↔ ∃ a, l = replicate l.length a
| [] => by simp
| a :: l => ⟨fun h => ⟨a, ext_get (length_replicate _ _).symm fun n h₁ h₂ => by
rw [get_replicate, ← Option.some_inj, ← get?_eq_get, ← head?_rotate h₁, h, head?_cons]⟩,
fun ⟨b, hb⟩ n => by rw [hb, rotate_replicate]⟩
#align list.rotate_eq_self_iff_eq_replicate List.rotate_eq_self_iff_eq_replicate
theorem rotate_one_eq_self_iff_eq_replicate [Nonempty α] {l : List α} :
l.rotate 1 = l ↔ ∃ a : α, l = List.replicate l.length a :=
⟨fun h =>
rotate_eq_self_iff_eq_replicate.mp fun n =>
Nat.rec l.rotate_zero (fun n hn => by rwa [Nat.succ_eq_add_one, ← l.rotate_rotate, hn]) n,
fun h => rotate_eq_self_iff_eq_replicate.mpr h 1⟩
#align list.rotate_one_eq_self_iff_eq_replicate List.rotate_one_eq_self_iff_eq_replicate
theorem rotate_injective (n : ℕ) : Function.Injective fun l : List α => l.rotate n := by
rintro l l' (h : l.rotate n = l'.rotate n)
have hle : l.length = l'.length := (l.length_rotate n).symm.trans (h.symm ▸ l'.length_rotate n)
rw [rotate_eq_drop_append_take_mod, rotate_eq_drop_append_take_mod] at h
obtain ⟨hd, ht⟩ := append_inj h (by simp_all)
rw [← take_append_drop _ l, ht, hd, take_append_drop]
#align list.rotate_injective List.rotate_injective
@[simp]
theorem rotate_eq_rotate {l l' : List α} {n : ℕ} : l.rotate n = l'.rotate n ↔ l = l' :=
(rotate_injective n).eq_iff
#align list.rotate_eq_rotate List.rotate_eq_rotate
theorem rotate_eq_iff {l l' : List α} {n : ℕ} :
l.rotate n = l' ↔ l = l'.rotate (l'.length - n % l'.length) := by
rw [← @rotate_eq_rotate _ l _ n, rotate_rotate, ← rotate_mod l', add_mod]
rcases l'.length.zero_le.eq_or_lt with hl | hl
· rw [eq_nil_of_length_eq_zero hl.symm, rotate_nil]
· rcases (Nat.zero_le (n % l'.length)).eq_or_lt with hn | hn
· simp [← hn]
· rw [mod_eq_of_lt (Nat.sub_lt hl hn), Nat.sub_add_cancel, mod_self, rotate_zero]
exact (Nat.mod_lt _ hl).le
#align list.rotate_eq_iff List.rotate_eq_iff
@[simp]
theorem rotate_eq_singleton_iff {l : List α} {n : ℕ} {x : α} : l.rotate n = [x] ↔ l = [x] := by
rw [rotate_eq_iff, rotate_singleton]
#align list.rotate_eq_singleton_iff List.rotate_eq_singleton_iff
@[simp]
theorem singleton_eq_rotate_iff {l : List α} {n : ℕ} {x : α} : [x] = l.rotate n ↔ [x] = l := by
rw [eq_comm, rotate_eq_singleton_iff, eq_comm]
#align list.singleton_eq_rotate_iff List.singleton_eq_rotate_iff
theorem reverse_rotate (l : List α) (n : ℕ) :
(l.rotate n).reverse = l.reverse.rotate (l.length - n % l.length) := by
rw [← length_reverse l, ← rotate_eq_iff]
induction' n with n hn generalizing l
· simp
· cases' l with hd tl
· simp
· rw [rotate_cons_succ, ← rotate_rotate, hn]
simp
#align list.reverse_rotate List.reverse_rotate
theorem rotate_reverse (l : List α) (n : ℕ) :
l.reverse.rotate n = (l.rotate (l.length - n % l.length)).reverse := by
rw [← reverse_reverse l]
simp_rw [reverse_rotate, reverse_reverse, rotate_eq_iff, rotate_rotate, length_rotate,
length_reverse]
rw [← length_reverse l]
let k := n % l.reverse.length
cases' hk' : k with k'
· simp_all! [k, length_reverse, ← rotate_rotate]
· cases' l with x l
· simp
· rw [Nat.mod_eq_of_lt, Nat.sub_add_cancel, rotate_length]
· exact Nat.sub_le _ _
· exact Nat.sub_lt (by simp) (by simp_all! [k])
#align list.rotate_reverse List.rotate_reverse
theorem map_rotate {β : Type*} (f : α → β) (l : List α) (n : ℕ) :
map f (l.rotate n) = (map f l).rotate n := by
induction' n with n hn IH generalizing l
· simp
· cases' l with hd tl
· simp
· simp [hn]
#align list.map_rotate List.map_rotate
theorem Nodup.rotate_congr {l : List α} (hl : l.Nodup) (hn : l ≠ []) (i j : ℕ)
(h : l.rotate i = l.rotate j) : i % l.length = j % l.length := by
rw [← rotate_mod l i, ← rotate_mod l j] at h
simpa only [head?_rotate, mod_lt, length_pos_of_ne_nil hn, get?_eq_get, Option.some_inj,
hl.get_inj_iff, Fin.ext_iff] using congr_arg head? h
#align list.nodup.rotate_congr List.Nodup.rotate_congr
theorem Nodup.rotate_congr_iff {l : List α} (hl : l.Nodup) {i j : ℕ} :
l.rotate i = l.rotate j ↔ i % l.length = j % l.length ∨ l = [] := by
rcases eq_or_ne l [] with rfl | hn
· simp
· simp only [hn, or_false]
refine ⟨hl.rotate_congr hn _ _, fun h ↦ ?_⟩
rw [← rotate_mod, h, rotate_mod]
theorem Nodup.rotate_eq_self_iff {l : List α} (hl : l.Nodup) {n : ℕ} :
l.rotate n = l ↔ n % l.length = 0 ∨ l = [] := by
rw [← zero_mod, ← hl.rotate_congr_iff, rotate_zero]
#align list.nodup.rotate_eq_self_iff List.Nodup.rotate_eq_self_iff
section IsRotated
variable (l l' : List α)
def IsRotated : Prop :=
∃ n, l.rotate n = l'
#align list.is_rotated List.IsRotated
@[inherit_doc List.IsRotated]
infixr:1000 " ~r " => IsRotated
variable {l l'}
@[refl]
theorem IsRotated.refl (l : List α) : l ~r l :=
⟨0, by simp⟩
#align list.is_rotated.refl List.IsRotated.refl
@[symm]
theorem IsRotated.symm (h : l ~r l') : l' ~r l := by
obtain ⟨n, rfl⟩ := h
cases' l with hd tl
· exists 0
· use (hd :: tl).length * n - n
rw [rotate_rotate, Nat.add_sub_cancel', rotate_length_mul]
exact Nat.le_mul_of_pos_left _ (by simp)
#align list.is_rotated.symm List.IsRotated.symm
theorem isRotated_comm : l ~r l' ↔ l' ~r l :=
⟨IsRotated.symm, IsRotated.symm⟩
#align list.is_rotated_comm List.isRotated_comm
@[simp]
protected theorem IsRotated.forall (l : List α) (n : ℕ) : l.rotate n ~r l :=
IsRotated.symm ⟨n, rfl⟩
#align list.is_rotated.forall List.IsRotated.forall
@[trans]
theorem IsRotated.trans : ∀ {l l' l'' : List α}, l ~r l' → l' ~r l'' → l ~r l''
| _, _, _, ⟨n, rfl⟩, ⟨m, rfl⟩ => ⟨n + m, by rw [rotate_rotate]⟩
#align list.is_rotated.trans List.IsRotated.trans
theorem IsRotated.eqv : Equivalence (@IsRotated α) :=
Equivalence.mk IsRotated.refl IsRotated.symm IsRotated.trans
#align list.is_rotated.eqv List.IsRotated.eqv
def IsRotated.setoid (α : Type*) : Setoid (List α) where
r := IsRotated
iseqv := IsRotated.eqv
#align list.is_rotated.setoid List.IsRotated.setoid
theorem IsRotated.perm (h : l ~r l') : l ~ l' :=
Exists.elim h fun _ hl => hl ▸ (rotate_perm _ _).symm
#align list.is_rotated.perm List.IsRotated.perm
theorem IsRotated.nodup_iff (h : l ~r l') : Nodup l ↔ Nodup l' :=
h.perm.nodup_iff
#align list.is_rotated.nodup_iff List.IsRotated.nodup_iff
theorem IsRotated.mem_iff (h : l ~r l') {a : α} : a ∈ l ↔ a ∈ l' :=
h.perm.mem_iff
#align list.is_rotated.mem_iff List.IsRotated.mem_iff
@[simp]
theorem isRotated_nil_iff : l ~r [] ↔ l = [] :=
⟨fun ⟨n, hn⟩ => by simpa using hn, fun h => h ▸ by rfl⟩
#align list.is_rotated_nil_iff List.isRotated_nil_iff
@[simp]
theorem isRotated_nil_iff' : [] ~r l ↔ [] = l := by
rw [isRotated_comm, isRotated_nil_iff, eq_comm]
#align list.is_rotated_nil_iff' List.isRotated_nil_iff'
@[simp]
theorem isRotated_singleton_iff {x : α} : l ~r [x] ↔ l = [x] :=
⟨fun ⟨n, hn⟩ => by simpa using hn, fun h => h ▸ by rfl⟩
#align list.is_rotated_singleton_iff List.isRotated_singleton_iff
@[simp]
theorem isRotated_singleton_iff' {x : α} : [x] ~r l ↔ [x] = l := by
rw [isRotated_comm, isRotated_singleton_iff, eq_comm]
#align list.is_rotated_singleton_iff' List.isRotated_singleton_iff'
theorem isRotated_concat (hd : α) (tl : List α) : (tl ++ [hd]) ~r (hd :: tl) :=
IsRotated.symm ⟨1, by simp⟩
#align list.is_rotated_concat List.isRotated_concat
theorem isRotated_append : (l ++ l') ~r (l' ++ l) :=
⟨l.length, by simp⟩
#align list.is_rotated_append List.isRotated_append
theorem IsRotated.reverse (h : l ~r l') : l.reverse ~r l'.reverse := by
obtain ⟨n, rfl⟩ := h
exact ⟨_, (reverse_rotate _ _).symm⟩
#align list.is_rotated.reverse List.IsRotated.reverse
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
constructor <;>
· intro h
simpa using h.reverse
#align list.is_rotated_reverse_comm_iff List.isRotated_reverse_comm_iff
@[simp]
theorem isRotated_reverse_iff : l.reverse ~r l'.reverse ↔ l ~r l' := by
simp [isRotated_reverse_comm_iff]
#align list.is_rotated_reverse_iff List.isRotated_reverse_iff
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
refine ⟨fun h => ?_, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
obtain ⟨n, rfl⟩ := h
cases' l with hd tl
· simp
· refine ⟨n % (hd :: tl).length, ?_, rotate_mod _ _⟩
refine (Nat.mod_lt _ ?_).le
simp
#align list.is_rotated_iff_mod List.isRotated_iff_mod
theorem isRotated_iff_mem_map_range : l ~r l' ↔ l' ∈ (List.range (l.length + 1)).map l.rotate := by
simp_rw [mem_map, mem_range, isRotated_iff_mod]
exact
⟨fun ⟨n, hn, h⟩ => ⟨n, Nat.lt_succ_of_le hn, h⟩,
fun ⟨n, hn, h⟩ => ⟨n, Nat.le_of_lt_succ hn, h⟩⟩
#align list.is_rotated_iff_mem_map_range List.isRotated_iff_mem_map_range
-- Porting note: @[congr] only works for equality.
-- @[congr]
theorem IsRotated.map {β : Type*} {l₁ l₂ : List α} (h : l₁ ~r l₂) (f : α → β) :
map f l₁ ~r map f l₂ := by
obtain ⟨n, rfl⟩ := h
rw [map_rotate]
use n
#align list.is_rotated.map List.IsRotated.map
def cyclicPermutations : List α → List (List α)
| [] => [[]]
| l@(_ :: _) => dropLast (zipWith (· ++ ·) (tails l) (inits l))
#align list.cyclic_permutations List.cyclicPermutations
@[simp]
theorem cyclicPermutations_nil : cyclicPermutations ([] : List α) = [[]] :=
rfl
#align list.cyclic_permutations_nil List.cyclicPermutations_nil
theorem cyclicPermutations_cons (x : α) (l : List α) :
cyclicPermutations (x :: l) = dropLast (zipWith (· ++ ·) (tails (x :: l)) (inits (x :: l))) :=
rfl
#align list.cyclic_permutations_cons List.cyclicPermutations_cons
theorem cyclicPermutations_of_ne_nil (l : List α) (h : l ≠ []) :
cyclicPermutations l = dropLast (zipWith (· ++ ·) (tails l) (inits l)) := by
obtain ⟨hd, tl, rfl⟩ := exists_cons_of_ne_nil h
exact cyclicPermutations_cons _ _
#align list.cyclic_permutations_of_ne_nil List.cyclicPermutations_of_ne_nil
theorem length_cyclicPermutations_cons (x : α) (l : List α) :
length (cyclicPermutations (x :: l)) = length l + 1 := by simp [cyclicPermutations_cons]
#align list.length_cyclic_permutations_cons List.length_cyclicPermutations_cons
@[simp]
| Mathlib/Data/List/Rotate.lean | 577 | 578 | theorem length_cyclicPermutations_of_ne_nil (l : List α) (h : l ≠ []) :
length (cyclicPermutations l) = length l := by | simp [cyclicPermutations_of_ne_nil _ h]
|
import Mathlib.Order.BoundedOrder
#align_import data.prod.lex from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
variable {α β γ : Type*}
namespace Prod.Lex
@[inherit_doc] notation:35 α " ×ₗ " β:34 => Lex (Prod α β)
instance decidableEq (α β : Type*) [DecidableEq α] [DecidableEq β] : DecidableEq (α ×ₗ β) :=
instDecidableEqProd
#align prod.lex.decidable_eq Prod.Lex.decidableEq
instance inhabited (α β : Type*) [Inhabited α] [Inhabited β] : Inhabited (α ×ₗ β) :=
instInhabitedProd
#align prod.lex.inhabited Prod.Lex.inhabited
instance instLE (α β : Type*) [LT α] [LE β] : LE (α ×ₗ β) where le := Prod.Lex (· < ·) (· ≤ ·)
#align prod.lex.has_le Prod.Lex.instLE
instance instLT (α β : Type*) [LT α] [LT β] : LT (α ×ₗ β) where lt := Prod.Lex (· < ·) (· < ·)
#align prod.lex.has_lt Prod.Lex.instLT
theorem le_iff [LT α] [LE β] (a b : α × β) :
toLex a ≤ toLex b ↔ a.1 < b.1 ∨ a.1 = b.1 ∧ a.2 ≤ b.2 :=
Prod.lex_def (· < ·) (· ≤ ·)
#align prod.lex.le_iff Prod.Lex.le_iff
theorem lt_iff [LT α] [LT β] (a b : α × β) :
toLex a < toLex b ↔ a.1 < b.1 ∨ a.1 = b.1 ∧ a.2 < b.2 :=
Prod.lex_def (· < ·) (· < ·)
#align prod.lex.lt_iff Prod.Lex.lt_iff
example (x : α) (y : β) : toLex (x, y) = toLex (x, y) := rfl
instance preorder (α β : Type*) [Preorder α] [Preorder β] : Preorder (α ×ₗ β) :=
{ Prod.Lex.instLE α β, Prod.Lex.instLT α β with
le_refl := refl_of <| Prod.Lex _ _,
le_trans := fun _ _ _ => trans_of <| Prod.Lex _ _,
lt_iff_le_not_le := fun x₁ x₂ =>
match x₁, x₂ with
| (a₁, b₁), (a₂, b₂) => by
constructor
· rintro (⟨_, _, hlt⟩ | ⟨_, hlt⟩)
· constructor
· exact left _ _ hlt
· rintro ⟨⟩
· apply lt_asymm hlt; assumption
· exact lt_irrefl _ hlt
· constructor
· right
rw [lt_iff_le_not_le] at hlt
exact hlt.1
· rintro ⟨⟩
· apply lt_irrefl a₁
assumption
· rw [lt_iff_le_not_le] at hlt
apply hlt.2
assumption
· rintro ⟨⟨⟩, h₂r⟩
· left
assumption
· right
rw [lt_iff_le_not_le]
constructor
· assumption
· intro h
apply h₂r
right
exact h }
#align prod.lex.preorder Prod.Lex.preorder
theorem monotone_fst [Preorder α] [LE β] (t c : α ×ₗ β) (h : t ≤ c) :
(ofLex t).1 ≤ (ofLex c).1 := by
cases (Prod.Lex.le_iff t c).mp h with
| inl h' => exact h'.le
| inr h' => exact h'.1.le
section Preorder
variable [PartialOrder α] [Preorder β]
| Mathlib/Data/Prod/Lex.lean | 115 | 119 | theorem toLex_mono : Monotone (toLex : α × β → α ×ₗ β) := by |
rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ ⟨ha, hb⟩
obtain rfl | ha : a₁ = a₂ ∨ _ := ha.eq_or_lt
· exact right _ hb
· exact left _ _ ha
|
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Ring.Opposite
import Mathlib.Tactic.Abel
#align_import algebra.geom_sum from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
-- Porting note: corrected type in the description of `geom_sum₂_Ico` (in the doc string only).
universe u
variable {α : Type u}
open Finset MulOpposite
@[simp]
theorem neg_one_geom_sum [Ring α] {n : ℕ} :
∑ i ∈ range n, (-1 : α) ^ i = if Even n then 0 else 1 := by
induction' n with k hk
· simp
· simp only [geom_sum_succ', Nat.even_add_one, hk]
split_ifs with h
· rw [h.neg_one_pow, add_zero]
· rw [(Nat.odd_iff_not_even.2 h).neg_one_pow, neg_add_self]
#align neg_one_geom_sum neg_one_geom_sum
theorem geom_sum₂_self {α : Type*} [CommRing α] (x : α) (n : ℕ) :
∑ i ∈ range n, x ^ i * x ^ (n - 1 - i) = n * x ^ (n - 1) :=
calc
∑ i ∈ Finset.range n, x ^ i * x ^ (n - 1 - i) =
∑ i ∈ Finset.range n, x ^ (i + (n - 1 - i)) := by
simp_rw [← pow_add]
_ = ∑ _i ∈ Finset.range n, x ^ (n - 1) :=
Finset.sum_congr rfl fun i hi =>
congr_arg _ <| add_tsub_cancel_of_le <| Nat.le_sub_one_of_lt <| Finset.mem_range.1 hi
_ = (Finset.range n).card • x ^ (n - 1) := Finset.sum_const _
_ = n * x ^ (n - 1) := by rw [Finset.card_range, nsmul_eq_mul]
#align geom_sum₂_self geom_sum₂_self
theorem geom_sum₂_mul_add [CommSemiring α] (x y : α) (n : ℕ) :
(∑ i ∈ range n, (x + y) ^ i * y ^ (n - 1 - i)) * x + y ^ n = (x + y) ^ n :=
(Commute.all x y).geom_sum₂_mul_add n
#align geom_sum₂_mul_add geom_sum₂_mul_add
theorem geom_sum_mul_add [Semiring α] (x : α) (n : ℕ) :
(∑ i ∈ range n, (x + 1) ^ i) * x + 1 = (x + 1) ^ n := by
have := (Commute.one_right x).geom_sum₂_mul_add n
rw [one_pow, geom_sum₂_with_one] at this
exact this
#align geom_sum_mul_add geom_sum_mul_add
protected theorem Commute.geom_sum₂_mul [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
(∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ n := by
have := (h.sub_left (Commute.refl y)).geom_sum₂_mul_add n
rw [sub_add_cancel] at this
rw [← this, add_sub_cancel_right]
#align commute.geom_sum₂_mul Commute.geom_sum₂_mul
theorem Commute.mul_neg_geom_sum₂ [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
((y - x) * ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) = y ^ n - x ^ n := by
apply op_injective
simp only [op_mul, op_sub, op_geom_sum₂, op_pow]
simp [(Commute.op h.symm).geom_sum₂_mul n]
#align commute.mul_neg_geom_sum₂ Commute.mul_neg_geom_sum₂
theorem Commute.mul_geom_sum₂ [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
((x - y) * ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) = x ^ n - y ^ n := by
rw [← neg_sub (y ^ n), ← h.mul_neg_geom_sum₂, ← neg_mul, neg_sub]
#align commute.mul_geom_sum₂ Commute.mul_geom_sum₂
theorem geom_sum₂_mul [CommRing α] (x y : α) (n : ℕ) :
(∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ n :=
(Commute.all x y).geom_sum₂_mul n
#align geom_sum₂_mul geom_sum₂_mul
theorem Commute.sub_dvd_pow_sub_pow [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
x - y ∣ x ^ n - y ^ n :=
Dvd.intro _ <| h.mul_geom_sum₂ _
theorem sub_dvd_pow_sub_pow [CommRing α] (x y : α) (n : ℕ) : x - y ∣ x ^ n - y ^ n :=
(Commute.all x y).sub_dvd_pow_sub_pow n
#align sub_dvd_pow_sub_pow sub_dvd_pow_sub_pow
theorem one_sub_dvd_one_sub_pow [Ring α] (x : α) (n : ℕ) :
1 - x ∣ 1 - x ^ n := by
conv_rhs => rw [← one_pow n]
exact (Commute.one_left x).sub_dvd_pow_sub_pow n
theorem sub_one_dvd_pow_sub_one [Ring α] (x : α) (n : ℕ) :
x - 1 ∣ x ^ n - 1 := by
conv_rhs => rw [← one_pow n]
exact (Commute.one_right x).sub_dvd_pow_sub_pow n
theorem nat_sub_dvd_pow_sub_pow (x y n : ℕ) : x - y ∣ x ^ n - y ^ n := by
rcases le_or_lt y x with h | h
· have : y ^ n ≤ x ^ n := Nat.pow_le_pow_left h _
exact mod_cast sub_dvd_pow_sub_pow (x : ℤ) (↑y) n
· have : x ^ n ≤ y ^ n := Nat.pow_le_pow_left h.le _
exact (Nat.sub_eq_zero_of_le this).symm ▸ dvd_zero (x - y)
#align nat_sub_dvd_pow_sub_pow nat_sub_dvd_pow_sub_pow
theorem Odd.add_dvd_pow_add_pow [CommRing α] (x y : α) {n : ℕ} (h : Odd n) :
x + y ∣ x ^ n + y ^ n := by
have h₁ := geom_sum₂_mul x (-y) n
rw [Odd.neg_pow h y, sub_neg_eq_add, sub_neg_eq_add] at h₁
exact Dvd.intro_left _ h₁
#align odd.add_dvd_pow_add_pow Odd.add_dvd_pow_add_pow
theorem Odd.nat_add_dvd_pow_add_pow (x y : ℕ) {n : ℕ} (h : Odd n) : x + y ∣ x ^ n + y ^ n :=
mod_cast Odd.add_dvd_pow_add_pow (x : ℤ) (↑y) h
#align odd.nat_add_dvd_pow_add_pow Odd.nat_add_dvd_pow_add_pow
theorem geom_sum_mul [Ring α] (x : α) (n : ℕ) : (∑ i ∈ range n, x ^ i) * (x - 1) = x ^ n - 1 := by
have := (Commute.one_right x).geom_sum₂_mul n
rw [one_pow, geom_sum₂_with_one] at this
exact this
#align geom_sum_mul geom_sum_mul
theorem mul_geom_sum [Ring α] (x : α) (n : ℕ) : ((x - 1) * ∑ i ∈ range n, x ^ i) = x ^ n - 1 :=
op_injective <| by simpa using geom_sum_mul (op x) n
#align mul_geom_sum mul_geom_sum
theorem geom_sum_mul_neg [Ring α] (x : α) (n : ℕ) :
(∑ i ∈ range n, x ^ i) * (1 - x) = 1 - x ^ n := by
have := congr_arg Neg.neg (geom_sum_mul x n)
rw [neg_sub, ← mul_neg, neg_sub] at this
exact this
#align geom_sum_mul_neg geom_sum_mul_neg
theorem mul_neg_geom_sum [Ring α] (x : α) (n : ℕ) : ((1 - x) * ∑ i ∈ range n, x ^ i) = 1 - x ^ n :=
op_injective <| by simpa using geom_sum_mul_neg (op x) n
#align mul_neg_geom_sum mul_neg_geom_sum
protected theorem Commute.geom_sum₂_comm {α : Type u} [Semiring α] {x y : α} (n : ℕ)
(h : Commute x y) :
∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) = ∑ i ∈ range n, y ^ i * x ^ (n - 1 - i) := by
cases n; · simp
simp only [Nat.succ_eq_add_one, Nat.add_sub_cancel]
rw [← Finset.sum_flip]
refine Finset.sum_congr rfl fun i hi => ?_
simpa [Nat.sub_sub_self (Nat.succ_le_succ_iff.mp (Finset.mem_range.mp hi))] using h.pow_pow _ _
#align commute.geom_sum₂_comm Commute.geom_sum₂_comm
theorem geom_sum₂_comm {α : Type u} [CommSemiring α] (x y : α) (n : ℕ) :
∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) = ∑ i ∈ range n, y ^ i * x ^ (n - 1 - i) :=
(Commute.all x y).geom_sum₂_comm n
#align geom_sum₂_comm geom_sum₂_comm
protected theorem Commute.geom_sum₂ [DivisionRing α] {x y : α} (h' : Commute x y) (h : x ≠ y)
(n : ℕ) : ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ n) / (x - y) := by
have : x - y ≠ 0 := by simp_all [sub_eq_iff_eq_add]
rw [← h'.geom_sum₂_mul, mul_div_cancel_right₀ _ this]
#align commute.geom_sum₂ Commute.geom_sum₂
theorem geom₂_sum [Field α] {x y : α} (h : x ≠ y) (n : ℕ) :
∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ n) / (x - y) :=
(Commute.all x y).geom_sum₂ h n
#align geom₂_sum geom₂_sum
theorem geom_sum_eq [DivisionRing α] {x : α} (h : x ≠ 1) (n : ℕ) :
∑ i ∈ range n, x ^ i = (x ^ n - 1) / (x - 1) := by
have : x - 1 ≠ 0 := by simp_all [sub_eq_iff_eq_add]
rw [← geom_sum_mul, mul_div_cancel_right₀ _ this]
#align geom_sum_eq geom_sum_eq
protected theorem Commute.mul_geom_sum₂_Ico [Ring α] {x y : α} (h : Commute x y) {m n : ℕ}
(hmn : m ≤ n) :
((x - y) * ∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) = x ^ n - x ^ m * y ^ (n - m) := by
rw [sum_Ico_eq_sub _ hmn]
have :
∑ k ∈ range m, x ^ k * y ^ (n - 1 - k) =
∑ k ∈ range m, x ^ k * (y ^ (n - m) * y ^ (m - 1 - k)) := by
refine sum_congr rfl fun j j_in => ?_
rw [← pow_add]
congr
rw [mem_range, Nat.lt_iff_add_one_le, add_comm] at j_in
have h' : n - m + (m - (1 + j)) = n - (1 + j) := tsub_add_tsub_cancel hmn j_in
rw [← tsub_add_eq_tsub_tsub m, h', ← tsub_add_eq_tsub_tsub]
rw [this]
simp_rw [pow_mul_comm y (n - m) _]
simp_rw [← mul_assoc]
rw [← sum_mul, mul_sub, h.mul_geom_sum₂, ← mul_assoc, h.mul_geom_sum₂, sub_mul, ← pow_add,
add_tsub_cancel_of_le hmn, sub_sub_sub_cancel_right (x ^ n) (x ^ m * y ^ (n - m)) (y ^ n)]
#align commute.mul_geom_sum₂_Ico Commute.mul_geom_sum₂_Ico
protected theorem Commute.geom_sum₂_succ_eq {α : Type u} [Ring α] {x y : α} (h : Commute x y)
{n : ℕ} :
∑ i ∈ range (n + 1), x ^ i * y ^ (n - i) =
x ^ n + y * ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) := by
simp_rw [mul_sum, sum_range_succ_comm, tsub_self, pow_zero, mul_one, add_right_inj, ← mul_assoc,
(h.symm.pow_right _).eq, mul_assoc, ← pow_succ']
refine sum_congr rfl fun i hi => ?_
suffices n - 1 - i + 1 = n - i by rw [this]
cases' n with n
· exact absurd (List.mem_range.mp hi) i.not_lt_zero
· rw [tsub_add_eq_add_tsub (Nat.le_sub_one_of_lt (List.mem_range.mp hi)),
tsub_add_cancel_of_le (Nat.succ_le_iff.mpr n.succ_pos)]
#align commute.geom_sum₂_succ_eq Commute.geom_sum₂_succ_eq
theorem geom_sum₂_succ_eq {α : Type u} [CommRing α] (x y : α) {n : ℕ} :
∑ i ∈ range (n + 1), x ^ i * y ^ (n - i) =
x ^ n + y * ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) :=
(Commute.all x y).geom_sum₂_succ_eq
#align geom_sum₂_succ_eq geom_sum₂_succ_eq
theorem mul_geom_sum₂_Ico [CommRing α] (x y : α) {m n : ℕ} (hmn : m ≤ n) :
((x - y) * ∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) = x ^ n - x ^ m * y ^ (n - m) :=
(Commute.all x y).mul_geom_sum₂_Ico hmn
#align mul_geom_sum₂_Ico mul_geom_sum₂_Ico
protected theorem Commute.geom_sum₂_Ico_mul [Ring α] {x y : α} (h : Commute x y) {m n : ℕ}
(hmn : m ≤ n) :
(∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ (n - m) * x ^ m := by
apply op_injective
simp only [op_sub, op_mul, op_pow, op_sum]
have : (∑ k ∈ Ico m n, MulOpposite.op y ^ (n - 1 - k) * MulOpposite.op x ^ k) =
∑ k ∈ Ico m n, MulOpposite.op x ^ k * MulOpposite.op y ^ (n - 1 - k) := by
refine sum_congr rfl fun k _ => ?_
have hp := Commute.pow_pow (Commute.op h.symm) (n - 1 - k) k
simpa [Commute, SemiconjBy] using hp
simp only [this]
-- Porting note: gives deterministic timeout without this intermediate `have`
convert (Commute.op h).mul_geom_sum₂_Ico hmn
#align commute.geom_sum₂_Ico_mul Commute.geom_sum₂_Ico_mul
theorem geom_sum_Ico_mul [Ring α] (x : α) {m n : ℕ} (hmn : m ≤ n) :
(∑ i ∈ Finset.Ico m n, x ^ i) * (x - 1) = x ^ n - x ^ m := by
rw [sum_Ico_eq_sub _ hmn, sub_mul, geom_sum_mul, geom_sum_mul, sub_sub_sub_cancel_right]
#align geom_sum_Ico_mul geom_sum_Ico_mul
theorem geom_sum_Ico_mul_neg [Ring α] (x : α) {m n : ℕ} (hmn : m ≤ n) :
(∑ i ∈ Finset.Ico m n, x ^ i) * (1 - x) = x ^ m - x ^ n := by
rw [sum_Ico_eq_sub _ hmn, sub_mul, geom_sum_mul_neg, geom_sum_mul_neg, sub_sub_sub_cancel_left]
#align geom_sum_Ico_mul_neg geom_sum_Ico_mul_neg
protected theorem Commute.geom_sum₂_Ico [DivisionRing α] {x y : α} (h : Commute x y) (hxy : x ≠ y)
{m n : ℕ} (hmn : m ≤ n) :
(∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) = (x ^ n - y ^ (n - m) * x ^ m) / (x - y) := by
have : x - y ≠ 0 := by simp_all [sub_eq_iff_eq_add]
rw [← h.geom_sum₂_Ico_mul hmn, mul_div_cancel_right₀ _ this]
#align commute.geom_sum₂_Ico Commute.geom_sum₂_Ico
theorem geom_sum₂_Ico [Field α] {x y : α} (hxy : x ≠ y) {m n : ℕ} (hmn : m ≤ n) :
(∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) = (x ^ n - y ^ (n - m) * x ^ m) / (x - y) :=
(Commute.all x y).geom_sum₂_Ico hxy hmn
#align geom_sum₂_Ico geom_sum₂_Ico
theorem geom_sum_Ico [DivisionRing α] {x : α} (hx : x ≠ 1) {m n : ℕ} (hmn : m ≤ n) :
∑ i ∈ Finset.Ico m n, x ^ i = (x ^ n - x ^ m) / (x - 1) := by
simp only [sum_Ico_eq_sub _ hmn, geom_sum_eq hx, div_sub_div_same, sub_sub_sub_cancel_right]
#align geom_sum_Ico geom_sum_Ico
theorem geom_sum_Ico' [DivisionRing α] {x : α} (hx : x ≠ 1) {m n : ℕ} (hmn : m ≤ n) :
∑ i ∈ Finset.Ico m n, x ^ i = (x ^ m - x ^ n) / (1 - x) := by
simp only [geom_sum_Ico hx hmn]
convert neg_div_neg_eq (x ^ m - x ^ n) (1 - x) using 2 <;> abel
#align geom_sum_Ico' geom_sum_Ico'
| Mathlib/Algebra/GeomSum.lean | 375 | 384 | theorem geom_sum_Ico_le_of_lt_one [LinearOrderedField α] {x : α} (hx : 0 ≤ x) (h'x : x < 1)
{m n : ℕ} : ∑ i ∈ Ico m n, x ^ i ≤ x ^ m / (1 - x) := by |
rcases le_or_lt m n with (hmn | hmn)
· rw [geom_sum_Ico' h'x.ne hmn]
apply div_le_div (pow_nonneg hx _) _ (sub_pos.2 h'x) le_rfl
simpa using pow_nonneg hx _
· rw [Ico_eq_empty, sum_empty]
· apply div_nonneg (pow_nonneg hx _)
simpa using h'x.le
· simpa using hmn.le
|
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section support
variable [DecidableEq α] [Fintype α] {f g : Perm α}
def support (f : Perm α) : Finset α :=
univ.filter fun x => f x ≠ x
#align equiv.perm.support Equiv.Perm.support
@[simp]
theorem mem_support {x : α} : x ∈ f.support ↔ f x ≠ x := by
rw [support, mem_filter, and_iff_right (mem_univ x)]
#align equiv.perm.mem_support Equiv.Perm.mem_support
theorem not_mem_support {x : α} : x ∉ f.support ↔ f x = x := by simp
#align equiv.perm.not_mem_support Equiv.Perm.not_mem_support
theorem coe_support_eq_set_support (f : Perm α) : (f.support : Set α) = { x | f x ≠ x } := by
ext
simp
#align equiv.perm.coe_support_eq_set_support Equiv.Perm.coe_support_eq_set_support
@[simp]
| Mathlib/GroupTheory/Perm/Support.lean | 310 | 312 | theorem support_eq_empty_iff {σ : Perm α} : σ.support = ∅ ↔ σ = 1 := by |
simp_rw [Finset.ext_iff, mem_support, Finset.not_mem_empty, iff_false_iff, not_not,
Equiv.Perm.ext_iff, one_apply]
|
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
#align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
set_option linter.uppercaseLean3 false
noncomputable section
open Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v w y
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
section
variable [Semiring S]
variable (f : R →+* S) (x : S)
irreducible_def eval₂ (p : R[X]) : S :=
p.sum fun e a => f a * x ^ e
#align polynomial.eval₂ Polynomial.eval₂
theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by
rw [eval₂_def]
#align polynomial.eval₂_eq_sum Polynomial.eval₂_eq_sum
theorem eval₂_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R →+* S} {s t : S}
{φ ψ : R[X]} : f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ := by
rintro rfl rfl rfl; rfl
#align polynomial.eval₂_congr Polynomial.eval₂_congr
@[simp]
theorem eval₂_at_zero : p.eval₂ f 0 = f (coeff p 0) := by
simp (config := { contextual := true }) only [eval₂_eq_sum, zero_pow_eq, mul_ite, mul_zero,
mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff,
RingHom.map_zero, imp_true_iff, eq_self_iff_true]
#align polynomial.eval₂_at_zero Polynomial.eval₂_at_zero
@[simp]
theorem eval₂_zero : (0 : R[X]).eval₂ f x = 0 := by simp [eval₂_eq_sum]
#align polynomial.eval₂_zero Polynomial.eval₂_zero
@[simp]
theorem eval₂_C : (C a).eval₂ f x = f a := by simp [eval₂_eq_sum]
#align polynomial.eval₂_C Polynomial.eval₂_C
@[simp]
theorem eval₂_X : X.eval₂ f x = x := by simp [eval₂_eq_sum]
#align polynomial.eval₂_X Polynomial.eval₂_X
@[simp]
theorem eval₂_monomial {n : ℕ} {r : R} : (monomial n r).eval₂ f x = f r * x ^ n := by
simp [eval₂_eq_sum]
#align polynomial.eval₂_monomial Polynomial.eval₂_monomial
@[simp]
theorem eval₂_X_pow {n : ℕ} : (X ^ n).eval₂ f x = x ^ n := by
rw [X_pow_eq_monomial]
convert eval₂_monomial f x (n := n) (r := 1)
simp
#align polynomial.eval₂_X_pow Polynomial.eval₂_X_pow
@[simp]
theorem eval₂_add : (p + q).eval₂ f x = p.eval₂ f x + q.eval₂ f x := by
simp only [eval₂_eq_sum]
apply sum_add_index <;> simp [add_mul]
#align polynomial.eval₂_add Polynomial.eval₂_add
@[simp]
theorem eval₂_one : (1 : R[X]).eval₂ f x = 1 := by rw [← C_1, eval₂_C, f.map_one]
#align polynomial.eval₂_one Polynomial.eval₂_one
set_option linter.deprecated false in
@[simp]
theorem eval₂_bit0 : (bit0 p).eval₂ f x = bit0 (p.eval₂ f x) := by rw [bit0, eval₂_add, bit0]
#align polynomial.eval₂_bit0 Polynomial.eval₂_bit0
set_option linter.deprecated false in
@[simp]
| Mathlib/Algebra/Polynomial/Eval.lean | 105 | 106 | theorem eval₂_bit1 : (bit1 p).eval₂ f x = bit1 (p.eval₂ f x) := by |
rw [bit1, eval₂_add, eval₂_bit0, eval₂_one, bit1]
|
import Mathlib.Topology.Algebra.InfiniteSum.Basic
import Mathlib.Topology.Algebra.UniformGroup
noncomputable section
open Filter Finset Function
open scoped Topology
variable {α β γ δ : Type*}
section TopologicalGroup
variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α]
variable {f g : β → α} {a a₁ a₂ : α}
-- `by simpa using` speeds up elaboration. Why?
@[to_additive]
theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by
simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv
#align has_sum.neg HasSum.neg
@[to_additive]
theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b ↦ (f b)⁻¹ :=
hf.hasProd.inv.multipliable
#align summable.neg Summable.neg
@[to_additive]
theorem Multipliable.of_inv (hf : Multipliable fun b ↦ (f b)⁻¹) : Multipliable f := by
simpa only [inv_inv] using hf.inv
#align summable.of_neg Summable.of_neg
@[to_additive]
theorem multipliable_inv_iff : (Multipliable fun b ↦ (f b)⁻¹) ↔ Multipliable f :=
⟨Multipliable.of_inv, Multipliable.inv⟩
#align summable_neg_iff summable_neg_iff
@[to_additive]
theorem HasProd.div (hf : HasProd f a₁) (hg : HasProd g a₂) :
HasProd (fun b ↦ f b / g b) (a₁ / a₂) := by
simp only [div_eq_mul_inv]
exact hf.mul hg.inv
#align has_sum.sub HasSum.sub
@[to_additive]
theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) :
Multipliable fun b ↦ f b / g b :=
(hf.hasProd.div hg.hasProd).multipliable
#align summable.sub Summable.sub
@[to_additive]
theorem Multipliable.trans_div (hg : Multipliable g) (hfg : Multipliable fun b ↦ f b / g b) :
Multipliable f := by
simpa only [div_mul_cancel] using hfg.mul hg
#align summable.trans_sub Summable.trans_sub
@[to_additive]
theorem multipliable_iff_of_multipliable_div (hfg : Multipliable fun b ↦ f b / g b) :
Multipliable f ↔ Multipliable g :=
⟨fun hf ↦ hf.trans_div <| by simpa only [inv_div] using hfg.inv, fun hg ↦ hg.trans_div hfg⟩
#align summable_iff_of_summable_sub summable_iff_of_summable_sub
@[to_additive]
theorem HasProd.update (hf : HasProd f a₁) (b : β) [DecidableEq β] (a : α) :
HasProd (update f b a) (a / f b * a₁) := by
convert (hasProd_ite_eq b (a / f b)).mul hf with b'
by_cases h : b' = b
· rw [h, update_same]
simp [eq_self_iff_true, if_true, sub_add_cancel]
· simp only [h, update_noteq, if_false, Ne, one_mul, not_false_iff]
#align has_sum.update HasSum.update
@[to_additive]
theorem Multipliable.update (hf : Multipliable f) (b : β) [DecidableEq β] (a : α) :
Multipliable (update f b a) :=
(hf.hasProd.update b a).multipliable
#align summable.update Summable.update
@[to_additive]
theorem HasProd.hasProd_compl_iff {s : Set β} (hf : HasProd (f ∘ (↑) : s → α) a₁) :
HasProd (f ∘ (↑) : ↑sᶜ → α) a₂ ↔ HasProd f (a₁ * a₂) := by
refine ⟨fun h ↦ hf.mul_compl h, fun h ↦ ?_⟩
rw [hasProd_subtype_iff_mulIndicator] at hf ⊢
rw [Set.mulIndicator_compl]
simpa only [div_eq_mul_inv, mul_inv_cancel_comm] using h.div hf
#align has_sum.has_sum_compl_iff HasSum.hasSum_compl_iff
@[to_additive]
theorem HasProd.hasProd_iff_compl {s : Set β} (hf : HasProd (f ∘ (↑) : s → α) a₁) :
HasProd f a₂ ↔ HasProd (f ∘ (↑) : ↑sᶜ → α) (a₂ / a₁) :=
Iff.symm <| hf.hasProd_compl_iff.trans <| by rw [mul_div_cancel]
#align has_sum.has_sum_iff_compl HasSum.hasSum_iff_compl
@[to_additive]
theorem Multipliable.multipliable_compl_iff {s : Set β} (hf : Multipliable (f ∘ (↑) : s → α)) :
Multipliable (f ∘ (↑) : ↑sᶜ → α) ↔ Multipliable f where
mp := fun ⟨_, ha⟩ ↦ (hf.hasProd.hasProd_compl_iff.1 ha).multipliable
mpr := fun ⟨_, ha⟩ ↦ (hf.hasProd.hasProd_iff_compl.1 ha).multipliable
#align summable.summable_compl_iff Summable.summable_compl_iff
@[to_additive]
protected theorem Finset.hasProd_compl_iff (s : Finset β) :
HasProd (fun x : { x // x ∉ s } ↦ f x) a ↔ HasProd f (a * ∏ i ∈ s, f i) :=
(s.hasProd f).hasProd_compl_iff.trans <| by rw [mul_comm]
#align finset.has_sum_compl_iff Finset.hasSum_compl_iff
@[to_additive]
protected theorem Finset.hasProd_iff_compl (s : Finset β) :
HasProd f a ↔ HasProd (fun x : { x // x ∉ s } ↦ f x) (a / ∏ i ∈ s, f i) :=
(s.hasProd f).hasProd_iff_compl
#align finset.has_sum_iff_compl Finset.hasSum_iff_compl
@[to_additive]
protected theorem Finset.multipliable_compl_iff (s : Finset β) :
(Multipliable fun x : { x // x ∉ s } ↦ f x) ↔ Multipliable f :=
(s.multipliable f).multipliable_compl_iff
#align finset.summable_compl_iff Finset.summable_compl_iff
@[to_additive]
theorem Set.Finite.multipliable_compl_iff {s : Set β} (hs : s.Finite) :
Multipliable (f ∘ (↑) : ↑sᶜ → α) ↔ Multipliable f :=
(hs.multipliable f).multipliable_compl_iff
#align set.finite.summable_compl_iff Set.Finite.summable_compl_iff
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Group.lean | 137 | 142 | theorem hasProd_ite_div_hasProd [DecidableEq β] (hf : HasProd f a) (b : β) :
HasProd (fun n ↦ ite (n = b) 1 (f n)) (a / f b) := by |
convert hf.update b 1 using 1
· ext n
rw [Function.update_apply]
· rw [div_mul_eq_mul_div, one_mul]
|
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Monoidal.Functor
#align_import category_theory.monoidal.preadditive from "leanprover-community/mathlib"@"986c4d5761f938b2e1c43c01f001b6d9d88c2055"
noncomputable section
open scoped Classical
namespace CategoryTheory
open CategoryTheory.Limits
open CategoryTheory.MonoidalCategory
variable (C : Type*) [Category C] [Preadditive C] [MonoidalCategory C]
class MonoidalPreadditive : Prop where
whiskerLeft_zero : ∀ {X Y Z : C}, X ◁ (0 : Y ⟶ Z) = 0 := by aesop_cat
zero_whiskerRight : ∀ {X Y Z : C}, (0 : Y ⟶ Z) ▷ X = 0 := by aesop_cat
whiskerLeft_add : ∀ {X Y Z : C} (f g : Y ⟶ Z), X ◁ (f + g) = X ◁ f + X ◁ g := by aesop_cat
add_whiskerRight : ∀ {X Y Z : C} (f g : Y ⟶ Z), (f + g) ▷ X = f ▷ X + g ▷ X := by aesop_cat
#align category_theory.monoidal_preadditive CategoryTheory.MonoidalPreadditive
attribute [simp] MonoidalPreadditive.whiskerLeft_zero MonoidalPreadditive.zero_whiskerRight
attribute [simp] MonoidalPreadditive.whiskerLeft_add MonoidalPreadditive.add_whiskerRight
variable {C}
variable [MonoidalPreadditive C]
instance tensorLeft_additive (X : C) : (tensorLeft X).Additive where
#align category_theory.tensor_left_additive CategoryTheory.tensorLeft_additive
instance tensorRight_additive (X : C) : (tensorRight X).Additive where
#align category_theory.tensor_right_additive CategoryTheory.tensorRight_additive
instance tensoringLeft_additive (X : C) : ((tensoringLeft C).obj X).Additive where
#align category_theory.tensoring_left_additive CategoryTheory.tensoringLeft_additive
instance tensoringRight_additive (X : C) : ((tensoringRight C).obj X).Additive where
#align category_theory.tensoring_right_additive CategoryTheory.tensoringRight_additive
theorem monoidalPreadditive_of_faithful {D} [Category D] [Preadditive D] [MonoidalCategory D]
(F : MonoidalFunctor D C) [F.Faithful] [F.Additive] :
MonoidalPreadditive D :=
{ whiskerLeft_zero := by
intros
apply F.toFunctor.map_injective
simp [F.map_whiskerLeft]
zero_whiskerRight := by
intros
apply F.toFunctor.map_injective
simp [F.map_whiskerRight]
whiskerLeft_add := by
intros
apply F.toFunctor.map_injective
simp only [F.map_whiskerLeft, Functor.map_add, Preadditive.comp_add, Preadditive.add_comp,
MonoidalPreadditive.whiskerLeft_add]
add_whiskerRight := by
intros
apply F.toFunctor.map_injective
simp only [F.map_whiskerRight, Functor.map_add, Preadditive.comp_add, Preadditive.add_comp,
MonoidalPreadditive.add_whiskerRight] }
#align category_theory.monoidal_preadditive_of_faithful CategoryTheory.monoidalPreadditive_of_faithful
theorem whiskerLeft_sum (P : C) {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) :
P ◁ ∑ j ∈ s, g j = ∑ j ∈ s, P ◁ g j :=
map_sum ((tensoringLeft C).obj P).mapAddHom g s
theorem sum_whiskerRight {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) (P : C) :
(∑ j ∈ s, g j) ▷ P = ∑ j ∈ s, g j ▷ P :=
map_sum ((tensoringRight C).obj P).mapAddHom g s
theorem tensor_sum {P Q R S : C} {J : Type*} (s : Finset J) (f : P ⟶ Q) (g : J → (R ⟶ S)) :
(f ⊗ ∑ j ∈ s, g j) = ∑ j ∈ s, f ⊗ g j := by
simp only [tensorHom_def, whiskerLeft_sum, Preadditive.comp_sum]
#align category_theory.tensor_sum CategoryTheory.tensor_sum
theorem sum_tensor {P Q R S : C} {J : Type*} (s : Finset J) (f : P ⟶ Q) (g : J → (R ⟶ S)) :
(∑ j ∈ s, g j) ⊗ f = ∑ j ∈ s, g j ⊗ f := by
simp only [tensorHom_def, sum_whiskerRight, Preadditive.sum_comp]
#align category_theory.sum_tensor CategoryTheory.sum_tensor
-- In a closed monoidal category, this would hold because
-- `tensorLeft X` is a left adjoint and hence preserves all colimits.
-- In any case it is true in any preadditive category.
instance (X : C) : PreservesFiniteBiproducts (tensorLeft X) where
preserves {J} :=
{ preserves := fun {f} =>
{ preserves := fun {b} i => isBilimitOfTotal _ (by
dsimp
simp_rw [← id_tensorHom]
simp only [← tensor_comp, Category.comp_id, ← tensor_sum, ← tensor_id,
IsBilimit.total i]) } }
instance (X : C) : PreservesFiniteBiproducts (tensorRight X) where
preserves {J} :=
{ preserves := fun {f} =>
{ preserves := fun {b} i => isBilimitOfTotal _ (by
dsimp
simp_rw [← tensorHom_id]
simp only [← tensor_comp, Category.comp_id, ← sum_tensor, ← tensor_id,
IsBilimit.total i]) } }
variable [HasFiniteBiproducts C]
def leftDistributor {J : Type} [Fintype J] (X : C) (f : J → C) : X ⊗ ⨁ f ≅ ⨁ fun j => X ⊗ f j :=
(tensorLeft X).mapBiproduct f
#align category_theory.left_distributor CategoryTheory.leftDistributor
theorem leftDistributor_hom {J : Type} [Fintype J] (X : C) (f : J → C) :
(leftDistributor X f).hom =
∑ j : J, (X ◁ biproduct.π f j) ≫ biproduct.ι (fun j => X ⊗ f j) j := by
ext
dsimp [leftDistributor, Functor.mapBiproduct, Functor.mapBicone]
erw [biproduct.lift_π]
simp only [Preadditive.sum_comp, Category.assoc, biproduct.ι_π, comp_dite, comp_zero,
Finset.sum_dite_eq', Finset.mem_univ, ite_true, eqToHom_refl, Category.comp_id]
#align category_theory.left_distributor_hom CategoryTheory.leftDistributor_hom
theorem leftDistributor_inv {J : Type} [Fintype J] (X : C) (f : J → C) :
(leftDistributor X f).inv = ∑ j : J, biproduct.π _ j ≫ (X ◁ biproduct.ι f j) := by
ext
dsimp [leftDistributor, Functor.mapBiproduct, Functor.mapBicone]
simp only [Preadditive.comp_sum, biproduct.ι_π_assoc, dite_comp, zero_comp,
Finset.sum_dite_eq, Finset.mem_univ, ite_true, eqToHom_refl, Category.id_comp,
biproduct.ι_desc]
#align category_theory.left_distributor_inv CategoryTheory.leftDistributor_inv
@[reassoc (attr := simp)]
theorem leftDistributor_hom_comp_biproduct_π {J : Type} [Fintype J] (X : C) (f : J → C) (j : J) :
(leftDistributor X f).hom ≫ biproduct.π _ j = X ◁ biproduct.π _ j := by
simp [leftDistributor_hom, Preadditive.sum_comp, biproduct.ι_π, comp_dite]
@[reassoc (attr := simp)]
theorem biproduct_ι_comp_leftDistributor_hom {J : Type} [Fintype J] (X : C) (f : J → C) (j : J) :
(X ◁ biproduct.ι _ j) ≫ (leftDistributor X f).hom = biproduct.ι (fun j => X ⊗ f j) j := by
simp [leftDistributor_hom, Preadditive.comp_sum, ← MonoidalCategory.whiskerLeft_comp_assoc,
biproduct.ι_π, whiskerLeft_dite, dite_comp]
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Monoidal/Preadditive.lean | 182 | 185 | theorem leftDistributor_inv_comp_biproduct_π {J : Type} [Fintype J] (X : C) (f : J → C) (j : J) :
(leftDistributor X f).inv ≫ (X ◁ biproduct.π _ j) = biproduct.π _ j := by |
simp [leftDistributor_inv, Preadditive.sum_comp, ← MonoidalCategory.whiskerLeft_comp,
biproduct.ι_π, whiskerLeft_dite, comp_dite]
|
import Mathlib.RingTheory.AdicCompletion.Basic
import Mathlib.RingTheory.AdicCompletion.Algebra
import Mathlib.Algebra.DirectSum.Basic
variable {R : Type*} [CommRing R] (I : Ideal R)
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {N : Type*} [AddCommGroup N] [Module R N]
variable {P : Type*} [AddCommGroup P] [Module R P]
variable {T : Type*} [AddCommGroup T] [Module (AdicCompletion I R) T]
namespace AdicCompletion
open LinearMap
theorem transitionMap_comp_reduceModIdeal (f : M →ₗ[R] N) {m n : ℕ}
(hmn : m ≤ n) : transitionMap I N hmn ∘ₗ f.reduceModIdeal (I ^ n) =
(f.reduceModIdeal (I ^ m) : _ →ₗ[R] _) ∘ₗ transitionMap I M hmn := by
ext x
simp
private def adicCompletionAux (f : M →ₗ[R] N) :
AdicCompletion I M →ₗ[R] AdicCompletion I N :=
AdicCompletion.lift I (fun n ↦ reduceModIdeal (I ^ n) f ∘ₗ AdicCompletion.eval I M n)
(fun {m n} hmn ↦ by rw [← comp_assoc, AdicCompletion.transitionMap_comp_reduceModIdeal,
comp_assoc, transitionMap_comp_eval])
@[local simp]
private theorem adicCompletionAux_val_apply (f : M →ₗ[R] N) {n : ℕ} (x : AdicCompletion I M) :
(adicCompletionAux I f x).val n = f.reduceModIdeal (I ^ n) (x.val n) :=
rfl
def map (f : M →ₗ[R] N) :
AdicCompletion I M →ₗ[AdicCompletion I R] AdicCompletion I N where
toFun := adicCompletionAux I f
map_add' := by aesop
map_smul' r x := by
ext n
simp only [adicCompletionAux_val_apply, smul_eval, smul_eq_mul, RingHom.id_apply]
rw [val_smul_eq_evalₐ_smul, val_smul_eq_evalₐ_smul, map_smul]
@[simp]
theorem map_val_apply (f : M →ₗ[R] N) {n : ℕ} (x : AdicCompletion I M) :
(map I f x).val n = f.reduceModIdeal (I ^ n) (x.val n) :=
rfl
theorem map_ext {f g : AdicCompletion I M → N}
(h : ∀ (a : AdicCauchySequence I M),
f (AdicCompletion.mk I M a) = g (AdicCompletion.mk I M a)) :
f = g := by
ext x
apply induction_on I M x (fun a ↦ h a)
@[ext]
theorem map_ext' {f g : AdicCompletion I M →ₗ[AdicCompletion I R] T}
(h : ∀ (a : AdicCauchySequence I M),
f (AdicCompletion.mk I M a) = g (AdicCompletion.mk I M a)) :
f = g := by
ext x
apply induction_on I M x (fun a ↦ h a)
@[ext]
theorem map_ext'' {f g : AdicCompletion I M →ₗ[R] N}
(h : f.comp (AdicCompletion.mk I M) = g.comp (AdicCompletion.mk I M)) :
f = g := by
ext x
apply induction_on I M x (fun a ↦ LinearMap.ext_iff.mp h a)
variable (M) in
@[simp]
theorem map_id :
map I (LinearMap.id (M := M)) =
LinearMap.id (R := AdicCompletion I R) (M := AdicCompletion I M) := by
ext a n
simp
theorem map_comp (f : M →ₗ[R] N) (g : N →ₗ[R] P) :
map I g ∘ₗ map I f = map I (g ∘ₗ f) := by
ext
simp
theorem map_comp_apply (f : M →ₗ[R] N) (g : N →ₗ[R] P) (x : AdicCompletion I M) :
map I g (map I f x) = map I (g ∘ₗ f) x := by
show (map I g ∘ₗ map I f) x = map I (g ∘ₗ f) x
rw [map_comp]
@[simp]
theorem map_mk (f : M →ₗ[R] N) (a : AdicCauchySequence I M) :
map I f (AdicCompletion.mk I M a) =
AdicCompletion.mk I N (AdicCauchySequence.map I f a) :=
rfl
@[simp]
theorem val_sum {α : Type*} (s : Finset α) (f : α → AdicCompletion I M) (n : ℕ) :
(Finset.sum s f).val n = Finset.sum s (fun a ↦ (f a).val n) := by
change (Submodule.subtype (AdicCompletion.submodule I M) _) n = _
rw [map_sum, Finset.sum_apply, Submodule.coeSubtype]
def congr (f : M ≃ₗ[R] N) :
AdicCompletion I M ≃ₗ[AdicCompletion I R] AdicCompletion I N :=
LinearEquiv.ofLinear (map I f)
(map I f.symm) (by simp [map_comp]) (by simp [map_comp])
@[simp]
theorem congr_apply (f : M ≃ₗ[R] N) (x : AdicCompletion I M) :
congr I f x = map I f x :=
rfl
@[simp]
theorem congr_symm_apply (f : M ≃ₗ[R] N) (x : AdicCompletion I N) :
(congr I f).symm x = map I f.symm x :=
rfl
section Families
variable {ι : Type*} [DecidableEq ι] (M : ι → Type*) [∀ i, AddCommGroup (M i)]
[∀ i, Module R (M i)]
section Pi
open DirectSum
variable [Fintype ι]
def piEquivOfFintype :
AdicCompletion I (∀ j, M j) ≃ₗ[AdicCompletion I R] ∀ j, AdicCompletion I (M j) :=
letI f := (congr I (linearEquivFunOnFintype R ι M)).symm
letI g := (linearEquivFunOnFintype (AdicCompletion I R) ι (fun j ↦ AdicCompletion I (M j)))
f.trans ((sumEquivOfFintype I M).symm.trans g)
@[simp]
theorem piEquivOfFintype_apply (x : AdicCompletion I (∀ j, M j)) :
piEquivOfFintype I M x = pi I M x := by
simp [piEquivOfFintype, sumInv, map_comp_apply]
def piEquivFin (n : ℕ) :
AdicCompletion I (Fin n → R) ≃ₗ[AdicCompletion I R] Fin n → AdicCompletion I R :=
piEquivOfFintype I (ι := Fin n) (fun _ : Fin n ↦ R)
@[simp]
| Mathlib/RingTheory/AdicCompletion/Functoriality.lean | 344 | 346 | theorem piEquivFin_apply (n : ℕ) (x : AdicCompletion I (Fin n → R)) :
piEquivFin I n x = pi I (fun _ : Fin n ↦ R) x := by |
simp only [piEquivFin, piEquivOfFintype_apply]
|
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Logic.Encodable.Lattice
noncomputable section
open Filter Finset Function Encodable
open scoped Topology
variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M}
variable {G : Type*} [CommGroup G] {g g' : G}
-- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead
section Nat
section Monoid
namespace HasProd
@[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge
to `m`."]
theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) :=
h.comp tendsto_finset_range
#align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat
@[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge
to `∑' i, f i`."]
theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) :=
tendsto_prod_nat h.hasProd
section tprod
variable [T2Space M] {α β γ : Type*}
section Countable
variable [Countable β]
@[to_additive "If a function is countably sub-additive then it is sub-additive on countable types"]
theorem rel_iSup_tprod [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop)
(m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s : β → α) :
R (m (⨆ b : β, s b)) (∏' b : β, m (s b)) := by
cases nonempty_encodable β
rw [← iSup_decode₂, ← tprod_iSup_decode₂ _ m0 s]
exact m_iSup _
#align rel_supr_tsum rel_iSup_tsum
@[to_additive "If a function is countably sub-additive then it is sub-additive on finite sets"]
theorem rel_iSup_prod [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop)
(m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s : γ → α) (t : Finset γ) :
R (m (⨆ d ∈ t, s d)) (∏ d ∈ t, m (s d)) := by
rw [iSup_subtype', ← Finset.tprod_subtype]
exact rel_iSup_tprod m m0 R m_iSup _
#align rel_supr_sum rel_iSup_sum
@[to_additive "If a function is countably sub-additive then it is binary sub-additive"]
| Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean | 174 | 179 | theorem rel_sup_mul [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (R : M → M → Prop)
(m_iSup : ∀ s : ℕ → α, R (m (⨆ i, s i)) (∏' i, m (s i))) (s₁ s₂ : α) :
R (m (s₁ ⊔ s₂)) (m s₁ * m s₂) := by |
convert rel_iSup_tprod m m0 R m_iSup fun b ↦ cond b s₁ s₂
· simp only [iSup_bool_eq, cond]
· rw [tprod_fintype, Fintype.prod_bool, cond, cond]
|
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d"
open NormedField Set
open scoped Pointwise Topology NNReal
noncomputable section
variable {𝕜 E F : Type*}
section AddCommGroup
variable [AddCommGroup E] [Module ℝ E]
def gauge (s : Set E) (x : E) : ℝ :=
sInf { r : ℝ | 0 < r ∧ x ∈ r • s }
#align gauge gauge
variable {s t : Set E} {x : E} {a : ℝ}
theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) :=
rfl
#align gauge_def gauge_def
theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by
congrm sInf {r | ?_}
exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _
#align gauge_def' gauge_def'
private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } :=
⟨0, fun _ hr => hr.1.le⟩
theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) :
{ r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty :=
let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos
⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩
#align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty
theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ =>
csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩
#align gauge_mono gauge_mono
theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) :
∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by
obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h
exact ⟨b, hb, hba, hx⟩
#align exists_lt_of_gauge_lt exists_lt_of_gauge_lt
@[simp]
theorem gauge_zero : gauge s 0 = 0 := by
rw [gauge_def']
by_cases h : (0 : E) ∈ s
· simp only [smul_zero, sep_true, h, csInf_Ioi]
· simp only [smul_zero, sep_false, h, Real.sInf_empty]
#align gauge_zero gauge_zero
@[simp]
theorem gauge_zero' : gauge (0 : Set E) = 0 := by
ext x
rw [gauge_def']
obtain rfl | hx := eq_or_ne x 0
· simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero]
· simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero]
convert Real.sInf_empty
exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx
#align gauge_zero' gauge_zero'
@[simp]
theorem gauge_empty : gauge (∅ : Set E) = 0 := by
ext
simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false]
#align gauge_empty gauge_empty
theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by
obtain rfl | rfl := subset_singleton_iff_eq.1 h
exacts [gauge_empty, gauge_zero']
#align gauge_of_subset_zero gauge_of_subset_zero
theorem gauge_nonneg (x : E) : 0 ≤ gauge s x :=
Real.sInf_nonneg _ fun _ hx => hx.1.le
#align gauge_nonneg gauge_nonneg
theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by
have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩
simp_rw [gauge_def', smul_neg, this]
#align gauge_neg gauge_neg
theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by
simp_rw [gauge_def', smul_neg, neg_mem_neg]
#align gauge_neg_set_neg gauge_neg_set_neg
theorem gauge_neg_set_eq_gauge_neg (x : E) : gauge (-s) x = gauge s (-x) := by
rw [← gauge_neg_set_neg, neg_neg]
#align gauge_neg_set_eq_gauge_neg gauge_neg_set_eq_gauge_neg
theorem gauge_le_of_mem (ha : 0 ≤ a) (hx : x ∈ a • s) : gauge s x ≤ a := by
obtain rfl | ha' := ha.eq_or_lt
· rw [mem_singleton_iff.1 (zero_smul_set_subset _ hx), gauge_zero]
· exact csInf_le gauge_set_bddBelow ⟨ha', hx⟩
#align gauge_le_of_mem gauge_le_of_mem
theorem gauge_le_eq (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ : Absorbent ℝ s) (ha : 0 ≤ a) :
{ x | gauge s x ≤ a } = ⋂ (r : ℝ) (_ : a < r), r • s := by
ext x
simp_rw [Set.mem_iInter, Set.mem_setOf_eq]
refine ⟨fun h r hr => ?_, fun h => le_of_forall_pos_lt_add fun ε hε => ?_⟩
· have hr' := ha.trans_lt hr
rw [mem_smul_set_iff_inv_smul_mem₀ hr'.ne']
obtain ⟨δ, δ_pos, hδr, hδ⟩ := exists_lt_of_gauge_lt hs₂ (h.trans_lt hr)
suffices (r⁻¹ * δ) • δ⁻¹ • x ∈ s by rwa [smul_smul, mul_inv_cancel_right₀ δ_pos.ne'] at this
rw [mem_smul_set_iff_inv_smul_mem₀ δ_pos.ne'] at hδ
refine hs₁.smul_mem_of_zero_mem hs₀ hδ ⟨by positivity, ?_⟩
rw [inv_mul_le_iff hr', mul_one]
exact hδr.le
· have hε' := (lt_add_iff_pos_right a).2 (half_pos hε)
exact
(gauge_le_of_mem (ha.trans hε'.le) <| h _ hε').trans_lt (add_lt_add_left (half_lt_self hε) _)
#align gauge_le_eq gauge_le_eq
theorem gauge_lt_eq' (absorbs : Absorbent ℝ s) (a : ℝ) :
{ x | gauge s x < a } = ⋃ (r : ℝ) (_ : 0 < r) (_ : r < a), r • s := by
ext
simp_rw [mem_setOf, mem_iUnion, exists_prop]
exact
⟨exists_lt_of_gauge_lt absorbs, fun ⟨r, hr₀, hr₁, hx⟩ =>
(gauge_le_of_mem hr₀.le hx).trans_lt hr₁⟩
#align gauge_lt_eq' gauge_lt_eq'
theorem gauge_lt_eq (absorbs : Absorbent ℝ s) (a : ℝ) :
{ x | gauge s x < a } = ⋃ r ∈ Set.Ioo 0 (a : ℝ), r • s := by
ext
simp_rw [mem_setOf, mem_iUnion, exists_prop, mem_Ioo, and_assoc]
exact
⟨exists_lt_of_gauge_lt absorbs, fun ⟨r, hr₀, hr₁, hx⟩ =>
(gauge_le_of_mem hr₀.le hx).trans_lt hr₁⟩
#align gauge_lt_eq gauge_lt_eq
theorem mem_openSegment_of_gauge_lt_one (absorbs : Absorbent ℝ s) (hgauge : gauge s x < 1) :
∃ y ∈ s, x ∈ openSegment ℝ 0 y := by
rcases exists_lt_of_gauge_lt absorbs hgauge with ⟨r, hr₀, hr₁, y, hy, rfl⟩
refine ⟨y, hy, 1 - r, r, ?_⟩
simp [*]
theorem gauge_lt_one_subset_self (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) (absorbs : Absorbent ℝ s) :
{ x | gauge s x < 1 } ⊆ s := fun _x hx ↦
let ⟨_y, hys, hx⟩ := mem_openSegment_of_gauge_lt_one absorbs hx
hs.openSegment_subset h₀ hys hx
#align gauge_lt_one_subset_self gauge_lt_one_subset_self
theorem gauge_le_one_of_mem {x : E} (hx : x ∈ s) : gauge s x ≤ 1 :=
gauge_le_of_mem zero_le_one <| by rwa [one_smul]
#align gauge_le_one_of_mem gauge_le_one_of_mem
theorem gauge_add_le (hs : Convex ℝ s) (absorbs : Absorbent ℝ s) (x y : E) :
gauge s (x + y) ≤ gauge s x + gauge s y := by
refine le_of_forall_pos_lt_add fun ε hε => ?_
obtain ⟨a, ha, ha', x, hx, rfl⟩ :=
exists_lt_of_gauge_lt absorbs (lt_add_of_pos_right (gauge s x) (half_pos hε))
obtain ⟨b, hb, hb', y, hy, rfl⟩ :=
exists_lt_of_gauge_lt absorbs (lt_add_of_pos_right (gauge s y) (half_pos hε))
calc
gauge s (a • x + b • y) ≤ a + b := gauge_le_of_mem (by positivity) <| by
rw [hs.add_smul ha.le hb.le]
exact add_mem_add (smul_mem_smul_set hx) (smul_mem_smul_set hy)
_ < gauge s (a • x) + gauge s (b • y) + ε := by linarith
#align gauge_add_le gauge_add_le
theorem self_subset_gauge_le_one : s ⊆ { x | gauge s x ≤ 1 } := fun _ => gauge_le_one_of_mem
#align self_subset_gauge_le_one self_subset_gauge_le_one
theorem Convex.gauge_le (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) (absorbs : Absorbent ℝ s) (a : ℝ) :
Convex ℝ { x | gauge s x ≤ a } := by
by_cases ha : 0 ≤ a
· rw [gauge_le_eq hs h₀ absorbs ha]
exact convex_iInter fun i => convex_iInter fun _ => hs.smul _
· -- Porting note: `convert` needed help
convert convex_empty (𝕜 := ℝ) (E := E)
exact eq_empty_iff_forall_not_mem.2 fun x hx => ha <| (gauge_nonneg _).trans hx
#align convex.gauge_le Convex.gauge_le
theorem Balanced.starConvex (hs : Balanced ℝ s) : StarConvex ℝ 0 s :=
starConvex_zero_iff.2 fun x hx a ha₀ ha₁ =>
hs _ (by rwa [Real.norm_of_nonneg ha₀]) (smul_mem_smul_set hx)
#align balanced.star_convex Balanced.starConvex
theorem le_gauge_of_not_mem (hs₀ : StarConvex ℝ 0 s) (hs₂ : Absorbs ℝ s {x}) (hx : x ∉ a • s) :
a ≤ gauge s x := by
rw [starConvex_zero_iff] at hs₀
obtain ⟨r, hr, h⟩ := hs₂.exists_pos
refine le_csInf ⟨r, hr, singleton_subset_iff.1 <| h _ (Real.norm_of_nonneg hr.le).ge⟩ ?_
rintro b ⟨hb, x, hx', rfl⟩
refine not_lt.1 fun hba => hx ?_
have ha := hb.trans hba
refine ⟨(a⁻¹ * b) • x, hs₀ hx' (by positivity) ?_, ?_⟩
· rw [← div_eq_inv_mul]
exact div_le_one_of_le hba.le ha.le
· dsimp only
rw [← mul_smul, mul_inv_cancel_left₀ ha.ne']
#align le_gauge_of_not_mem le_gauge_of_not_mem
theorem one_le_gauge_of_not_mem (hs₁ : StarConvex ℝ 0 s) (hs₂ : Absorbs ℝ s {x}) (hx : x ∉ s) :
1 ≤ gauge s x :=
le_gauge_of_not_mem hs₁ hs₂ <| by rwa [one_smul]
#align one_le_gauge_of_not_mem one_le_gauge_of_not_mem
section LinearOrderedField
variable {α : Type*} [LinearOrderedField α] [MulActionWithZero α ℝ] [OrderedSMul α ℝ]
| Mathlib/Analysis/Convex/Gauge.lean | 257 | 279 | theorem gauge_smul_of_nonneg [MulActionWithZero α E] [IsScalarTower α ℝ (Set E)] {s : Set E} {a : α}
(ha : 0 ≤ a) (x : E) : gauge s (a • x) = a • gauge s x := by |
obtain rfl | ha' := ha.eq_or_lt
· rw [zero_smul, gauge_zero, zero_smul]
rw [gauge_def', gauge_def', ← Real.sInf_smul_of_nonneg ha]
congr 1
ext r
simp_rw [Set.mem_smul_set, Set.mem_sep_iff]
constructor
· rintro ⟨hr, hx⟩
simp_rw [mem_Ioi] at hr ⊢
rw [← mem_smul_set_iff_inv_smul_mem₀ hr.ne'] at hx
have := smul_pos (inv_pos.2 ha') hr
refine ⟨a⁻¹ • r, ⟨this, ?_⟩, smul_inv_smul₀ ha'.ne' _⟩
rwa [← mem_smul_set_iff_inv_smul_mem₀ this.ne', smul_assoc,
mem_smul_set_iff_inv_smul_mem₀ (inv_ne_zero ha'.ne'), inv_inv]
· rintro ⟨r, ⟨hr, hx⟩, rfl⟩
rw [mem_Ioi] at hr ⊢
rw [← mem_smul_set_iff_inv_smul_mem₀ hr.ne'] at hx
have := smul_pos ha' hr
refine ⟨this, ?_⟩
rw [← mem_smul_set_iff_inv_smul_mem₀ this.ne', smul_assoc]
exact smul_mem_smul_set hx
|
import Mathlib.Algebra.DirectSum.Module
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Convex.Uniform
import Mathlib.Analysis.NormedSpace.Completion
import Mathlib.Analysis.NormedSpace.BoundedLinearMaps
#align_import analysis.inner_product_space.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
noncomputable section
open RCLike Real Filter
open Topology ComplexConjugate
open LinearMap (BilinForm)
variable {𝕜 E F : Type*} [RCLike 𝕜]
class Inner (𝕜 E : Type*) where
inner : E → E → 𝕜
#align has_inner Inner
export Inner (inner)
notation3:max "⟪" x ", " y "⟫_" 𝕜:max => @inner 𝕜 _ _ x y
class InnerProductSpace (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] extends
NormedSpace 𝕜 E, Inner 𝕜 E where
norm_sq_eq_inner : ∀ x : E, ‖x‖ ^ 2 = re (inner x x)
conj_symm : ∀ x y, conj (inner y x) = inner x y
add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z
smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y
#align inner_product_space InnerProductSpace
-- @[nolint HasNonemptyInstance] porting note: I don't think we have this linter anymore
structure InnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F]
[Module 𝕜 F] extends Inner 𝕜 F where
conj_symm : ∀ x y, conj (inner y x) = inner x y
nonneg_re : ∀ x, 0 ≤ re (inner x x)
definite : ∀ x, inner x x = 0 → x = 0
add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z
smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y
#align inner_product_space.core InnerProductSpace.Core
attribute [class] InnerProductSpace.Core
def InnerProductSpace.toCore [NormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] :
InnerProductSpace.Core 𝕜 E :=
{ c with
nonneg_re := fun x => by
rw [← InnerProductSpace.norm_sq_eq_inner]
apply sq_nonneg
definite := fun x hx =>
norm_eq_zero.1 <| pow_eq_zero (n := 2) <| by
rw [InnerProductSpace.norm_sq_eq_inner (𝕜 := 𝕜) x, hx, map_zero] }
#align inner_product_space.to_core InnerProductSpace.toCore
section
attribute [local instance] InnerProductSpace.Core.toNormedAddCommGroup
def InnerProductSpace.ofCore [AddCommGroup F] [Module 𝕜 F] (c : InnerProductSpace.Core 𝕜 F) :
InnerProductSpace 𝕜 F :=
letI : NormedSpace 𝕜 F := @InnerProductSpace.Core.toNormedSpace 𝕜 F _ _ _ c
{ c with
norm_sq_eq_inner := fun x => by
have h₁ : ‖x‖ ^ 2 = √(re (c.inner x x)) ^ 2 := rfl
have h₂ : 0 ≤ re (c.inner x x) := InnerProductSpace.Core.inner_self_nonneg
simp [h₁, sq_sqrt, h₂] }
#align inner_product_space.of_core InnerProductSpace.ofCore
end
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
local notation "IK" => @RCLike.I 𝕜 _
local postfix:90 "†" => starRingEnd _
export InnerProductSpace (norm_sq_eq_inner)
section OrthonormalSets
variable {ι : Type*} (𝕜)
def Orthonormal (v : ι → E) : Prop :=
(∀ i, ‖v i‖ = 1) ∧ Pairwise fun i j => ⟪v i, v j⟫ = 0
#align orthonormal Orthonormal
variable {𝕜}
theorem orthonormal_iff_ite [DecidableEq ι] {v : ι → E} :
Orthonormal 𝕜 v ↔ ∀ i j, ⟪v i, v j⟫ = if i = j then (1 : 𝕜) else (0 : 𝕜) := by
constructor
· intro hv i j
split_ifs with h
· simp [h, inner_self_eq_norm_sq_to_K, hv.1]
· exact hv.2 h
· intro h
constructor
· intro i
have h' : ‖v i‖ ^ 2 = 1 ^ 2 := by simp [@norm_sq_eq_inner 𝕜, h i i]
have h₁ : 0 ≤ ‖v i‖ := norm_nonneg _
have h₂ : (0 : ℝ) ≤ 1 := zero_le_one
rwa [sq_eq_sq h₁ h₂] at h'
· intro i j hij
simpa [hij] using h i j
#align orthonormal_iff_ite orthonormal_iff_ite
theorem orthonormal_subtype_iff_ite [DecidableEq E] {s : Set E} :
Orthonormal 𝕜 (Subtype.val : s → E) ↔ ∀ v ∈ s, ∀ w ∈ s, ⟪v, w⟫ = if v = w then 1 else 0 := by
rw [orthonormal_iff_ite]
constructor
· intro h v hv w hw
convert h ⟨v, hv⟩ ⟨w, hw⟩ using 1
simp
· rintro h ⟨v, hv⟩ ⟨w, hw⟩
convert h v hv w hw using 1
simp
#align orthonormal_subtype_iff_ite orthonormal_subtype_iff_ite
| Mathlib/Analysis/InnerProductSpace/Basic.lean | 776 | 779 | theorem Orthonormal.inner_right_finsupp {v : ι → E} (hv : Orthonormal 𝕜 v) (l : ι →₀ 𝕜) (i : ι) :
⟪v i, Finsupp.total ι E 𝕜 v l⟫ = l i := by |
classical
simpa [Finsupp.total_apply, Finsupp.inner_sum, orthonormal_iff_ite.mp hv] using Eq.symm
|
import Mathlib.Topology.Algebra.Ring.Basic
import Mathlib.RingTheory.Ideal.Quotient
#align_import topology.algebra.ring.ideal from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
section CommRing
variable {R : Type*} [TopologicalSpace R] [CommRing R] (N : Ideal R)
open Ideal.Quotient
instance topologicalRingQuotientTopology : TopologicalSpace (R ⧸ N) :=
instTopologicalSpaceQuotient
#align topological_ring_quotient_topology topologicalRingQuotientTopology
-- note for the reader: in the following, `mk` is `Ideal.Quotient.mk`, the canonical map `R → R/I`.
variable [TopologicalRing R]
| Mathlib/Topology/Algebra/Ring/Ideal.lean | 61 | 65 | theorem QuotientRing.isOpenMap_coe : IsOpenMap (mk N) := by |
intro s s_op
change IsOpen (mk N ⁻¹' (mk N '' s))
rw [quotient_ring_saturate]
exact isOpen_iUnion fun ⟨n, _⟩ => isOpenMap_add_left n s s_op
|
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Algebra.Ring.Rat
#align_import data.rat.order from "leanprover-community/mathlib"@"a59dad53320b73ef180174aae867addd707ef00e"
assert_not_exists Field
assert_not_exists Finset
assert_not_exists Set.Icc
assert_not_exists GaloisConnection
namespace Rat
variable {a b c p q : ℚ}
@[simp] lemma divInt_nonneg_iff_of_pos_right {a b : ℤ} (hb : 0 < b) : 0 ≤ a /. b ↔ 0 ≤ a := by
cases' hab : a /. b with n d hd hnd
rw [mk'_eq_divInt, divInt_eq_iff hb.ne' (mod_cast hd)] at hab
rw [← num_nonneg, ← mul_nonneg_iff_of_pos_right hb, ← hab,
mul_nonneg_iff_of_pos_right (mod_cast Nat.pos_of_ne_zero hd)]
#align rat.mk_nonneg Rat.divInt_nonneg_iff_of_pos_right
@[simp] lemma divInt_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a /. b := by
obtain rfl | hb := hb.eq_or_lt
· simp
rfl
rwa [divInt_nonneg_iff_of_pos_right hb]
@[simp] lemma mkRat_nonneg {a : ℤ} (ha : 0 ≤ a) (b : ℕ) : 0 ≤ mkRat a b := by
simpa using divInt_nonneg ha (Int.natCast_nonneg _)
theorem ofScientific_nonneg (m : ℕ) (s : Bool) (e : ℕ) :
0 ≤ Rat.ofScientific m s e := by
rw [Rat.ofScientific]
cases s
· rw [if_neg (by decide)]
refine num_nonneg.mp ?_
rw [num_natCast]
exact Int.natCast_nonneg _
· rw [if_pos rfl, normalize_eq_mkRat]
exact Rat.mkRat_nonneg (Int.natCast_nonneg _) _
instance _root_.NNRatCast.toOfScientific {K} [NNRatCast K] : OfScientific K where
ofScientific (m : ℕ) (b : Bool) (d : ℕ) :=
NNRat.cast ⟨Rat.ofScientific m b d, ofScientific_nonneg m b d⟩
@[simp, norm_cast]
theorem _root_.NNRat.cast_ofScientific {K} [NNRatCast K] (m : ℕ) (s : Bool) (e : ℕ) :
(OfScientific.ofScientific m s e : ℚ≥0) = (OfScientific.ofScientific m s e : K) :=
rfl
protected lemma add_nonneg : 0 ≤ a → 0 ≤ b → 0 ≤ a + b :=
numDenCasesOn' a fun n₁ d₁ h₁ ↦ numDenCasesOn' b fun n₂ d₂ h₂ ↦ by
have d₁0 : 0 < (d₁ : ℤ) := mod_cast Nat.pos_of_ne_zero h₁
have d₂0 : 0 < (d₂ : ℤ) := mod_cast Nat.pos_of_ne_zero h₂
simp only [d₁0, d₂0, h₁, h₂, mul_pos, divInt_nonneg_iff_of_pos_right, divInt_add_divInt, Ne,
Nat.cast_eq_zero, not_false_iff]
intro n₁0 n₂0
apply add_nonneg <;> apply mul_nonneg <;> · first |assumption|apply Int.ofNat_zero_le
#align rat.nonneg_add Rat.add_nonneg
protected lemma mul_nonneg : 0 ≤ a → 0 ≤ b → 0 ≤ a * b :=
numDenCasesOn' a fun n₁ d₁ h₁ =>
numDenCasesOn' b fun n₂ d₂ h₂ => by
have d₁0 : 0 < (d₁ : ℤ) := mod_cast Nat.pos_of_ne_zero h₁
have d₂0 : 0 < (d₂ : ℤ) := mod_cast Nat.pos_of_ne_zero h₂
simp only [d₁0, d₂0, mul_pos, divInt_nonneg_iff_of_pos_right,
divInt_mul_divInt _ _ d₁0.ne' d₂0.ne']
apply mul_nonneg
#align rat.nonneg_mul Rat.mul_nonneg
#align rat.mul_nonneg Rat.mul_nonneg
-- Porting note (#11215): TODO can this be shortened?
protected theorem le_iff_sub_nonneg (a b : ℚ) : a ≤ b ↔ 0 ≤ b - a :=
numDenCasesOn'' a fun na da ha hared =>
numDenCasesOn'' b fun nb db hb hbred => by
change Rat.blt _ _ = false ↔ _
unfold Rat.blt
simp only [Bool.and_eq_true, decide_eq_true_eq, Bool.ite_eq_false_distrib,
decide_eq_false_iff_not, not_lt, ite_eq_left_iff, not_and, not_le, ← num_nonneg]
split_ifs with h h'
· rw [Rat.sub_def]
simp only [false_iff, not_le]
simp only [normalize_eq]
apply Int.ediv_neg'
· rw [sub_neg]
apply lt_of_lt_of_le
· apply mul_neg_of_neg_of_pos h.1
rwa [Int.natCast_pos, Nat.pos_iff_ne_zero]
· apply mul_nonneg h.2 (Int.natCast_nonneg _)
· simp only [Int.natCast_pos, Nat.pos_iff_ne_zero]
exact Nat.gcd_ne_zero_right (Nat.mul_ne_zero hb ha)
· simp only [divInt_ofNat, ← zero_iff_num_zero, mkRat_eq_zero hb] at h'
simp [h']
· simp only [Rat.sub_def, normalize_eq]
refine ⟨fun H => ?_, fun H _ => ?_⟩
· refine Int.ediv_nonneg ?_ (Int.natCast_nonneg _)
rw [sub_nonneg]
push_neg at h
obtain hb|hb := Ne.lt_or_lt h'
· apply H
intro H'
exact (hb.trans H').false.elim
· obtain ha|ha := le_or_lt na 0
· apply le_trans <| mul_nonpos_of_nonpos_of_nonneg ha (Int.natCast_nonneg _)
exact mul_nonneg hb.le (Int.natCast_nonneg _)
· exact H (fun _ => ha)
· rw [← sub_nonneg]
contrapose! H
apply Int.ediv_neg' H
simp only [Int.natCast_pos, Nat.pos_iff_ne_zero]
exact Nat.gcd_ne_zero_right (Nat.mul_ne_zero hb ha)
protected lemma divInt_le_divInt {a b c d : ℤ} (b0 : 0 < b) (d0 : 0 < d) :
a /. b ≤ c /. d ↔ a * d ≤ c * b := by
rw [Rat.le_iff_sub_nonneg, ← sub_nonneg (α := ℤ)]
simp [sub_eq_add_neg, ne_of_gt b0, ne_of_gt d0, mul_pos d0 b0]
#align rat.le_def Rat.divInt_le_divInt
protected lemma le_total : a ≤ b ∨ b ≤ a := by
simpa only [← Rat.le_iff_sub_nonneg, neg_sub] using Rat.nonneg_total (b - a)
#align rat.le_total Rat.le_total
protected theorem not_le {a b : ℚ} : ¬a ≤ b ↔ b < a := (Bool.not_eq_false _).to_iff
instance linearOrder : LinearOrder ℚ where
le_refl a := by rw [Rat.le_iff_sub_nonneg, ← num_nonneg]; simp
le_trans a b c hab hbc := by
rw [Rat.le_iff_sub_nonneg] at hab hbc
have := Rat.add_nonneg hab hbc
simp_rw [sub_eq_add_neg, add_left_comm (b + -a) c (-b), add_comm (b + -a) (-b),
add_left_comm (-b) b (-a), add_comm (-b) (-a), add_neg_cancel_comm_assoc,
← sub_eq_add_neg] at this
rwa [Rat.le_iff_sub_nonneg]
le_antisymm a b hab hba := by
rw [Rat.le_iff_sub_nonneg] at hab hba
rw [sub_eq_add_neg] at hba
rw [← neg_sub, sub_eq_add_neg] at hab
have := eq_neg_of_add_eq_zero_left (Rat.nonneg_antisymm hba hab)
rwa [neg_neg] at this
le_total _ _ := Rat.le_total
decidableEq := inferInstance
decidableLE := inferInstance
decidableLT := inferInstance
lt_iff_le_not_le _ _ := by rw [← Rat.not_le, and_iff_right_of_imp Rat.le_total.resolve_left]
#align rat.le_refl le_refl
#align rat.le_antisymm le_antisymm
#align rat.le_trans le_trans
instance instDistribLattice : DistribLattice ℚ := inferInstance
instance instLattice : Lattice ℚ := inferInstance
instance instSemilatticeInf : SemilatticeInf ℚ := inferInstance
instance instSemilatticeSup : SemilatticeSup ℚ := inferInstance
instance instInf : Inf ℚ := inferInstance
instance instSup : Sup ℚ := inferInstance
instance instPartialOrder : PartialOrder ℚ := inferInstance
instance instPreorder : Preorder ℚ := inferInstance
protected lemma le_def : p ≤ q ↔ p.num * q.den ≤ q.num * p.den := by
rw [← num_divInt_den q, ← num_divInt_den p]
conv_rhs => simp only [num_divInt_den]
exact Rat.divInt_le_divInt (mod_cast p.pos) (mod_cast q.pos)
#align rat.le_def' Rat.le_def
protected lemma lt_def : p < q ↔ p.num * q.den < q.num * p.den := by
rw [lt_iff_le_and_ne, Rat.le_def]
suffices p ≠ q ↔ p.num * q.den ≠ q.num * p.den by
constructor <;> intro h
· exact lt_iff_le_and_ne.mpr ⟨h.left, this.mp h.right⟩
· have tmp := lt_iff_le_and_ne.mp h
exact ⟨tmp.left, this.mpr tmp.right⟩
exact not_iff_not.mpr eq_iff_mul_eq_mul
#align rat.lt_def Rat.lt_def
#noalign rat.nonneg_iff_zero_le
protected theorem add_le_add_left {a b c : ℚ} : c + a ≤ c + b ↔ a ≤ b := by
rw [Rat.le_iff_sub_nonneg, add_sub_add_left_eq_sub, ← Rat.le_iff_sub_nonneg]
#align rat.add_le_add_left Rat.add_le_add_left
instance instLinearOrderedCommRing : LinearOrderedCommRing ℚ where
__ := Rat.linearOrder
__ := Rat.commRing
zero_le_one := by decide
add_le_add_left := fun a b ab c => Rat.add_le_add_left.2 ab
mul_pos a b ha hb := (Rat.mul_nonneg ha.le hb.le).lt_of_ne' (mul_ne_zero ha.ne' hb.ne')
-- Extra instances to short-circuit type class resolution
instance : LinearOrderedRing ℚ := by infer_instance
instance : OrderedRing ℚ := by infer_instance
instance : LinearOrderedSemiring ℚ := by infer_instance
instance : OrderedSemiring ℚ := by infer_instance
instance : LinearOrderedAddCommGroup ℚ := by infer_instance
instance : OrderedAddCommGroup ℚ := by infer_instance
instance : OrderedCancelAddCommMonoid ℚ := by infer_instance
instance : OrderedAddCommMonoid ℚ := by infer_instance
@[simp] lemma num_nonpos {a : ℚ} : a.num ≤ 0 ↔ a ≤ 0 := by simpa using @num_nonneg (-a)
@[simp] lemma num_pos {a : ℚ} : 0 < a.num ↔ 0 < a := lt_iff_lt_of_le_iff_le num_nonpos
#align rat.num_pos_iff_pos Rat.num_pos
@[simp] lemma num_neg {a : ℚ} : a.num < 0 ↔ a < 0 := lt_iff_lt_of_le_iff_le num_nonneg
@[deprecated (since := "2024-02-16")] alias num_nonneg_iff_zero_le := num_nonneg
@[deprecated (since := "2024-02-16")] alias num_pos_iff_pos := num_pos
| Mathlib/Algebra/Order/Ring/Rat.lean | 240 | 246 | theorem div_lt_div_iff_mul_lt_mul {a b c d : ℤ} (b_pos : 0 < b) (d_pos : 0 < d) :
(a : ℚ) / b < c / d ↔ a * d < c * b := by |
simp only [lt_iff_le_not_le]
apply and_congr
· simp [div_def', Rat.divInt_le_divInt b_pos d_pos]
· apply not_congr
simp [div_def', Rat.divInt_le_divInt d_pos b_pos]
|
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 α}
theorem IsBigOWith.isBigO (h : IsBigOWith c l f g) : f =O[l] g := by rw [IsBigO_def]; exact ⟨c, h⟩
#align asymptotics.is_O_with.is_O Asymptotics.IsBigOWith.isBigO
theorem IsLittleO.isBigOWith (hgf : f =o[l] g) : IsBigOWith 1 l f g :=
hgf.def' zero_lt_one
#align asymptotics.is_o.is_O_with Asymptotics.IsLittleO.isBigOWith
theorem IsLittleO.isBigO (hgf : f =o[l] g) : f =O[l] g :=
hgf.isBigOWith.isBigO
#align asymptotics.is_o.is_O Asymptotics.IsLittleO.isBigO
theorem IsBigO.isBigOWith : f =O[l] g → ∃ c : ℝ, IsBigOWith c l f g :=
isBigO_iff_isBigOWith.1
#align asymptotics.is_O.is_O_with Asymptotics.IsBigO.isBigOWith
theorem IsBigOWith.weaken (h : IsBigOWith c l f g') (hc : c ≤ c') : IsBigOWith c' l f g' :=
IsBigOWith.of_bound <|
mem_of_superset h.bound fun x hx =>
calc
‖f x‖ ≤ c * ‖g' x‖ := hx
_ ≤ _ := by gcongr
#align asymptotics.is_O_with.weaken Asymptotics.IsBigOWith.weaken
theorem IsBigOWith.exists_pos (h : IsBigOWith c l f g') :
∃ c' > 0, IsBigOWith c' l f g' :=
⟨max c 1, lt_of_lt_of_le zero_lt_one (le_max_right c 1), h.weaken <| le_max_left c 1⟩
#align asymptotics.is_O_with.exists_pos Asymptotics.IsBigOWith.exists_pos
theorem IsBigO.exists_pos (h : f =O[l] g') : ∃ c > 0, IsBigOWith c l f g' :=
let ⟨_c, hc⟩ := h.isBigOWith
hc.exists_pos
#align asymptotics.is_O.exists_pos Asymptotics.IsBigO.exists_pos
theorem IsBigOWith.exists_nonneg (h : IsBigOWith c l f g') :
∃ c' ≥ 0, IsBigOWith c' l f g' :=
let ⟨c, cpos, hc⟩ := h.exists_pos
⟨c, le_of_lt cpos, hc⟩
#align asymptotics.is_O_with.exists_nonneg Asymptotics.IsBigOWith.exists_nonneg
theorem IsBigO.exists_nonneg (h : f =O[l] g') : ∃ c ≥ 0, IsBigOWith c l f g' :=
let ⟨_c, hc⟩ := h.isBigOWith
hc.exists_nonneg
#align asymptotics.is_O.exists_nonneg Asymptotics.IsBigO.exists_nonneg
theorem isBigO_iff_eventually_isBigOWith : f =O[l] g' ↔ ∀ᶠ c in atTop, IsBigOWith c l f g' :=
isBigO_iff_isBigOWith.trans
⟨fun ⟨c, hc⟩ => mem_atTop_sets.2 ⟨c, fun _c' hc' => hc.weaken hc'⟩, fun h => h.exists⟩
#align asymptotics.is_O_iff_eventually_is_O_with Asymptotics.isBigO_iff_eventually_isBigOWith
theorem isBigO_iff_eventually : f =O[l] g' ↔ ∀ᶠ c in atTop, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g' x‖ :=
isBigO_iff_eventually_isBigOWith.trans <| by simp only [IsBigOWith_def]
#align asymptotics.is_O_iff_eventually Asymptotics.isBigO_iff_eventually
theorem IsBigO.exists_mem_basis {ι} {p : ι → Prop} {s : ι → Set α} (h : f =O[l] g')
(hb : l.HasBasis p s) :
∃ c > 0, ∃ i : ι, p i ∧ ∀ x ∈ s i, ‖f x‖ ≤ c * ‖g' x‖ :=
flip Exists.imp h.exists_pos fun c h => by
simpa only [isBigOWith_iff, hb.eventually_iff, exists_prop] using h
#align asymptotics.is_O.exists_mem_basis Asymptotics.IsBigO.exists_mem_basis
theorem isBigOWith_inv (hc : 0 < c) : IsBigOWith c⁻¹ l f g ↔ ∀ᶠ x in l, c * ‖f x‖ ≤ ‖g x‖ := by
simp only [IsBigOWith_def, ← div_eq_inv_mul, le_div_iff' hc]
#align asymptotics.is_O_with_inv Asymptotics.isBigOWith_inv
-- We prove this lemma with strange assumptions to get two lemmas below automatically
theorem isLittleO_iff_nat_mul_le_aux (h₀ : (∀ x, 0 ≤ ‖f x‖) ∨ ∀ x, 0 ≤ ‖g x‖) :
f =o[l] g ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f x‖ ≤ ‖g x‖ := by
constructor
· rintro H (_ | n)
· refine (H.def one_pos).mono fun x h₀' => ?_
rw [Nat.cast_zero, zero_mul]
refine h₀.elim (fun hf => (hf x).trans ?_) fun hg => hg x
rwa [one_mul] at h₀'
· have : (0 : ℝ) < n.succ := Nat.cast_pos.2 n.succ_pos
exact (isBigOWith_inv this).1 (H.def' <| inv_pos.2 this)
· refine fun H => isLittleO_iff.2 fun ε ε0 => ?_
rcases exists_nat_gt ε⁻¹ with ⟨n, hn⟩
have hn₀ : (0 : ℝ) < n := (inv_pos.2 ε0).trans hn
refine ((isBigOWith_inv hn₀).2 (H n)).bound.mono fun x hfg => ?_
refine hfg.trans (mul_le_mul_of_nonneg_right (inv_le_of_inv_le ε0 hn.le) ?_)
refine h₀.elim (fun hf => nonneg_of_mul_nonneg_right ((hf x).trans hfg) ?_) fun h => h x
exact inv_pos.2 hn₀
#align asymptotics.is_o_iff_nat_mul_le_aux Asymptotics.isLittleO_iff_nat_mul_le_aux
theorem isLittleO_iff_nat_mul_le : f =o[l] g' ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f x‖ ≤ ‖g' x‖ :=
isLittleO_iff_nat_mul_le_aux (Or.inr fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le Asymptotics.isLittleO_iff_nat_mul_le
theorem isLittleO_iff_nat_mul_le' : f' =o[l] g ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f' x‖ ≤ ‖g x‖ :=
isLittleO_iff_nat_mul_le_aux (Or.inl fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le' Asymptotics.isLittleO_iff_nat_mul_le'
@[nontriviality]
theorem isLittleO_of_subsingleton [Subsingleton E'] : f' =o[l] g' :=
IsLittleO.of_bound fun c hc => by simp [Subsingleton.elim (f' _) 0, mul_nonneg hc.le]
#align asymptotics.is_o_of_subsingleton Asymptotics.isLittleO_of_subsingleton
@[nontriviality]
theorem isBigO_of_subsingleton [Subsingleton E'] : f' =O[l] g' :=
isLittleO_of_subsingleton.isBigO
#align asymptotics.is_O_of_subsingleton Asymptotics.isBigO_of_subsingleton
theorem IsBigOWith.comp_tendsto (hcfg : IsBigOWith c l f g) {k : β → α} {l' : Filter β}
(hk : Tendsto k l' l) : IsBigOWith c l' (f ∘ k) (g ∘ k) :=
IsBigOWith.of_bound <| hk hcfg.bound
#align asymptotics.is_O_with.comp_tendsto Asymptotics.IsBigOWith.comp_tendsto
theorem IsBigO.comp_tendsto (hfg : f =O[l] g) {k : β → α} {l' : Filter β} (hk : Tendsto k l' l) :
(f ∘ k) =O[l'] (g ∘ k) :=
isBigO_iff_isBigOWith.2 <| hfg.isBigOWith.imp fun _c h => h.comp_tendsto hk
#align asymptotics.is_O.comp_tendsto Asymptotics.IsBigO.comp_tendsto
theorem IsLittleO.comp_tendsto (hfg : f =o[l] g) {k : β → α} {l' : Filter β} (hk : Tendsto k l' l) :
(f ∘ k) =o[l'] (g ∘ k) :=
IsLittleO.of_isBigOWith fun _c cpos => (hfg.forall_isBigOWith cpos).comp_tendsto hk
#align asymptotics.is_o.comp_tendsto Asymptotics.IsLittleO.comp_tendsto
@[simp]
theorem isBigOWith_map {k : β → α} {l : Filter β} :
IsBigOWith c (map k l) f g ↔ IsBigOWith c l (f ∘ k) (g ∘ k) := by
simp only [IsBigOWith_def]
exact eventually_map
#align asymptotics.is_O_with_map Asymptotics.isBigOWith_map
@[simp]
theorem isBigO_map {k : β → α} {l : Filter β} : f =O[map k l] g ↔ (f ∘ k) =O[l] (g ∘ k) := by
simp only [IsBigO_def, isBigOWith_map]
#align asymptotics.is_O_map Asymptotics.isBigO_map
@[simp]
theorem isLittleO_map {k : β → α} {l : Filter β} : f =o[map k l] g ↔ (f ∘ k) =o[l] (g ∘ k) := by
simp only [IsLittleO_def, isBigOWith_map]
#align asymptotics.is_o_map Asymptotics.isLittleO_map
theorem IsBigOWith.mono (h : IsBigOWith c l' f g) (hl : l ≤ l') : IsBigOWith c l f g :=
IsBigOWith.of_bound <| hl h.bound
#align asymptotics.is_O_with.mono Asymptotics.IsBigOWith.mono
theorem IsBigO.mono (h : f =O[l'] g) (hl : l ≤ l') : f =O[l] g :=
isBigO_iff_isBigOWith.2 <| h.isBigOWith.imp fun _c h => h.mono hl
#align asymptotics.is_O.mono Asymptotics.IsBigO.mono
theorem IsLittleO.mono (h : f =o[l'] g) (hl : l ≤ l') : f =o[l] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).mono hl
#align asymptotics.is_o.mono Asymptotics.IsLittleO.mono
theorem IsBigOWith.trans (hfg : IsBigOWith c l f g) (hgk : IsBigOWith c' l g k) (hc : 0 ≤ c) :
IsBigOWith (c * c') l f k := by
simp only [IsBigOWith_def] at *
filter_upwards [hfg, hgk] with x hx hx'
calc
‖f x‖ ≤ c * ‖g x‖ := hx
_ ≤ c * (c' * ‖k x‖) := by gcongr
_ = c * c' * ‖k x‖ := (mul_assoc _ _ _).symm
#align asymptotics.is_O_with.trans Asymptotics.IsBigOWith.trans
@[trans]
theorem IsBigO.trans {f : α → E} {g : α → F'} {k : α → G} (hfg : f =O[l] g) (hgk : g =O[l] k) :
f =O[l] k :=
let ⟨_c, cnonneg, hc⟩ := hfg.exists_nonneg
let ⟨_c', hc'⟩ := hgk.isBigOWith
(hc.trans hc' cnonneg).isBigO
#align asymptotics.is_O.trans Asymptotics.IsBigO.trans
instance transIsBigOIsBigO :
@Trans (α → E) (α → F') (α → G) (· =O[l] ·) (· =O[l] ·) (· =O[l] ·) where
trans := IsBigO.trans
theorem IsLittleO.trans_isBigOWith (hfg : f =o[l] g) (hgk : IsBigOWith c l g k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact ((hfg this).trans hgk this.le).congr_const (div_mul_cancel₀ _ hc.ne')
#align asymptotics.is_o.trans_is_O_with Asymptotics.IsLittleO.trans_isBigOWith
@[trans]
theorem IsLittleO.trans_isBigO {f : α → E} {g : α → F} {k : α → G'} (hfg : f =o[l] g)
(hgk : g =O[l] k) : f =o[l] k :=
let ⟨_c, cpos, hc⟩ := hgk.exists_pos
hfg.trans_isBigOWith hc cpos
#align asymptotics.is_o.trans_is_O Asymptotics.IsLittleO.trans_isBigO
instance transIsLittleOIsBigO :
@Trans (α → E) (α → F) (α → G') (· =o[l] ·) (· =O[l] ·) (· =o[l] ·) where
trans := IsLittleO.trans_isBigO
theorem IsBigOWith.trans_isLittleO (hfg : IsBigOWith c l f g) (hgk : g =o[l] k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact (hfg.trans (hgk this) hc.le).congr_const (mul_div_cancel₀ _ hc.ne')
#align asymptotics.is_O_with.trans_is_o Asymptotics.IsBigOWith.trans_isLittleO
@[trans]
theorem IsBigO.trans_isLittleO {f : α → E} {g : α → F'} {k : α → G} (hfg : f =O[l] g)
(hgk : g =o[l] k) : f =o[l] k :=
let ⟨_c, cpos, hc⟩ := hfg.exists_pos
hc.trans_isLittleO hgk cpos
#align asymptotics.is_O.trans_is_o Asymptotics.IsBigO.trans_isLittleO
instance transIsBigOIsLittleO :
@Trans (α → E) (α → F') (α → G) (· =O[l] ·) (· =o[l] ·) (· =o[l] ·) where
trans := IsBigO.trans_isLittleO
@[trans]
theorem IsLittleO.trans {f : α → E} {g : α → F} {k : α → G} (hfg : f =o[l] g) (hgk : g =o[l] k) :
f =o[l] k :=
hfg.trans_isBigOWith hgk.isBigOWith one_pos
#align asymptotics.is_o.trans Asymptotics.IsLittleO.trans
instance transIsLittleOIsLittleO :
@Trans (α → E) (α → F) (α → G) (· =o[l] ·) (· =o[l] ·) (· =o[l] ·) where
trans := IsLittleO.trans
theorem _root_.Filter.Eventually.trans_isBigO {f : α → E} {g : α → F'} {k : α → G}
(hfg : ∀ᶠ x in l, ‖f x‖ ≤ ‖g x‖) (hgk : g =O[l] k) : f =O[l] k :=
(IsBigO.of_bound' hfg).trans hgk
#align filter.eventually.trans_is_O Filter.Eventually.trans_isBigO
theorem _root_.Filter.Eventually.isBigO {f : α → E} {g : α → ℝ} {l : Filter α}
(hfg : ∀ᶠ x in l, ‖f x‖ ≤ g x) : f =O[l] g :=
IsBigO.of_bound' <| hfg.mono fun _x hx => hx.trans <| Real.le_norm_self _
#align filter.eventually.is_O Filter.Eventually.isBigO
section
variable (l)
theorem isBigOWith_of_le' (hfg : ∀ x, ‖f x‖ ≤ c * ‖g x‖) : IsBigOWith c l f g :=
IsBigOWith.of_bound <| univ_mem' hfg
#align asymptotics.is_O_with_of_le' Asymptotics.isBigOWith_of_le'
theorem isBigOWith_of_le (hfg : ∀ x, ‖f x‖ ≤ ‖g x‖) : IsBigOWith 1 l f g :=
isBigOWith_of_le' l fun x => by
rw [one_mul]
exact hfg x
#align asymptotics.is_O_with_of_le Asymptotics.isBigOWith_of_le
theorem isBigO_of_le' (hfg : ∀ x, ‖f x‖ ≤ c * ‖g x‖) : f =O[l] g :=
(isBigOWith_of_le' l hfg).isBigO
#align asymptotics.is_O_of_le' Asymptotics.isBigO_of_le'
theorem isBigO_of_le (hfg : ∀ x, ‖f x‖ ≤ ‖g x‖) : f =O[l] g :=
(isBigOWith_of_le l hfg).isBigO
#align asymptotics.is_O_of_le Asymptotics.isBigO_of_le
end
theorem isBigOWith_refl (f : α → E) (l : Filter α) : IsBigOWith 1 l f f :=
isBigOWith_of_le l fun _ => le_rfl
#align asymptotics.is_O_with_refl Asymptotics.isBigOWith_refl
theorem isBigO_refl (f : α → E) (l : Filter α) : f =O[l] f :=
(isBigOWith_refl f l).isBigO
#align asymptotics.is_O_refl Asymptotics.isBigO_refl
theorem _root_.Filter.EventuallyEq.isBigO {f₁ f₂ : α → E} (hf : f₁ =ᶠ[l] f₂) : f₁ =O[l] f₂ :=
hf.trans_isBigO (isBigO_refl _ _)
theorem IsBigOWith.trans_le (hfg : IsBigOWith c l f g) (hgk : ∀ x, ‖g x‖ ≤ ‖k x‖) (hc : 0 ≤ c) :
IsBigOWith c l f k :=
(hfg.trans (isBigOWith_of_le l hgk) hc).congr_const <| mul_one c
#align asymptotics.is_O_with.trans_le Asymptotics.IsBigOWith.trans_le
theorem IsBigO.trans_le (hfg : f =O[l] g') (hgk : ∀ x, ‖g' x‖ ≤ ‖k x‖) : f =O[l] k :=
hfg.trans (isBigO_of_le l hgk)
#align asymptotics.is_O.trans_le Asymptotics.IsBigO.trans_le
theorem IsLittleO.trans_le (hfg : f =o[l] g) (hgk : ∀ x, ‖g x‖ ≤ ‖k x‖) : f =o[l] k :=
hfg.trans_isBigOWith (isBigOWith_of_le _ hgk) zero_lt_one
#align asymptotics.is_o.trans_le Asymptotics.IsLittleO.trans_le
theorem isLittleO_irrefl' (h : ∃ᶠ x in l, ‖f' x‖ ≠ 0) : ¬f' =o[l] f' := by
intro ho
rcases ((ho.bound one_half_pos).and_frequently h).exists with ⟨x, hle, hne⟩
rw [one_div, ← div_eq_inv_mul] at hle
exact (half_lt_self (lt_of_le_of_ne (norm_nonneg _) hne.symm)).not_le hle
#align asymptotics.is_o_irrefl' Asymptotics.isLittleO_irrefl'
theorem isLittleO_irrefl (h : ∃ᶠ x in l, f'' x ≠ 0) : ¬f'' =o[l] f'' :=
isLittleO_irrefl' <| h.mono fun _x => norm_ne_zero_iff.mpr
#align asymptotics.is_o_irrefl Asymptotics.isLittleO_irrefl
theorem IsBigO.not_isLittleO (h : f'' =O[l] g') (hf : ∃ᶠ x in l, f'' x ≠ 0) :
¬g' =o[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isLittleO h')
#align asymptotics.is_O.not_is_o Asymptotics.IsBigO.not_isLittleO
theorem IsLittleO.not_isBigO (h : f'' =o[l] g') (hf : ∃ᶠ x in l, f'' x ≠ 0) :
¬g' =O[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isBigO h')
#align asymptotics.is_o.not_is_O Asymptotics.IsLittleO.not_isBigO
@[simp]
theorem isBigOWith_pure {x} : IsBigOWith c (pure x) f g ↔ ‖f x‖ ≤ c * ‖g x‖ :=
isBigOWith_iff
#align asymptotics.is_O_with_pure Asymptotics.isBigOWith_pure
theorem IsBigOWith.sup (h : IsBigOWith c l f g) (h' : IsBigOWith c l' f g) :
IsBigOWith c (l ⊔ l') f g :=
IsBigOWith.of_bound <| mem_sup.2 ⟨h.bound, h'.bound⟩
#align asymptotics.is_O_with.sup Asymptotics.IsBigOWith.sup
theorem IsBigOWith.sup' (h : IsBigOWith c l f g') (h' : IsBigOWith c' l' f g') :
IsBigOWith (max c c') (l ⊔ l') f g' :=
IsBigOWith.of_bound <|
mem_sup.2 ⟨(h.weaken <| le_max_left c c').bound, (h'.weaken <| le_max_right c c').bound⟩
#align asymptotics.is_O_with.sup' Asymptotics.IsBigOWith.sup'
theorem IsBigO.sup (h : f =O[l] g') (h' : f =O[l'] g') : f =O[l ⊔ l'] g' :=
let ⟨_c, hc⟩ := h.isBigOWith
let ⟨_c', hc'⟩ := h'.isBigOWith
(hc.sup' hc').isBigO
#align asymptotics.is_O.sup Asymptotics.IsBigO.sup
theorem IsLittleO.sup (h : f =o[l] g) (h' : f =o[l'] g) : f =o[l ⊔ l'] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).sup (h'.forall_isBigOWith cpos)
#align asymptotics.is_o.sup Asymptotics.IsLittleO.sup
@[simp]
theorem isBigO_sup : f =O[l ⊔ l'] g' ↔ f =O[l] g' ∧ f =O[l'] g' :=
⟨fun h => ⟨h.mono le_sup_left, h.mono le_sup_right⟩, fun h => h.1.sup h.2⟩
#align asymptotics.is_O_sup Asymptotics.isBigO_sup
@[simp]
theorem isLittleO_sup : f =o[l ⊔ l'] g ↔ f =o[l] g ∧ f =o[l'] g :=
⟨fun h => ⟨h.mono le_sup_left, h.mono le_sup_right⟩, fun h => h.1.sup h.2⟩
#align asymptotics.is_o_sup Asymptotics.isLittleO_sup
theorem isBigOWith_insert [TopologicalSpace α] {x : α} {s : Set α} {C : ℝ} {g : α → E} {g' : α → F}
(h : ‖g x‖ ≤ C * ‖g' x‖) : IsBigOWith C (𝓝[insert x s] x) g g' ↔
IsBigOWith C (𝓝[s] x) g g' := by
simp_rw [IsBigOWith_def, nhdsWithin_insert, eventually_sup, eventually_pure, h, true_and_iff]
#align asymptotics.is_O_with_insert Asymptotics.isBigOWith_insert
protected theorem IsBigOWith.insert [TopologicalSpace α] {x : α} {s : Set α} {C : ℝ} {g : α → E}
{g' : α → F} (h1 : IsBigOWith C (𝓝[s] x) g g') (h2 : ‖g x‖ ≤ C * ‖g' x‖) :
IsBigOWith C (𝓝[insert x s] x) g g' :=
(isBigOWith_insert h2).mpr h1
#align asymptotics.is_O_with.insert Asymptotics.IsBigOWith.insert
theorem isLittleO_insert [TopologicalSpace α] {x : α} {s : Set α} {g : α → E'} {g' : α → F'}
(h : g x = 0) : g =o[𝓝[insert x s] x] g' ↔ g =o[𝓝[s] x] g' := by
simp_rw [IsLittleO_def]
refine forall_congr' fun c => forall_congr' fun hc => ?_
rw [isBigOWith_insert]
rw [h, norm_zero]
exact mul_nonneg hc.le (norm_nonneg _)
#align asymptotics.is_o_insert Asymptotics.isLittleO_insert
protected theorem IsLittleO.insert [TopologicalSpace α] {x : α} {s : Set α} {g : α → E'}
{g' : α → F'} (h1 : g =o[𝓝[s] x] g') (h2 : g x = 0) : g =o[𝓝[insert x s] x] g' :=
(isLittleO_insert h2).mpr h1
#align asymptotics.is_o.insert Asymptotics.IsLittleO.insert
@[simp]
theorem isBigOWith_neg_right : (IsBigOWith c l f fun x => -g' x) ↔ IsBigOWith c l f g' := by
simp only [IsBigOWith_def, norm_neg]
#align asymptotics.is_O_with_neg_right Asymptotics.isBigOWith_neg_right
alias ⟨IsBigOWith.of_neg_right, IsBigOWith.neg_right⟩ := isBigOWith_neg_right
#align asymptotics.is_O_with.of_neg_right Asymptotics.IsBigOWith.of_neg_right
#align asymptotics.is_O_with.neg_right Asymptotics.IsBigOWith.neg_right
@[simp]
theorem isBigO_neg_right : (f =O[l] fun x => -g' x) ↔ f =O[l] g' := by
simp only [IsBigO_def]
exact exists_congr fun _ => isBigOWith_neg_right
#align asymptotics.is_O_neg_right Asymptotics.isBigO_neg_right
alias ⟨IsBigO.of_neg_right, IsBigO.neg_right⟩ := isBigO_neg_right
#align asymptotics.is_O.of_neg_right Asymptotics.IsBigO.of_neg_right
#align asymptotics.is_O.neg_right Asymptotics.IsBigO.neg_right
@[simp]
theorem isLittleO_neg_right : (f =o[l] fun x => -g' x) ↔ f =o[l] g' := by
simp only [IsLittleO_def]
exact forall₂_congr fun _ _ => isBigOWith_neg_right
#align asymptotics.is_o_neg_right Asymptotics.isLittleO_neg_right
alias ⟨IsLittleO.of_neg_right, IsLittleO.neg_right⟩ := isLittleO_neg_right
#align asymptotics.is_o.of_neg_right Asymptotics.IsLittleO.of_neg_right
#align asymptotics.is_o.neg_right Asymptotics.IsLittleO.neg_right
@[simp]
theorem isBigOWith_neg_left : IsBigOWith c l (fun x => -f' x) g ↔ IsBigOWith c l f' g := by
simp only [IsBigOWith_def, norm_neg]
#align asymptotics.is_O_with_neg_left Asymptotics.isBigOWith_neg_left
alias ⟨IsBigOWith.of_neg_left, IsBigOWith.neg_left⟩ := isBigOWith_neg_left
#align asymptotics.is_O_with.of_neg_left Asymptotics.IsBigOWith.of_neg_left
#align asymptotics.is_O_with.neg_left Asymptotics.IsBigOWith.neg_left
@[simp]
theorem isBigO_neg_left : (fun x => -f' x) =O[l] g ↔ f' =O[l] g := by
simp only [IsBigO_def]
exact exists_congr fun _ => isBigOWith_neg_left
#align asymptotics.is_O_neg_left Asymptotics.isBigO_neg_left
alias ⟨IsBigO.of_neg_left, IsBigO.neg_left⟩ := isBigO_neg_left
#align asymptotics.is_O.of_neg_left Asymptotics.IsBigO.of_neg_left
#align asymptotics.is_O.neg_left Asymptotics.IsBigO.neg_left
@[simp]
theorem isLittleO_neg_left : (fun x => -f' x) =o[l] g ↔ f' =o[l] g := by
simp only [IsLittleO_def]
exact forall₂_congr fun _ _ => isBigOWith_neg_left
#align asymptotics.is_o_neg_left Asymptotics.isLittleO_neg_left
alias ⟨IsLittleO.of_neg_left, IsLittleO.neg_left⟩ := isLittleO_neg_left
#align asymptotics.is_o.of_neg_left Asymptotics.IsLittleO.of_neg_left
#align asymptotics.is_o.neg_left Asymptotics.IsLittleO.neg_left
theorem isBigOWith_fst_prod : IsBigOWith 1 l f' fun x => (f' x, g' x) :=
isBigOWith_of_le l fun _x => le_max_left _ _
#align asymptotics.is_O_with_fst_prod Asymptotics.isBigOWith_fst_prod
theorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' x) :=
isBigOWith_of_le l fun _x => le_max_right _ _
#align asymptotics.is_O_with_snd_prod Asymptotics.isBigOWith_snd_prod
theorem isBigO_fst_prod : f' =O[l] fun x => (f' x, g' x) :=
isBigOWith_fst_prod.isBigO
#align asymptotics.is_O_fst_prod Asymptotics.isBigO_fst_prod
theorem isBigO_snd_prod : g' =O[l] fun x => (f' x, g' x) :=
isBigOWith_snd_prod.isBigO
#align asymptotics.is_O_snd_prod Asymptotics.isBigO_snd_prod
theorem isBigO_fst_prod' {f' : α → E' × F'} : (fun x => (f' x).1) =O[l] f' := by
simpa [IsBigO_def, IsBigOWith_def] using isBigO_fst_prod (E' := E') (F' := F')
#align asymptotics.is_O_fst_prod' Asymptotics.isBigO_fst_prod'
theorem isBigO_snd_prod' {f' : α → E' × F'} : (fun x => (f' x).2) =O[l] f' := by
simpa [IsBigO_def, IsBigOWith_def] using isBigO_snd_prod (E' := E') (F' := F')
#align asymptotics.is_O_snd_prod' Asymptotics.isBigO_snd_prod'
section
variable (f' k')
theorem IsBigOWith.prod_rightl (h : IsBigOWith c l f g') (hc : 0 ≤ c) :
IsBigOWith c l f fun x => (g' x, k' x) :=
(h.trans isBigOWith_fst_prod hc).congr_const (mul_one c)
#align asymptotics.is_O_with.prod_rightl Asymptotics.IsBigOWith.prod_rightl
theorem IsBigO.prod_rightl (h : f =O[l] g') : f =O[l] fun x => (g' x, k' x) :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.prod_rightl k' cnonneg).isBigO
#align asymptotics.is_O.prod_rightl Asymptotics.IsBigO.prod_rightl
theorem IsLittleO.prod_rightl (h : f =o[l] g') : f =o[l] fun x => (g' x, k' x) :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).prod_rightl k' cpos.le
#align asymptotics.is_o.prod_rightl Asymptotics.IsLittleO.prod_rightl
theorem IsBigOWith.prod_rightr (h : IsBigOWith c l f g') (hc : 0 ≤ c) :
IsBigOWith c l f fun x => (f' x, g' x) :=
(h.trans isBigOWith_snd_prod hc).congr_const (mul_one c)
#align asymptotics.is_O_with.prod_rightr Asymptotics.IsBigOWith.prod_rightr
theorem IsBigO.prod_rightr (h : f =O[l] g') : f =O[l] fun x => (f' x, g' x) :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.prod_rightr f' cnonneg).isBigO
#align asymptotics.is_O.prod_rightr Asymptotics.IsBigO.prod_rightr
theorem IsLittleO.prod_rightr (h : f =o[l] g') : f =o[l] fun x => (f' x, g' x) :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).prod_rightr f' cpos.le
#align asymptotics.is_o.prod_rightr Asymptotics.IsLittleO.prod_rightr
end
theorem IsBigOWith.prod_left_same (hf : IsBigOWith c l f' k') (hg : IsBigOWith c l g' k') :
IsBigOWith c l (fun x => (f' x, g' x)) k' := by
rw [isBigOWith_iff] at *; filter_upwards [hf, hg] with x using max_le
#align asymptotics.is_O_with.prod_left_same Asymptotics.IsBigOWith.prod_left_same
theorem IsBigOWith.prod_left (hf : IsBigOWith c l f' k') (hg : IsBigOWith c' l g' k') :
IsBigOWith (max c c') l (fun x => (f' x, g' x)) k' :=
(hf.weaken <| le_max_left c c').prod_left_same (hg.weaken <| le_max_right c c')
#align asymptotics.is_O_with.prod_left Asymptotics.IsBigOWith.prod_left
theorem IsBigOWith.prod_left_fst (h : IsBigOWith c l (fun x => (f' x, g' x)) k') :
IsBigOWith c l f' k' :=
(isBigOWith_fst_prod.trans h zero_le_one).congr_const <| one_mul c
#align asymptotics.is_O_with.prod_left_fst Asymptotics.IsBigOWith.prod_left_fst
theorem IsBigOWith.prod_left_snd (h : IsBigOWith c l (fun x => (f' x, g' x)) k') :
IsBigOWith c l g' k' :=
(isBigOWith_snd_prod.trans h zero_le_one).congr_const <| one_mul c
#align asymptotics.is_O_with.prod_left_snd Asymptotics.IsBigOWith.prod_left_snd
theorem isBigOWith_prod_left :
IsBigOWith c l (fun x => (f' x, g' x)) k' ↔ IsBigOWith c l f' k' ∧ IsBigOWith c l g' k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left_same h.2⟩
#align asymptotics.is_O_with_prod_left Asymptotics.isBigOWith_prod_left
theorem IsBigO.prod_left (hf : f' =O[l] k') (hg : g' =O[l] k') : (fun x => (f' x, g' x)) =O[l] k' :=
let ⟨_c, hf⟩ := hf.isBigOWith
let ⟨_c', hg⟩ := hg.isBigOWith
(hf.prod_left hg).isBigO
#align asymptotics.is_O.prod_left Asymptotics.IsBigO.prod_left
theorem IsBigO.prod_left_fst : (fun x => (f' x, g' x)) =O[l] k' → f' =O[l] k' :=
IsBigO.trans isBigO_fst_prod
#align asymptotics.is_O.prod_left_fst Asymptotics.IsBigO.prod_left_fst
theorem IsBigO.prod_left_snd : (fun x => (f' x, g' x)) =O[l] k' → g' =O[l] k' :=
IsBigO.trans isBigO_snd_prod
#align asymptotics.is_O.prod_left_snd Asymptotics.IsBigO.prod_left_snd
@[simp]
theorem isBigO_prod_left : (fun x => (f' x, g' x)) =O[l] k' ↔ f' =O[l] k' ∧ g' =O[l] k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left h.2⟩
#align asymptotics.is_O_prod_left Asymptotics.isBigO_prod_left
theorem IsLittleO.prod_left (hf : f' =o[l] k') (hg : g' =o[l] k') :
(fun x => (f' x, g' x)) =o[l] k' :=
IsLittleO.of_isBigOWith fun _c hc =>
(hf.forall_isBigOWith hc).prod_left_same (hg.forall_isBigOWith hc)
#align asymptotics.is_o.prod_left Asymptotics.IsLittleO.prod_left
theorem IsLittleO.prod_left_fst : (fun x => (f' x, g' x)) =o[l] k' → f' =o[l] k' :=
IsBigO.trans_isLittleO isBigO_fst_prod
#align asymptotics.is_o.prod_left_fst Asymptotics.IsLittleO.prod_left_fst
theorem IsLittleO.prod_left_snd : (fun x => (f' x, g' x)) =o[l] k' → g' =o[l] k' :=
IsBigO.trans_isLittleO isBigO_snd_prod
#align asymptotics.is_o.prod_left_snd Asymptotics.IsLittleO.prod_left_snd
@[simp]
theorem isLittleO_prod_left : (fun x => (f' x, g' x)) =o[l] k' ↔ f' =o[l] k' ∧ g' =o[l] k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left h.2⟩
#align asymptotics.is_o_prod_left Asymptotics.isLittleO_prod_left
theorem IsBigOWith.eq_zero_imp (h : IsBigOWith c l f'' g'') : ∀ᶠ x in l, g'' x = 0 → f'' x = 0 :=
Eventually.mono h.bound fun x hx hg => norm_le_zero_iff.1 <| by simpa [hg] using hx
#align asymptotics.is_O_with.eq_zero_imp Asymptotics.IsBigOWith.eq_zero_imp
theorem IsBigO.eq_zero_imp (h : f'' =O[l] g'') : ∀ᶠ x in l, g'' x = 0 → f'' x = 0 :=
let ⟨_C, hC⟩ := h.isBigOWith
hC.eq_zero_imp
#align asymptotics.is_O.eq_zero_imp Asymptotics.IsBigO.eq_zero_imp
@[simp]
theorem isBigOWith_principal {s : Set α} : IsBigOWith c (𝓟 s) f g ↔ ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖ := by
rw [IsBigOWith_def, eventually_principal]
#align asymptotics.is_O_with_principal Asymptotics.isBigOWith_principal
theorem isBigO_principal {s : Set α} : f =O[𝓟 s] g ↔ ∃ c, ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖ := by
simp_rw [isBigO_iff, eventually_principal]
#align asymptotics.is_O_principal Asymptotics.isBigO_principal
@[simp]
theorem isLittleO_principal {s : Set α} : f'' =o[𝓟 s] g' ↔ ∀ x ∈ s, f'' x = 0 := by
refine ⟨fun h x hx ↦ norm_le_zero_iff.1 ?_, fun h ↦ ?_⟩
· simp only [isLittleO_iff, isBigOWith_principal] at h
have : Tendsto (fun c : ℝ => c * ‖g' x‖) (𝓝[>] 0) (𝓝 0) :=
((continuous_id.mul continuous_const).tendsto' _ _ (zero_mul _)).mono_left
inf_le_left
apply le_of_tendsto_of_tendsto tendsto_const_nhds this
apply eventually_nhdsWithin_iff.2 (eventually_of_forall (fun c hc ↦ ?_))
exact eventually_principal.1 (h hc) x hx
· apply (isLittleO_zero g' _).congr' ?_ EventuallyEq.rfl
exact fun x hx ↦ (h x hx).symm
@[simp]
theorem isBigOWith_top : IsBigOWith c ⊤ f g ↔ ∀ x, ‖f x‖ ≤ c * ‖g x‖ := by
rw [IsBigOWith_def, eventually_top]
#align asymptotics.is_O_with_top Asymptotics.isBigOWith_top
@[simp]
theorem isBigO_top : f =O[⊤] g ↔ ∃ C, ∀ x, ‖f x‖ ≤ C * ‖g x‖ := by
simp_rw [isBigO_iff, eventually_top]
#align asymptotics.is_O_top Asymptotics.isBigO_top
@[simp]
theorem isLittleO_top : f'' =o[⊤] g' ↔ ∀ x, f'' x = 0 := by
simp only [← principal_univ, isLittleO_principal, mem_univ, forall_true_left]
#align asymptotics.is_o_top Asymptotics.isLittleO_top
section
variable (F)
variable [One F] [NormOneClass F]
theorem isBigOWith_const_one (c : E) (l : Filter α) :
IsBigOWith ‖c‖ l (fun _x : α => c) fun _x => (1 : F) := by simp [isBigOWith_iff]
#align asymptotics.is_O_with_const_one Asymptotics.isBigOWith_const_one
theorem isBigO_const_one (c : E) (l : Filter α) : (fun _x : α => c) =O[l] fun _x => (1 : F) :=
(isBigOWith_const_one F c l).isBigO
#align asymptotics.is_O_const_one Asymptotics.isBigO_const_one
theorem isLittleO_const_iff_isLittleO_one {c : F''} (hc : c ≠ 0) :
(f =o[l] fun _x => c) ↔ f =o[l] fun _x => (1 : F) :=
⟨fun h => h.trans_isBigOWith (isBigOWith_const_one _ _ _) (norm_pos_iff.2 hc),
fun h => h.trans_isBigO <| isBigO_const_const _ hc _⟩
#align asymptotics.is_o_const_iff_is_o_one Asymptotics.isLittleO_const_iff_isLittleO_one
@[simp]
theorem isLittleO_one_iff : f' =o[l] (fun _x => 1 : α → F) ↔ Tendsto f' l (𝓝 0) := by
simp only [isLittleO_iff, norm_one, mul_one, Metric.nhds_basis_closedBall.tendsto_right_iff,
Metric.mem_closedBall, dist_zero_right]
#align asymptotics.is_o_one_iff Asymptotics.isLittleO_one_iff
@[simp]
theorem isBigO_one_iff : f =O[l] (fun _x => 1 : α → F) ↔
IsBoundedUnder (· ≤ ·) l fun x => ‖f x‖ := by
simp only [isBigO_iff, norm_one, mul_one, IsBoundedUnder, IsBounded, eventually_map]
#align asymptotics.is_O_one_iff Asymptotics.isBigO_one_iff
alias ⟨_, _root_.Filter.IsBoundedUnder.isBigO_one⟩ := isBigO_one_iff
#align filter.is_bounded_under.is_O_one Filter.IsBoundedUnder.isBigO_one
@[simp]
theorem isLittleO_one_left_iff : (fun _x => 1 : α → F) =o[l] f ↔ Tendsto (fun x => ‖f x‖) l atTop :=
calc
(fun _x => 1 : α → F) =o[l] f ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖(1 : F)‖ ≤ ‖f x‖ :=
isLittleO_iff_nat_mul_le_aux <| Or.inl fun _x => by simp only [norm_one, zero_le_one]
_ ↔ ∀ n : ℕ, True → ∀ᶠ x in l, ‖f x‖ ∈ Ici (n : ℝ) := by
simp only [norm_one, mul_one, true_imp_iff, mem_Ici]
_ ↔ Tendsto (fun x => ‖f x‖) l atTop :=
atTop_hasCountableBasis_of_archimedean.1.tendsto_right_iff.symm
#align asymptotics.is_o_one_left_iff Asymptotics.isLittleO_one_left_iff
theorem _root_.Filter.Tendsto.isBigO_one {c : E'} (h : Tendsto f' l (𝓝 c)) :
f' =O[l] (fun _x => 1 : α → F) :=
h.norm.isBoundedUnder_le.isBigO_one F
#align filter.tendsto.is_O_one Filter.Tendsto.isBigO_one
theorem IsBigO.trans_tendsto_nhds (hfg : f =O[l] g') {y : F'} (hg : Tendsto g' l (𝓝 y)) :
f =O[l] (fun _x => 1 : α → F) :=
hfg.trans <| hg.isBigO_one F
#align asymptotics.is_O.trans_tendsto_nhds Asymptotics.IsBigO.trans_tendsto_nhds
lemma isBigO_one_nhds_ne_iff [TopologicalSpace α] {a : α} :
f =O[𝓝[≠] a] (fun _ ↦ 1 : α → F) ↔ f =O[𝓝 a] (fun _ ↦ 1 : α → F) := by
refine ⟨fun h ↦ ?_, fun h ↦ h.mono nhdsWithin_le_nhds⟩
simp only [isBigO_one_iff, IsBoundedUnder, IsBounded, eventually_map] at h ⊢
obtain ⟨c, hc⟩ := h
use max c ‖f a‖
filter_upwards [eventually_nhdsWithin_iff.mp hc] with b hb
rcases eq_or_ne b a with rfl | hb'
· apply le_max_right
· exact (hb hb').trans (le_max_left ..)
end
theorem isLittleO_const_iff {c : F''} (hc : c ≠ 0) :
(f'' =o[l] fun _x => c) ↔ Tendsto f'' l (𝓝 0) :=
(isLittleO_const_iff_isLittleO_one ℝ hc).trans (isLittleO_one_iff _)
#align asymptotics.is_o_const_iff Asymptotics.isLittleO_const_iff
theorem isLittleO_id_const {c : F''} (hc : c ≠ 0) : (fun x : E'' => x) =o[𝓝 0] fun _x => c :=
(isLittleO_const_iff hc).mpr (continuous_id.tendsto 0)
#align asymptotics.is_o_id_const Asymptotics.isLittleO_id_const
theorem _root_.Filter.IsBoundedUnder.isBigO_const (h : IsBoundedUnder (· ≤ ·) l (norm ∘ f))
{c : F''} (hc : c ≠ 0) : f =O[l] fun _x => c :=
(h.isBigO_one ℝ).trans (isBigO_const_const _ hc _)
#align filter.is_bounded_under.is_O_const Filter.IsBoundedUnder.isBigO_const
theorem isBigO_const_of_tendsto {y : E''} (h : Tendsto f'' l (𝓝 y)) {c : F''} (hc : c ≠ 0) :
f'' =O[l] fun _x => c :=
h.norm.isBoundedUnder_le.isBigO_const hc
#align asymptotics.is_O_const_of_tendsto Asymptotics.isBigO_const_of_tendsto
theorem IsBigO.isBoundedUnder_le {c : F} (h : f =O[l] fun _x => c) :
IsBoundedUnder (· ≤ ·) l (norm ∘ f) :=
let ⟨c', hc'⟩ := h.bound
⟨c' * ‖c‖, eventually_map.2 hc'⟩
#align asymptotics.is_O.is_bounded_under_le Asymptotics.IsBigO.isBoundedUnder_le
theorem isBigO_const_of_ne {c : F''} (hc : c ≠ 0) :
(f =O[l] fun _x => c) ↔ IsBoundedUnder (· ≤ ·) l (norm ∘ f) :=
⟨fun h => h.isBoundedUnder_le, fun h => h.isBigO_const hc⟩
#align asymptotics.is_O_const_of_ne Asymptotics.isBigO_const_of_ne
theorem isBigO_const_iff {c : F''} : (f'' =O[l] fun _x => c) ↔
(c = 0 → f'' =ᶠ[l] 0) ∧ IsBoundedUnder (· ≤ ·) l fun x => ‖f'' x‖ := by
refine ⟨fun h => ⟨fun hc => isBigO_zero_right_iff.1 (by rwa [← hc]), h.isBoundedUnder_le⟩, ?_⟩
rintro ⟨hcf, hf⟩
rcases eq_or_ne c 0 with (hc | hc)
exacts [(hcf hc).trans_isBigO (isBigO_zero _ _), hf.isBigO_const hc]
#align asymptotics.is_O_const_iff Asymptotics.isBigO_const_iff
theorem isBigO_iff_isBoundedUnder_le_div (h : ∀ᶠ x in l, g'' x ≠ 0) :
f =O[l] g'' ↔ IsBoundedUnder (· ≤ ·) l fun x => ‖f x‖ / ‖g'' x‖ := by
simp only [isBigO_iff, IsBoundedUnder, IsBounded, eventually_map]
exact
exists_congr fun c =>
eventually_congr <| h.mono fun x hx => (div_le_iff <| norm_pos_iff.2 hx).symm
#align asymptotics.is_O_iff_is_bounded_under_le_div Asymptotics.isBigO_iff_isBoundedUnder_le_div
theorem isBigO_const_left_iff_pos_le_norm {c : E''} (hc : c ≠ 0) :
(fun _x => c) =O[l] f' ↔ ∃ b, 0 < b ∧ ∀ᶠ x in l, b ≤ ‖f' x‖ := by
constructor
· intro h
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨‖c‖ / C, div_pos (norm_pos_iff.2 hc) hC₀, ?_⟩
exact hC.bound.mono fun x => (div_le_iff' hC₀).2
· rintro ⟨b, hb₀, hb⟩
refine IsBigO.of_bound (‖c‖ / b) (hb.mono fun x hx => ?_)
rw [div_mul_eq_mul_div, mul_div_assoc]
exact le_mul_of_one_le_right (norm_nonneg _) ((one_le_div hb₀).2 hx)
#align asymptotics.is_O_const_left_iff_pos_le_norm Asymptotics.isBigO_const_left_iff_pos_le_norm
theorem IsBigO.trans_tendsto (hfg : f'' =O[l] g'') (hg : Tendsto g'' l (𝓝 0)) :
Tendsto f'' l (𝓝 0) :=
(isLittleO_one_iff ℝ).1 <| hfg.trans_isLittleO <| (isLittleO_one_iff ℝ).2 hg
#align asymptotics.is_O.trans_tendsto Asymptotics.IsBigO.trans_tendsto
theorem IsLittleO.trans_tendsto (hfg : f'' =o[l] g'') (hg : Tendsto g'' l (𝓝 0)) :
Tendsto f'' l (𝓝 0) :=
hfg.isBigO.trans_tendsto hg
#align asymptotics.is_o.trans_tendsto Asymptotics.IsLittleO.trans_tendsto
theorem isBigOWith_const_mul_self (c : R) (f : α → R) (l : Filter α) :
IsBigOWith ‖c‖ l (fun x => c * f x) f :=
isBigOWith_of_le' _ fun _x => norm_mul_le _ _
#align asymptotics.is_O_with_const_mul_self Asymptotics.isBigOWith_const_mul_self
theorem isBigO_const_mul_self (c : R) (f : α → R) (l : Filter α) : (fun x => c * f x) =O[l] f :=
(isBigOWith_const_mul_self c f l).isBigO
#align asymptotics.is_O_const_mul_self Asymptotics.isBigO_const_mul_self
theorem IsBigOWith.const_mul_left {f : α → R} (h : IsBigOWith c l f g) (c' : R) :
IsBigOWith (‖c'‖ * c) l (fun x => c' * f x) g :=
(isBigOWith_const_mul_self c' f l).trans h (norm_nonneg c')
#align asymptotics.is_O_with.const_mul_left Asymptotics.IsBigOWith.const_mul_left
theorem IsBigO.const_mul_left {f : α → R} (h : f =O[l] g) (c' : R) : (fun x => c' * f x) =O[l] g :=
let ⟨_c, hc⟩ := h.isBigOWith
(hc.const_mul_left c').isBigO
#align asymptotics.is_O.const_mul_left Asymptotics.IsBigO.const_mul_left
theorem isBigOWith_self_const_mul' (u : Rˣ) (f : α → R) (l : Filter α) :
IsBigOWith ‖(↑u⁻¹ : R)‖ l f fun x => ↑u * f x :=
(isBigOWith_const_mul_self ↑u⁻¹ (fun x ↦ ↑u * f x) l).congr_left
fun x ↦ u.inv_mul_cancel_left (f x)
#align asymptotics.is_O_with_self_const_mul' Asymptotics.isBigOWith_self_const_mul'
theorem isBigOWith_self_const_mul (c : 𝕜) (hc : c ≠ 0) (f : α → 𝕜) (l : Filter α) :
IsBigOWith ‖c‖⁻¹ l f fun x => c * f x :=
(isBigOWith_self_const_mul' (Units.mk0 c hc) f l).congr_const <| norm_inv c
#align asymptotics.is_O_with_self_const_mul Asymptotics.isBigOWith_self_const_mul
theorem isBigO_self_const_mul' {c : R} (hc : IsUnit c) (f : α → R) (l : Filter α) :
f =O[l] fun x => c * f x :=
let ⟨u, hu⟩ := hc
hu ▸ (isBigOWith_self_const_mul' u f l).isBigO
#align asymptotics.is_O_self_const_mul' Asymptotics.isBigO_self_const_mul'
theorem isBigO_self_const_mul (c : 𝕜) (hc : c ≠ 0) (f : α → 𝕜) (l : Filter α) :
f =O[l] fun x => c * f x :=
isBigO_self_const_mul' (IsUnit.mk0 c hc) f l
#align asymptotics.is_O_self_const_mul Asymptotics.isBigO_self_const_mul
theorem isBigO_const_mul_left_iff' {f : α → R} {c : R} (hc : IsUnit c) :
(fun x => c * f x) =O[l] g ↔ f =O[l] g :=
⟨(isBigO_self_const_mul' hc f l).trans, fun h => h.const_mul_left c⟩
#align asymptotics.is_O_const_mul_left_iff' Asymptotics.isBigO_const_mul_left_iff'
theorem isBigO_const_mul_left_iff {f : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(fun x => c * f x) =O[l] g ↔ f =O[l] g :=
isBigO_const_mul_left_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_O_const_mul_left_iff Asymptotics.isBigO_const_mul_left_iff
theorem IsLittleO.const_mul_left {f : α → R} (h : f =o[l] g) (c : R) : (fun x => c * f x) =o[l] g :=
(isBigO_const_mul_self c f l).trans_isLittleO h
#align asymptotics.is_o.const_mul_left Asymptotics.IsLittleO.const_mul_left
theorem isLittleO_const_mul_left_iff' {f : α → R} {c : R} (hc : IsUnit c) :
(fun x => c * f x) =o[l] g ↔ f =o[l] g :=
⟨(isBigO_self_const_mul' hc f l).trans_isLittleO, fun h => h.const_mul_left c⟩
#align asymptotics.is_o_const_mul_left_iff' Asymptotics.isLittleO_const_mul_left_iff'
theorem isLittleO_const_mul_left_iff {f : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(fun x => c * f x) =o[l] g ↔ f =o[l] g :=
isLittleO_const_mul_left_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_o_const_mul_left_iff Asymptotics.isLittleO_const_mul_left_iff
theorem IsBigOWith.of_const_mul_right {g : α → R} {c : R} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f fun x => c * g x) : IsBigOWith (c' * ‖c‖) l f g :=
h.trans (isBigOWith_const_mul_self c g l) hc'
#align asymptotics.is_O_with.of_const_mul_right Asymptotics.IsBigOWith.of_const_mul_right
theorem IsBigO.of_const_mul_right {g : α → R} {c : R} (h : f =O[l] fun x => c * g x) : f =O[l] g :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.of_const_mul_right cnonneg).isBigO
#align asymptotics.is_O.of_const_mul_right Asymptotics.IsBigO.of_const_mul_right
theorem IsBigOWith.const_mul_right' {g : α → R} {u : Rˣ} {c' : ℝ} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f g) : IsBigOWith (c' * ‖(↑u⁻¹ : R)‖) l f fun x => ↑u * g x :=
h.trans (isBigOWith_self_const_mul' _ _ _) hc'
#align asymptotics.is_O_with.const_mul_right' Asymptotics.IsBigOWith.const_mul_right'
theorem IsBigOWith.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) {c' : ℝ} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f g) : IsBigOWith (c' * ‖c‖⁻¹) l f fun x => c * g x :=
h.trans (isBigOWith_self_const_mul c hc g l) hc'
#align asymptotics.is_O_with.const_mul_right Asymptotics.IsBigOWith.const_mul_right
theorem IsBigO.const_mul_right' {g : α → R} {c : R} (hc : IsUnit c) (h : f =O[l] g) :
f =O[l] fun x => c * g x :=
h.trans (isBigO_self_const_mul' hc g l)
#align asymptotics.is_O.const_mul_right' Asymptotics.IsBigO.const_mul_right'
theorem IsBigO.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) (h : f =O[l] g) :
f =O[l] fun x => c * g x :=
h.const_mul_right' <| IsUnit.mk0 c hc
#align asymptotics.is_O.const_mul_right Asymptotics.IsBigO.const_mul_right
theorem isBigO_const_mul_right_iff' {g : α → R} {c : R} (hc : IsUnit c) :
(f =O[l] fun x => c * g x) ↔ f =O[l] g :=
⟨fun h => h.of_const_mul_right, fun h => h.const_mul_right' hc⟩
#align asymptotics.is_O_const_mul_right_iff' Asymptotics.isBigO_const_mul_right_iff'
theorem isBigO_const_mul_right_iff {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(f =O[l] fun x => c * g x) ↔ f =O[l] g :=
isBigO_const_mul_right_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_O_const_mul_right_iff Asymptotics.isBigO_const_mul_right_iff
theorem IsLittleO.of_const_mul_right {g : α → R} {c : R} (h : f =o[l] fun x => c * g x) :
f =o[l] g :=
h.trans_isBigO (isBigO_const_mul_self c g l)
#align asymptotics.is_o.of_const_mul_right Asymptotics.IsLittleO.of_const_mul_right
theorem IsLittleO.const_mul_right' {g : α → R} {c : R} (hc : IsUnit c) (h : f =o[l] g) :
f =o[l] fun x => c * g x :=
h.trans_isBigO (isBigO_self_const_mul' hc g l)
#align asymptotics.is_o.const_mul_right' Asymptotics.IsLittleO.const_mul_right'
theorem IsLittleO.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) (h : f =o[l] g) :
f =o[l] fun x => c * g x :=
h.const_mul_right' <| IsUnit.mk0 c hc
#align asymptotics.is_o.const_mul_right Asymptotics.IsLittleO.const_mul_right
theorem isLittleO_const_mul_right_iff' {g : α → R} {c : R} (hc : IsUnit c) :
(f =o[l] fun x => c * g x) ↔ f =o[l] g :=
⟨fun h => h.of_const_mul_right, fun h => h.const_mul_right' hc⟩
#align asymptotics.is_o_const_mul_right_iff' Asymptotics.isLittleO_const_mul_right_iff'
theorem isLittleO_const_mul_right_iff {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(f =o[l] fun x => c * g x) ↔ f =o[l] g :=
isLittleO_const_mul_right_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_o_const_mul_right_iff Asymptotics.isLittleO_const_mul_right_iff
theorem IsBigOWith.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} {c₁ c₂ : ℝ} (h₁ : IsBigOWith c₁ l f₁ g₁)
(h₂ : IsBigOWith c₂ l f₂ g₂) :
IsBigOWith (c₁ * c₂) l (fun x => f₁ x * f₂ x) fun x => g₁ x * g₂ x := by
simp only [IsBigOWith_def] at *
filter_upwards [h₁, h₂] with _ hx₁ hx₂
apply le_trans (norm_mul_le _ _)
convert mul_le_mul hx₁ hx₂ (norm_nonneg _) (le_trans (norm_nonneg _) hx₁) using 1
rw [norm_mul, mul_mul_mul_comm]
#align asymptotics.is_O_with.mul Asymptotics.IsBigOWith.mul
theorem IsBigO.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =O[l] g₁) (h₂ : f₂ =O[l] g₂) :
(fun x => f₁ x * f₂ x) =O[l] fun x => g₁ x * g₂ x :=
let ⟨_c, hc⟩ := h₁.isBigOWith
let ⟨_c', hc'⟩ := h₂.isBigOWith
(hc.mul hc').isBigO
#align asymptotics.is_O.mul Asymptotics.IsBigO.mul
theorem IsBigO.mul_isLittleO {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =O[l] g₁) (h₂ : f₂ =o[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x := by
simp only [IsLittleO_def] at *
intro c cpos
rcases h₁.exists_pos with ⟨c', c'pos, hc'⟩
exact (hc'.mul (h₂ (div_pos cpos c'pos))).congr_const (mul_div_cancel₀ _ (ne_of_gt c'pos))
#align asymptotics.is_O.mul_is_o Asymptotics.IsBigO.mul_isLittleO
theorem IsLittleO.mul_isBigO {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =o[l] g₁) (h₂ : f₂ =O[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x := by
simp only [IsLittleO_def] at *
intro c cpos
rcases h₂.exists_pos with ⟨c', c'pos, hc'⟩
exact ((h₁ (div_pos cpos c'pos)).mul hc').congr_const (div_mul_cancel₀ _ (ne_of_gt c'pos))
#align asymptotics.is_o.mul_is_O Asymptotics.IsLittleO.mul_isBigO
theorem IsLittleO.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =o[l] g₁) (h₂ : f₂ =o[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x :=
h₁.mul_isBigO h₂.isBigO
#align asymptotics.is_o.mul Asymptotics.IsLittleO.mul
theorem IsBigOWith.pow' {f : α → R} {g : α → 𝕜} (h : IsBigOWith c l f g) :
∀ n : ℕ, IsBigOWith (Nat.casesOn n ‖(1 : R)‖ fun n => c ^ (n + 1))
l (fun x => f x ^ n) fun x => g x ^ n
| 0 => by simpa using isBigOWith_const_const (1 : R) (one_ne_zero' 𝕜) l
| 1 => by simpa
| n + 2 => by simpa [pow_succ] using (IsBigOWith.pow' h (n + 1)).mul h
#align asymptotics.is_O_with.pow' Asymptotics.IsBigOWith.pow'
theorem IsBigOWith.pow [NormOneClass R] {f : α → R} {g : α → 𝕜} (h : IsBigOWith c l f g) :
∀ n : ℕ, IsBigOWith (c ^ n) l (fun x => f x ^ n) fun x => g x ^ n
| 0 => by simpa using h.pow' 0
| n + 1 => h.pow' (n + 1)
#align asymptotics.is_O_with.pow Asymptotics.IsBigOWith.pow
theorem IsBigOWith.of_pow {n : ℕ} {f : α → 𝕜} {g : α → R} (h : IsBigOWith c l (f ^ n) (g ^ n))
(hn : n ≠ 0) (hc : c ≤ c' ^ n) (hc' : 0 ≤ c') : IsBigOWith c' l f g :=
IsBigOWith.of_bound <| (h.weaken hc).bound.mono fun x hx ↦
le_of_pow_le_pow_left hn (by positivity) <|
calc
‖f x‖ ^ n = ‖f x ^ n‖ := (norm_pow _ _).symm
_ ≤ c' ^ n * ‖g x ^ n‖ := hx
_ ≤ c' ^ n * ‖g x‖ ^ n := by gcongr; exact norm_pow_le' _ hn.bot_lt
_ = (c' * ‖g x‖) ^ n := (mul_pow _ _ _).symm
#align asymptotics.is_O_with.of_pow Asymptotics.IsBigOWith.of_pow
theorem IsBigO.pow {f : α → R} {g : α → 𝕜} (h : f =O[l] g) (n : ℕ) :
(fun x => f x ^ n) =O[l] fun x => g x ^ n :=
let ⟨_C, hC⟩ := h.isBigOWith
isBigO_iff_isBigOWith.2 ⟨_, hC.pow' n⟩
#align asymptotics.is_O.pow Asymptotics.IsBigO.pow
theorem IsBigO.of_pow {f : α → 𝕜} {g : α → R} {n : ℕ} (hn : n ≠ 0) (h : (f ^ n) =O[l] (g ^ n)) :
f =O[l] g := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
obtain ⟨c : ℝ, hc₀ : 0 ≤ c, hc : C ≤ c ^ n⟩ :=
((eventually_ge_atTop _).and <| (tendsto_pow_atTop hn).eventually_ge_atTop C).exists
exact (hC.of_pow hn hc hc₀).isBigO
#align asymptotics.is_O.of_pow Asymptotics.IsBigO.of_pow
theorem IsLittleO.pow {f : α → R} {g : α → 𝕜} (h : f =o[l] g) {n : ℕ} (hn : 0 < n) :
(fun x => f x ^ n) =o[l] fun x => g x ^ n := by
obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hn.ne'; clear hn
induction' n with n ihn
· simpa only [Nat.zero_eq, ← Nat.one_eq_succ_zero, pow_one]
· convert ihn.mul h <;> simp [pow_succ]
#align asymptotics.is_o.pow Asymptotics.IsLittleO.pow
theorem IsLittleO.of_pow {f : α → 𝕜} {g : α → R} {n : ℕ} (h : (f ^ n) =o[l] (g ^ n)) (hn : n ≠ 0) :
f =o[l] g :=
IsLittleO.of_isBigOWith fun _c hc => (h.def' <| pow_pos hc _).of_pow hn le_rfl hc.le
#align asymptotics.is_o.of_pow Asymptotics.IsLittleO.of_pow
theorem IsBigOWith.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : IsBigOWith c l f g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : IsBigOWith c l (fun x => (g x)⁻¹) fun x => (f x)⁻¹ := by
refine IsBigOWith.of_bound (h.bound.mp (h₀.mono fun x h₀ hle => ?_))
rcases eq_or_ne (f x) 0 with hx | hx
· simp only [hx, h₀ hx, inv_zero, norm_zero, mul_zero, le_rfl]
· have hc : 0 < c := pos_of_mul_pos_left ((norm_pos_iff.2 hx).trans_le hle) (norm_nonneg _)
replace hle := inv_le_inv_of_le (norm_pos_iff.2 hx) hle
simpa only [norm_inv, mul_inv, ← div_eq_inv_mul, div_le_iff hc] using hle
#align asymptotics.is_O_with.inv_rev Asymptotics.IsBigOWith.inv_rev
theorem IsBigO.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : f =O[l] g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : (fun x => (g x)⁻¹) =O[l] fun x => (f x)⁻¹ :=
let ⟨_c, hc⟩ := h.isBigOWith
(hc.inv_rev h₀).isBigO
#align asymptotics.is_O.inv_rev Asymptotics.IsBigO.inv_rev
theorem IsLittleO.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : f =o[l] g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : (fun x => (g x)⁻¹) =o[l] fun x => (f x)⁻¹ :=
IsLittleO.of_isBigOWith fun _c hc => (h.def' hc).inv_rev h₀
#align asymptotics.is_o.inv_rev Asymptotics.IsLittleO.inv_rev
theorem IsLittleO.tendsto_div_nhds_zero {f g : α → 𝕜} (h : f =o[l] g) :
Tendsto (fun x => f x / g x) l (𝓝 0) :=
(isLittleO_one_iff 𝕜).mp <| by
calc
(fun x => f x / g x) =o[l] fun x => g x / g x := by
simpa only [div_eq_mul_inv] using h.mul_isBigO (isBigO_refl _ _)
_ =O[l] fun _x => (1 : 𝕜) := isBigO_of_le _ fun x => by simp [div_self_le_one]
#align asymptotics.is_o.tendsto_div_nhds_zero Asymptotics.IsLittleO.tendsto_div_nhds_zero
theorem IsLittleO.tendsto_inv_smul_nhds_zero [Module 𝕜 E'] [BoundedSMul 𝕜 E']
{f : α → E'} {g : α → 𝕜}
{l : Filter α} (h : f =o[l] g) : Tendsto (fun x => (g x)⁻¹ • f x) l (𝓝 0) := by
simpa only [div_eq_inv_mul, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero] using
h.norm_norm.tendsto_div_nhds_zero
#align asymptotics.is_o.tendsto_inv_smul_nhds_zero Asymptotics.IsLittleO.tendsto_inv_smul_nhds_zero
theorem isLittleO_iff_tendsto' {f g : α → 𝕜} (hgf : ∀ᶠ x in l, g x = 0 → f x = 0) :
f =o[l] g ↔ Tendsto (fun x => f x / g x) l (𝓝 0) :=
⟨IsLittleO.tendsto_div_nhds_zero, fun h =>
(((isLittleO_one_iff _).mpr h).mul_isBigO (isBigO_refl g l)).congr'
(hgf.mono fun _x => div_mul_cancel_of_imp) (eventually_of_forall fun _x => one_mul _)⟩
#align asymptotics.is_o_iff_tendsto' Asymptotics.isLittleO_iff_tendsto'
theorem isLittleO_iff_tendsto {f g : α → 𝕜} (hgf : ∀ x, g x = 0 → f x = 0) :
f =o[l] g ↔ Tendsto (fun x => f x / g x) l (𝓝 0) :=
isLittleO_iff_tendsto' (eventually_of_forall hgf)
#align asymptotics.is_o_iff_tendsto Asymptotics.isLittleO_iff_tendsto
alias ⟨_, isLittleO_of_tendsto'⟩ := isLittleO_iff_tendsto'
#align asymptotics.is_o_of_tendsto' Asymptotics.isLittleO_of_tendsto'
alias ⟨_, isLittleO_of_tendsto⟩ := isLittleO_iff_tendsto
#align asymptotics.is_o_of_tendsto Asymptotics.isLittleO_of_tendsto
theorem isLittleO_const_left_of_ne {c : E''} (hc : c ≠ 0) :
(fun _x => c) =o[l] g ↔ Tendsto (fun x => ‖g x‖) l atTop := by
simp only [← isLittleO_one_left_iff ℝ]
exact ⟨(isBigO_const_const (1 : ℝ) hc l).trans_isLittleO,
(isBigO_const_one ℝ c l).trans_isLittleO⟩
#align asymptotics.is_o_const_left_of_ne Asymptotics.isLittleO_const_left_of_ne
@[simp]
theorem isLittleO_const_left {c : E''} :
(fun _x => c) =o[l] g'' ↔ c = 0 ∨ Tendsto (norm ∘ g'') l atTop := by
rcases eq_or_ne c 0 with (rfl | hc)
· simp only [isLittleO_zero, eq_self_iff_true, true_or_iff]
· simp only [hc, false_or_iff, isLittleO_const_left_of_ne hc]; rfl
#align asymptotics.is_o_const_left Asymptotics.isLittleO_const_left
@[simp 1001] -- Porting note: increase priority so that this triggers before `isLittleO_const_left`
theorem isLittleO_const_const_iff [NeBot l] {d : E''} {c : F''} :
((fun _x => d) =o[l] fun _x => c) ↔ d = 0 := by
have : ¬Tendsto (Function.const α ‖c‖) l atTop :=
not_tendsto_atTop_of_tendsto_nhds tendsto_const_nhds
simp only [isLittleO_const_left, or_iff_left_iff_imp]
exact fun h => (this h).elim
#align asymptotics.is_o_const_const_iff Asymptotics.isLittleO_const_const_iff
@[simp]
theorem isLittleO_pure {x} : f'' =o[pure x] g'' ↔ f'' x = 0 :=
calc
f'' =o[pure x] g'' ↔ (fun _y : α => f'' x) =o[pure x] fun _ => g'' x := isLittleO_congr rfl rfl
_ ↔ f'' x = 0 := isLittleO_const_const_iff
#align asymptotics.is_o_pure Asymptotics.isLittleO_pure
theorem isLittleO_const_id_cobounded (c : F'') :
(fun _ => c) =o[Bornology.cobounded E''] id :=
isLittleO_const_left.2 <| .inr tendsto_norm_cobounded_atTop
#align asymptotics.is_o_const_id_comap_norm_at_top Asymptotics.isLittleO_const_id_cobounded
theorem isLittleO_const_id_atTop (c : E'') : (fun _x : ℝ => c) =o[atTop] id :=
isLittleO_const_left.2 <| Or.inr tendsto_abs_atTop_atTop
#align asymptotics.is_o_const_id_at_top Asymptotics.isLittleO_const_id_atTop
theorem isLittleO_const_id_atBot (c : E'') : (fun _x : ℝ => c) =o[atBot] id :=
isLittleO_const_left.2 <| Or.inr tendsto_abs_atBot_atTop
#align asymptotics.is_o_const_id_at_bot Asymptotics.isLittleO_const_id_atBot
theorem div_isBoundedUnder_of_isBigO {α : Type*} {l : Filter α} {f g : α → 𝕜} (h : f =O[l] g) :
IsBoundedUnder (· ≤ ·) l fun x => ‖f x / g x‖ := by
obtain ⟨c, h₀, hc⟩ := h.exists_nonneg
refine ⟨c, eventually_map.2 (hc.bound.mono fun x hx => ?_)⟩
rw [norm_div]
exact div_le_of_nonneg_of_le_mul (norm_nonneg _) h₀ hx
#align asymptotics.div_is_bounded_under_of_is_O Asymptotics.div_isBoundedUnder_of_isBigO
theorem isBigO_iff_div_isBoundedUnder {α : Type*} {l : Filter α} {f g : α → 𝕜}
(hgf : ∀ᶠ x in l, g x = 0 → f x = 0) :
f =O[l] g ↔ IsBoundedUnder (· ≤ ·) l fun x => ‖f x / g x‖ := by
refine ⟨div_isBoundedUnder_of_isBigO, fun h => ?_⟩
obtain ⟨c, hc⟩ := h
simp only [eventually_map, norm_div] at hc
refine IsBigO.of_bound c (hc.mp <| hgf.mono fun x hx₁ hx₂ => ?_)
by_cases hgx : g x = 0
· simp [hx₁ hgx, hgx]
· exact (div_le_iff (norm_pos_iff.2 hgx)).mp hx₂
#align asymptotics.is_O_iff_div_is_bounded_under Asymptotics.isBigO_iff_div_isBoundedUnder
theorem isBigO_of_div_tendsto_nhds {α : Type*} {l : Filter α} {f g : α → 𝕜}
(hgf : ∀ᶠ x in l, g x = 0 → f x = 0) (c : 𝕜) (H : Filter.Tendsto (f / g) l (𝓝 c)) :
f =O[l] g :=
(isBigO_iff_div_isBoundedUnder hgf).2 <| H.norm.isBoundedUnder_le
#align asymptotics.is_O_of_div_tendsto_nhds Asymptotics.isBigO_of_div_tendsto_nhds
theorem IsLittleO.tendsto_zero_of_tendsto {α E 𝕜 : Type*} [NormedAddCommGroup E] [NormedField 𝕜]
{u : α → E} {v : α → 𝕜} {l : Filter α} {y : 𝕜} (huv : u =o[l] v) (hv : Tendsto v l (𝓝 y)) :
Tendsto u l (𝓝 0) := by
suffices h : u =o[l] fun _x => (1 : 𝕜) by
rwa [isLittleO_one_iff] at h
exact huv.trans_isBigO (hv.isBigO_one 𝕜)
#align asymptotics.is_o.tendsto_zero_of_tendsto Asymptotics.IsLittleO.tendsto_zero_of_tendsto
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 2,079 | 2,084 | theorem isLittleO_pow_pow {m n : ℕ} (h : m < n) : (fun x : 𝕜 => x ^ n) =o[𝓝 0] fun x => x ^ m := by |
rcases lt_iff_exists_add.1 h with ⟨p, hp0 : 0 < p, rfl⟩
suffices (fun x : 𝕜 => x ^ m * x ^ p) =o[𝓝 0] fun x => x ^ m * 1 ^ p by
simpa only [pow_add, one_pow, mul_one]
exact IsBigO.mul_isLittleO (isBigO_refl _ _)
(IsLittleO.pow ((isLittleO_one_iff _).2 tendsto_id) hp0)
|
import Mathlib.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {α : Type*}
inductive Lists'.{u} (α : Type u) : Bool → Type u
| atom : α → Lists' α false
| nil : Lists' α true
| cons' {b} : Lists' α b → Lists' α true → Lists' α true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (α : Type*) :=
Σb, Lists' α b
#align lists Lists
namespace Lists'
instance [Inhabited α] : ∀ b, Inhabited (Lists' α b)
| true => ⟨nil⟩
| false => ⟨atom default⟩
def cons : Lists α → Lists' α true → Lists' α true
| ⟨_, a⟩, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : ∀ {b}, Lists' α b → List (Lists α)
| _, atom _ => []
| _, nil => []
| _, cons' a l => ⟨_, a⟩ :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
#align lists'.to_list_cons Lists'.toList_cons
@[simp]
def ofList : List (Lists α) → Lists' α true
| [] => nil
| a :: l => cons a (ofList l)
#align lists'.of_list Lists'.ofList
@[simp]
| Mathlib/SetTheory/Lists.lean | 99 | 99 | theorem to_ofList (l : List (Lists α)) : toList (ofList l) = l := by | induction l <;> simp [*]
|
import Mathlib.Algebra.Order.Floor
import Mathlib.Data.Nat.Prime
namespace FloorRing
open scoped Nat
variable {K : Type*}
| Mathlib/Algebra/Order/Floor/Prime.lean | 22 | 34 | theorem exists_prime_mul_pow_lt_factorial [LinearOrderedRing K] [FloorRing K] (n : ℕ) (a c : K) :
∃ p > n, p.Prime ∧ a * c ^ p < (p - 1)! := by |
obtain ⟨p, pn, pp, h⟩ := n.exists_prime_mul_pow_lt_factorial ⌈|a|⌉.natAbs ⌈|c|⌉.natAbs
use p, pn, pp
calc a * c ^ p
_ ≤ |a * c ^ p| := le_abs_self _
_ ≤ ⌈|a|⌉ * (⌈|c|⌉ : K) ^ p := ?_
_ = ↑(Int.natAbs ⌈|a|⌉ * Int.natAbs ⌈|c|⌉ ^ p) := ?_
_ < ↑(p - 1)! := Nat.cast_lt.mpr h
· rw [abs_mul, abs_pow]
gcongr <;> try first | positivity | apply Int.le_ceil
· simp_rw [Nat.cast_mul, Nat.cast_pow, Int.cast_natAbs,
abs_eq_self.mpr (Int.ceil_nonneg (abs_nonneg (_ : K)))]
|
import Mathlib.Algebra.Algebra.Defs
import Mathlib.GroupTheory.GroupAction.BigOperators
import Mathlib.LinearAlgebra.Prod
#align_import algebra.triv_sq_zero_ext from "leanprover-community/mathlib"@"ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d"
universe u v w
def TrivSqZeroExt (R : Type u) (M : Type v) :=
R × M
#align triv_sq_zero_ext TrivSqZeroExt
local notation "tsze" => TrivSqZeroExt
open scoped RightActions
namespace TrivSqZeroExt
open MulOpposite
section Algebra
variable (S : Type*) (R R' : Type u) (M : Type v)
variable [CommSemiring S] [Semiring R] [CommSemiring R'] [AddCommMonoid M]
variable [Algebra S R] [Algebra S R'] [Module S M]
variable [Module R M] [Module Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M]
variable [IsScalarTower S R M] [IsScalarTower S Rᵐᵒᵖ M]
variable [Module R' M] [Module R'ᵐᵒᵖ M] [IsCentralScalar R' M] [IsScalarTower S R' M]
instance algebra' : Algebra S (tsze R M) :=
{ (TrivSqZeroExt.inlHom R M).comp (algebraMap S R) with
smul := (· • ·)
commutes' := fun s x =>
ext (Algebra.commutes _ _) <|
show algebraMap S R s •> x.snd + (0 : M) <• x.fst
= x.fst •> (0 : M) + x.snd <• algebraMap S R s by
rw [smul_zero, smul_zero, add_zero, zero_add]
rw [Algebra.algebraMap_eq_smul_one, MulOpposite.op_smul, op_one, smul_assoc,
one_smul, smul_assoc, one_smul]
smul_def' := fun s x =>
ext (Algebra.smul_def _ _) <|
show s • x.snd = algebraMap S R s •> x.snd + (0 : M) <• x.fst by
rw [smul_zero, add_zero, algebraMap_smul] }
#align triv_sq_zero_ext.algebra' TrivSqZeroExt.algebra'
-- shortcut instance for the common case
instance : Algebra R' (tsze R' M) :=
TrivSqZeroExt.algebra' _ _ _
theorem algebraMap_eq_inl : ⇑(algebraMap R' (tsze R' M)) = inl :=
rfl
#align triv_sq_zero_ext.algebra_map_eq_inl TrivSqZeroExt.algebraMap_eq_inl
theorem algebraMap_eq_inlHom : algebraMap R' (tsze R' M) = inlHom R' M :=
rfl
#align triv_sq_zero_ext.algebra_map_eq_inl_hom TrivSqZeroExt.algebraMap_eq_inlHom
theorem algebraMap_eq_inl' (s : S) : algebraMap S (tsze R M) s = inl (algebraMap S R s) :=
rfl
#align triv_sq_zero_ext.algebra_map_eq_inl' TrivSqZeroExt.algebraMap_eq_inl'
@[simps]
def fstHom : tsze R M →ₐ[S] R where
toFun := fst
map_one' := fst_one
map_mul' := fst_mul
map_zero' := fst_zero (M := M)
map_add' := fst_add
commutes' _r := fst_inl M _
#align triv_sq_zero_ext.fst_hom TrivSqZeroExt.fstHom
@[simps]
def inlAlgHom : R →ₐ[S] tsze R M where
toFun := inl
map_one' := inl_one _
map_mul' := inl_mul _
map_zero' := inl_zero (M := M)
map_add' := inl_add _
commutes' _r := (algebraMap_eq_inl' _ _ _ _).symm
variable {R R' S M}
theorem algHom_ext {A} [Semiring A] [Algebra R' A] ⦃f g : tsze R' M →ₐ[R'] A⦄
(h : ∀ m, f (inr m) = g (inr m)) : f = g :=
AlgHom.toLinearMap_injective <|
linearMap_ext (fun _r => (f.commutes _).trans (g.commutes _).symm) h
#align triv_sq_zero_ext.alg_hom_ext TrivSqZeroExt.algHom_ext
@[ext]
theorem algHom_ext' {A} [Semiring A] [Algebra S A] ⦃f g : tsze R M →ₐ[S] A⦄
(hinl : f.comp (inlAlgHom S R M) = g.comp (inlAlgHom S R M))
(hinr : f.toLinearMap.comp (inrHom R M |>.restrictScalars S) =
g.toLinearMap.comp (inrHom R M |>.restrictScalars S)) : f = g :=
AlgHom.toLinearMap_injective <|
linearMap_ext (AlgHom.congr_fun hinl) (LinearMap.congr_fun hinr)
#align triv_sq_zero_ext.alg_hom_ext' TrivSqZeroExt.algHom_ext'
variable {A : Type*} [Semiring A] [Algebra S A] [Algebra R' A]
def lift (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r •> x) = f r * g x)
(hgf : ∀ r x, g (x <• r) = g x * f r) : tsze R M →ₐ[S] A :=
AlgHom.ofLinearMap
((f.comp <| fstHom S R M).toLinearMap + g ∘ₗ (sndHom R M |>.restrictScalars S))
(show f 1 + g (0 : M) = 1 by rw [map_zero, map_one, add_zero])
(TrivSqZeroExt.ind fun r₁ m₁ =>
TrivSqZeroExt.ind fun r₂ m₂ => by
dsimp
simp only [add_zero, zero_add, add_mul, mul_add, smul_mul_smul, hg, smul_zero,
op_smul_eq_smul]
rw [← AlgHom.map_mul, LinearMap.map_add, add_comm (g _), add_assoc, hfg, hgf])
#align triv_sq_zero_ext.lift_aux TrivSqZeroExt.lift
theorem lift_def (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r • x) = f r * g x)
(hgf : ∀ r x, g (op r • x) = g x * f r) (x : tsze R M) :
lift f g hg hfg hgf x = f x.fst + g x.snd :=
rfl
@[simp]
theorem lift_apply_inl (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r •> x) = f r * g x)
(hgf : ∀ r x, g (x <• r) = g x * f r)
(r : R) :
lift f g hg hfg hgf (inl r) = f r :=
show f r + g 0 = f r by rw [map_zero, add_zero]
@[simp]
theorem lift_apply_inr (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r •> x) = f r * g x)
(hgf : ∀ r x, g (x <• r) = g x * f r)
(m : M) :
lift f g hg hfg hgf (inr m) = g m :=
show f 0 + g m = g m by rw [map_zero, zero_add]
#align triv_sq_zero_ext.lift_aux_apply_inr TrivSqZeroExt.lift_apply_inr
@[simp]
theorem lift_comp_inlHom (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r •> x) = f r * g x)
(hgf : ∀ r x, g (x <• r) = g x * f r) :
(lift f g hg hfg hgf).comp (inlAlgHom S R M) = f :=
AlgHom.ext <| lift_apply_inl f g hg hfg hgf
@[simp]
theorem lift_comp_inrHom (f : R →ₐ[S] A) (g : M →ₗ[S] A)
(hg : ∀ x y, g x * g y = 0)
(hfg : ∀ r x, g (r •> x) = f r * g x)
(hgf : ∀ r x, g (x <• r) = g x * f r) :
(lift f g hg hfg hgf).toLinearMap.comp (inrHom R M |>.restrictScalars S) = g :=
LinearMap.ext <| lift_apply_inr f g hg hfg hgf
#align triv_sq_zero_ext.lift_aux_comp_inr_hom TrivSqZeroExt.lift_comp_inrHom
@[simp]
theorem lift_inlAlgHom_inrHom :
lift (inlAlgHom _ _ _) (inrHom R M |>.restrictScalars S)
(inr_mul_inr R) (fun _ _ => (inl_mul_inr _ _).symm) (fun _ _ => (inr_mul_inl _ _).symm) =
AlgHom.id S (tsze R M) :=
algHom_ext' (lift_comp_inlHom _ _ _ _ _) (lift_comp_inrHom _ _ _ _ _)
#align triv_sq_zero_ext.lift_aux_inr_hom TrivSqZeroExt.lift_inlAlgHom_inrHomₓ
@[simps! apply symm_apply_coe]
def liftEquiv :
{fg : (R →ₐ[S] A) × (M →ₗ[S] A) //
(∀ x y, fg.2 x * fg.2 y = 0) ∧
(∀ r x, fg.2 (r •> x) = fg.1 r * fg.2 x) ∧
(∀ r x, fg.2 (x <• r) = fg.2 x * fg.1 r)} ≃ (tsze R M →ₐ[S] A) where
toFun fg := lift fg.val.1 fg.val.2 fg.prop.1 fg.prop.2.1 fg.prop.2.2
invFun F :=
⟨(F.comp (inlAlgHom _ _ _), F.toLinearMap ∘ₗ (inrHom _ _ |>.restrictScalars _)),
(fun _x _y =>
(F.map_mul _ _).symm.trans <| (F.congr_arg <| inr_mul_inr _ _ _).trans F.map_zero),
(fun _r _x => (F.congr_arg (inl_mul_inr _ _).symm).trans (F.map_mul _ _)),
(fun _r _x => (F.congr_arg (inr_mul_inl _ _).symm).trans (F.map_mul _ _))⟩
left_inv _f := Subtype.ext <| Prod.ext (lift_comp_inlHom _ _ _ _ _) (lift_comp_inrHom _ _ _ _ _)
right_inv _F := algHom_ext' (lift_comp_inlHom _ _ _ _ _) (lift_comp_inrHom _ _ _ _ _)
@[simps! apply symm_apply_coe]
def liftEquivOfComm :
{ f : M →ₗ[R'] A // ∀ x y, f x * f y = 0 } ≃ (tsze R' M →ₐ[R'] A) := by
refine Equiv.trans ?_ liftEquiv
exact {
toFun := fun f => ⟨(Algebra.ofId _ _, f.val), f.prop,
fun r x => by simp [Algebra.smul_def, Algebra.ofId_apply],
fun r x => by simp [Algebra.smul_def, Algebra.ofId_apply, Algebra.commutes]⟩
invFun := fun fg => ⟨fg.val.2, fg.prop.1⟩
left_inv := fun f => rfl
right_inv := fun fg => Subtype.ext <|
Prod.ext (AlgHom.toLinearMap_injective <| LinearMap.ext_ring <| by simp)
rfl }
#align triv_sq_zero_ext.lift TrivSqZeroExt.liftEquiv
section map
variable {N P : Type*} [AddCommMonoid N] [Module R' N] [Module R'ᵐᵒᵖ N] [IsCentralScalar R' N]
[AddCommMonoid P] [Module R' P] [Module R'ᵐᵒᵖ P] [IsCentralScalar R' P]
def map (f : M →ₗ[R'] N) : TrivSqZeroExt R' M →ₐ[R'] TrivSqZeroExt R' N :=
liftEquivOfComm ⟨inrHom R' N ∘ₗ f, fun _ _ => inr_mul_inr _ _ _⟩
@[simp]
theorem map_inl (f : M →ₗ[R'] N) (r : R') : map f (inl r) = inl r := by
rw [map, liftEquivOfComm_apply, lift_apply_inl, Algebra.ofId_apply, algebraMap_eq_inl]
@[simp]
theorem map_inr (f : M →ₗ[R'] N) (x : M) : map f (inr x) = inr (f x) := by
rw [map, liftEquivOfComm_apply, lift_apply_inr, LinearMap.comp_apply, inrHom_apply]
@[simp]
theorem fst_map (f : M →ₗ[R'] N) (x : TrivSqZeroExt R' M) : fst (map f x) = fst x := by
simp [map, lift_def, Algebra.ofId_apply, algebraMap_eq_inl]
@[simp]
| Mathlib/Algebra/TrivSqZeroExt.lean | 1,074 | 1,075 | theorem snd_map (f : M →ₗ[R'] N) (x : TrivSqZeroExt R' M) : snd (map f x) = f (snd x) := by |
simp [map, lift_def, Algebra.ofId_apply, algebraMap_eq_inl]
|
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 Cyclotomic
def cyclotomic (n : ℕ) (R : Type*) [Ring R] : R[X] :=
if h : n = 0 then 1
else map (Int.castRingHom R) (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n h)).choose
#align polynomial.cyclotomic Polynomial.cyclotomic
theorem int_cyclotomic_rw {n : ℕ} (h : n ≠ 0) :
cyclotomic n ℤ = (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n h)).choose := by
simp only [cyclotomic, h, dif_neg, not_false_iff]
ext i
simp only [coeff_map, Int.cast_id, eq_intCast]
#align polynomial.int_cyclotomic_rw Polynomial.int_cyclotomic_rw
theorem map_cyclotomic_int (n : ℕ) (R : Type*) [Ring R] :
map (Int.castRingHom R) (cyclotomic n ℤ) = cyclotomic n R := by
by_cases hzero : n = 0
· simp only [hzero, cyclotomic, dif_pos, Polynomial.map_one]
simp [cyclotomic, hzero]
#align polynomial.map_cyclotomic_int Polynomial.map_cyclotomic_int
theorem int_cyclotomic_spec (n : ℕ) :
map (Int.castRingHom ℂ) (cyclotomic n ℤ) = cyclotomic' n ℂ ∧
(cyclotomic n ℤ).degree = (cyclotomic' n ℂ).degree ∧ (cyclotomic n ℤ).Monic := by
by_cases hzero : n = 0
· simp only [hzero, cyclotomic, degree_one, monic_one, cyclotomic'_zero, dif_pos,
eq_self_iff_true, Polynomial.map_one, and_self_iff]
rw [int_cyclotomic_rw hzero]
exact (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n hzero)).choose_spec
#align polynomial.int_cyclotomic_spec Polynomial.int_cyclotomic_spec
theorem int_cyclotomic_unique {n : ℕ} {P : ℤ[X]} (h : map (Int.castRingHom ℂ) P = cyclotomic' n ℂ) :
P = cyclotomic n ℤ := by
apply map_injective (Int.castRingHom ℂ) Int.cast_injective
rw [h, (int_cyclotomic_spec n).1]
#align polynomial.int_cyclotomic_unique Polynomial.int_cyclotomic_unique
@[simp]
theorem map_cyclotomic (n : ℕ) {R S : Type*} [Ring R] [Ring S] (f : R →+* S) :
map f (cyclotomic n R) = cyclotomic n S := by
rw [← map_cyclotomic_int n R, ← map_cyclotomic_int n S, map_map]
have : Subsingleton (ℤ →+* S) := inferInstance
congr!
#align polynomial.map_cyclotomic Polynomial.map_cyclotomic
theorem cyclotomic.eval_apply {R S : Type*} (q : R) (n : ℕ) [Ring R] [Ring S] (f : R →+* S) :
eval (f q) (cyclotomic n S) = f (eval q (cyclotomic n R)) := by
rw [← map_cyclotomic n f, eval_map, eval₂_at_apply]
#align polynomial.cyclotomic.eval_apply Polynomial.cyclotomic.eval_apply
@[simp]
theorem cyclotomic_zero (R : Type*) [Ring R] : cyclotomic 0 R = 1 := by
simp only [cyclotomic, dif_pos]
#align polynomial.cyclotomic_zero Polynomial.cyclotomic_zero
@[simp]
theorem cyclotomic_one (R : Type*) [Ring R] : cyclotomic 1 R = X - 1 := by
have hspec : map (Int.castRingHom ℂ) (X - 1) = cyclotomic' 1 ℂ := by
simp only [cyclotomic'_one, PNat.one_coe, map_X, Polynomial.map_one, Polynomial.map_sub]
symm
rw [← map_cyclotomic_int, ← int_cyclotomic_unique hspec]
simp only [map_X, Polynomial.map_one, Polynomial.map_sub]
#align polynomial.cyclotomic_one Polynomial.cyclotomic_one
theorem cyclotomic.monic (n : ℕ) (R : Type*) [Ring R] : (cyclotomic n R).Monic := by
rw [← map_cyclotomic_int]
exact (int_cyclotomic_spec n).2.2.map _
#align polynomial.cyclotomic.monic Polynomial.cyclotomic.monic
theorem cyclotomic.isPrimitive (n : ℕ) (R : Type*) [CommRing R] : (cyclotomic n R).IsPrimitive :=
(cyclotomic.monic n R).isPrimitive
#align polynomial.cyclotomic.is_primitive Polynomial.cyclotomic.isPrimitive
theorem cyclotomic_ne_zero (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] : cyclotomic n R ≠ 0 :=
(cyclotomic.monic n R).ne_zero
#align polynomial.cyclotomic_ne_zero Polynomial.cyclotomic_ne_zero
theorem degree_cyclotomic (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] :
(cyclotomic n R).degree = Nat.totient n := by
rw [← map_cyclotomic_int]
rw [degree_map_eq_of_leadingCoeff_ne_zero (Int.castRingHom R) _]
· cases' n with k
· simp only [cyclotomic, degree_one, dif_pos, Nat.totient_zero, CharP.cast_eq_zero]
rw [← degree_cyclotomic' (Complex.isPrimitiveRoot_exp k.succ (Nat.succ_ne_zero k))]
exact (int_cyclotomic_spec k.succ).2.1
simp only [(int_cyclotomic_spec n).right.right, eq_intCast, Monic.leadingCoeff, Int.cast_one,
Ne, not_false_iff, one_ne_zero]
#align polynomial.degree_cyclotomic Polynomial.degree_cyclotomic
theorem natDegree_cyclotomic (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] :
(cyclotomic n R).natDegree = Nat.totient n := by
rw [natDegree, degree_cyclotomic]; norm_cast
#align polynomial.nat_degree_cyclotomic Polynomial.natDegree_cyclotomic
theorem degree_cyclotomic_pos (n : ℕ) (R : Type*) (hpos : 0 < n) [Ring R] [Nontrivial R] :
0 < (cyclotomic n R).degree := by
rwa [degree_cyclotomic n R, Nat.cast_pos, Nat.totient_pos]
#align polynomial.degree_cyclotomic_pos Polynomial.degree_cyclotomic_pos
open Finset
theorem prod_cyclotomic_eq_X_pow_sub_one {n : ℕ} (hpos : 0 < n) (R : Type*) [CommRing R] :
∏ i ∈ Nat.divisors n, cyclotomic i R = X ^ n - 1 := by
have integer : ∏ i ∈ Nat.divisors n, cyclotomic i ℤ = X ^ n - 1 := by
apply map_injective (Int.castRingHom ℂ) Int.cast_injective
simp only [Polynomial.map_prod, int_cyclotomic_spec, Polynomial.map_pow, map_X,
Polynomial.map_one, Polynomial.map_sub]
exact prod_cyclotomic'_eq_X_pow_sub_one hpos (Complex.isPrimitiveRoot_exp n hpos.ne')
simpa only [Polynomial.map_prod, map_cyclotomic_int, Polynomial.map_sub, Polynomial.map_one,
Polynomial.map_pow, Polynomial.map_X] using congr_arg (map (Int.castRingHom R)) integer
set_option linter.uppercaseLean3 false in
#align polynomial.prod_cyclotomic_eq_X_pow_sub_one Polynomial.prod_cyclotomic_eq_X_pow_sub_one
theorem cyclotomic.dvd_X_pow_sub_one (n : ℕ) (R : Type*) [Ring R] :
cyclotomic n R ∣ X ^ n - 1 := by
suffices cyclotomic n ℤ ∣ X ^ n - 1 by
simpa only [map_cyclotomic_int, Polynomial.map_sub, Polynomial.map_one, Polynomial.map_pow,
Polynomial.map_X] using map_dvd (Int.castRingHom R) this
rcases n.eq_zero_or_pos with (rfl | hn)
· simp
rw [← prod_cyclotomic_eq_X_pow_sub_one hn]
exact Finset.dvd_prod_of_mem _ (n.mem_divisors_self hn.ne')
set_option linter.uppercaseLean3 false in
#align polynomial.cyclotomic.dvd_X_pow_sub_one Polynomial.cyclotomic.dvd_X_pow_sub_one
theorem prod_cyclotomic_eq_geom_sum {n : ℕ} (h : 0 < n) (R) [CommRing R] :
∏ i ∈ n.divisors.erase 1, cyclotomic i R = ∑ i ∈ Finset.range n, X ^ i := by
suffices (∏ i ∈ n.divisors.erase 1, cyclotomic i ℤ) = ∑ i ∈ Finset.range n, X ^ i by
simpa only [Polynomial.map_prod, map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow,
Polynomial.map_X] using congr_arg (map (Int.castRingHom R)) this
rw [← mul_left_inj' (cyclotomic_ne_zero 1 ℤ), prod_erase_mul _ _ (Nat.one_mem_divisors.2 h.ne'),
cyclotomic_one, geom_sum_mul, prod_cyclotomic_eq_X_pow_sub_one h]
#align polynomial.prod_cyclotomic_eq_geom_sum Polynomial.prod_cyclotomic_eq_geom_sum
theorem cyclotomic_prime (R : Type*) [Ring R] (p : ℕ) [hp : Fact p.Prime] :
cyclotomic p R = ∑ i ∈ Finset.range p, X ^ i := by
suffices cyclotomic p ℤ = ∑ i ∈ range p, X ^ i by
simpa only [map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow, Polynomial.map_X] using
congr_arg (map (Int.castRingHom R)) this
rw [← prod_cyclotomic_eq_geom_sum hp.out.pos, hp.out.divisors,
erase_insert (mem_singleton.not.2 hp.out.ne_one.symm), prod_singleton]
#align polynomial.cyclotomic_prime Polynomial.cyclotomic_prime
theorem cyclotomic_prime_mul_X_sub_one (R : Type*) [Ring R] (p : ℕ) [hn : Fact (Nat.Prime p)] :
cyclotomic p R * (X - 1) = X ^ p - 1 := by rw [cyclotomic_prime, geom_sum_mul]
set_option linter.uppercaseLean3 false in
#align polynomial.cyclotomic_prime_mul_X_sub_one Polynomial.cyclotomic_prime_mul_X_sub_one
@[simp]
theorem cyclotomic_two (R : Type*) [Ring R] : cyclotomic 2 R = X + 1 := by simp [cyclotomic_prime]
#align polynomial.cyclotomic_two Polynomial.cyclotomic_two
@[simp]
theorem cyclotomic_three (R : Type*) [Ring R] : cyclotomic 3 R = X ^ 2 + X + 1 := by
simp [cyclotomic_prime, sum_range_succ']
#align polynomial.cyclotomic_three Polynomial.cyclotomic_three
theorem cyclotomic_dvd_geom_sum_of_dvd (R) [Ring R] {d n : ℕ} (hdn : d ∣ n) (hd : d ≠ 1) :
cyclotomic d R ∣ ∑ i ∈ Finset.range n, X ^ i := by
suffices cyclotomic d ℤ ∣ ∑ i ∈ Finset.range n, X ^ i by
simpa only [map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow, Polynomial.map_X] using
map_dvd (Int.castRingHom R) this
rcases n.eq_zero_or_pos with (rfl | hn)
· simp
rw [← prod_cyclotomic_eq_geom_sum hn]
apply Finset.dvd_prod_of_mem
simp [hd, hdn, hn.ne']
#align polynomial.cyclotomic_dvd_geom_sum_of_dvd Polynomial.cyclotomic_dvd_geom_sum_of_dvd
theorem X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd (R) [CommRing R] {d n : ℕ}
(h : d ∈ n.properDivisors) :
((X ^ d - 1) * ∏ x ∈ n.divisors \ d.divisors, cyclotomic x R) = X ^ n - 1 := by
obtain ⟨hd, hdn⟩ := Nat.mem_properDivisors.mp h
have h0n : 0 < n := pos_of_gt hdn
have h0d : 0 < d := Nat.pos_of_dvd_of_pos hd h0n
rw [← prod_cyclotomic_eq_X_pow_sub_one h0d, ← prod_cyclotomic_eq_X_pow_sub_one h0n, mul_comm,
Finset.prod_sdiff (Nat.divisors_subset_of_dvd h0n.ne' hd)]
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd Polynomial.X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd
theorem X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd (R) [CommRing R] {d n : ℕ}
(h : d ∈ n.properDivisors) : (X ^ d - 1) * cyclotomic n R ∣ X ^ n - 1 := by
have hdn := (Nat.mem_properDivisors.mp h).2
use ∏ x ∈ n.properDivisors \ d.divisors, cyclotomic x R
symm
convert X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd R h using 1
rw [mul_assoc]
congr 1
rw [← Nat.insert_self_properDivisors hdn.ne_bot, insert_sdiff_of_not_mem, prod_insert]
· exact Finset.not_mem_sdiff_of_not_mem_left Nat.properDivisors.not_self_mem
· exact fun hk => hdn.not_le <| Nat.divisor_le hk
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd Polynomial.X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd
section Order
| Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean | 640 | 650 | theorem orderOf_root_cyclotomic_dvd {n : ℕ} (hpos : 0 < n) {p : ℕ} [Fact p.Prime] {a : ℕ}
(hroot : IsRoot (cyclotomic n (ZMod p)) (Nat.castRingHom (ZMod p) a)) :
orderOf (ZMod.unitOfCoprime a (coprime_of_root_cyclotomic hpos hroot)) ∣ n := by |
apply orderOf_dvd_of_pow_eq_one
suffices hpow : eval (Nat.castRingHom (ZMod p) a) (X ^ n - 1 : (ZMod p)[X]) = 0 by
simp only [eval_X, eval_one, eval_pow, eval_sub, eq_natCast] at hpow
apply Units.val_eq_one.1
simp only [sub_eq_zero.mp hpow, ZMod.coe_unitOfCoprime, Units.val_pow_eq_pow_val]
rw [IsRoot.def] at hroot
rw [← prod_cyclotomic_eq_X_pow_sub_one hpos (ZMod p), ← Nat.cons_self_properDivisors hpos.ne',
Finset.prod_cons, eval_mul, hroot, zero_mul]
|
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.Ideal.Prod
import Mathlib.RingTheory.Ideal.MinimalPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.Topology.Sets.Closeds
import Mathlib.Topology.Sober
#align_import algebraic_geometry.prime_spectrum.basic from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
noncomputable section
open scoped Classical
universe u v
variable (R : Type u) (S : Type v)
@[ext]
structure PrimeSpectrum [CommSemiring R] where
asIdeal : Ideal R
IsPrime : asIdeal.IsPrime
#align prime_spectrum PrimeSpectrum
attribute [instance] PrimeSpectrum.IsPrime
namespace PrimeSpectrum
section CommSemiRing
variable [CommSemiring R] [CommSemiring S]
variable {R S}
instance [Nontrivial R] : Nonempty <| PrimeSpectrum R :=
let ⟨I, hI⟩ := Ideal.exists_maximal R
⟨⟨I, hI.isPrime⟩⟩
instance [Subsingleton R] : IsEmpty (PrimeSpectrum R) :=
⟨fun x ↦ x.IsPrime.ne_top <| SetLike.ext' <| Subsingleton.eq_univ_of_nonempty x.asIdeal.nonempty⟩
#noalign prime_spectrum.punit
variable (R S)
@[simp]
def primeSpectrumProdOfSum : Sum (PrimeSpectrum R) (PrimeSpectrum S) → PrimeSpectrum (R × S)
| Sum.inl ⟨I, _⟩ => ⟨Ideal.prod I ⊤, Ideal.isPrime_ideal_prod_top⟩
| Sum.inr ⟨J, _⟩ => ⟨Ideal.prod ⊤ J, Ideal.isPrime_ideal_prod_top'⟩
#align prime_spectrum.prime_spectrum_prod_of_sum PrimeSpectrum.primeSpectrumProdOfSum
noncomputable def primeSpectrumProd :
PrimeSpectrum (R × S) ≃ Sum (PrimeSpectrum R) (PrimeSpectrum S) :=
Equiv.symm <|
Equiv.ofBijective (primeSpectrumProdOfSum R S) (by
constructor
· rintro (⟨I, hI⟩ | ⟨J, hJ⟩) (⟨I', hI'⟩ | ⟨J', hJ'⟩) h <;>
simp only [mk.injEq, Ideal.prod.ext_iff, primeSpectrumProdOfSum] at h
· simp only [h]
· exact False.elim (hI.ne_top h.left)
· exact False.elim (hJ.ne_top h.right)
· simp only [h]
· rintro ⟨I, hI⟩
rcases (Ideal.ideal_prod_prime I).mp hI with (⟨p, ⟨hp, rfl⟩⟩ | ⟨p, ⟨hp, rfl⟩⟩)
· exact ⟨Sum.inl ⟨p, hp⟩, rfl⟩
· exact ⟨Sum.inr ⟨p, hp⟩, rfl⟩)
#align prime_spectrum.prime_spectrum_prod PrimeSpectrum.primeSpectrumProd
variable {R S}
@[simp]
theorem primeSpectrumProd_symm_inl_asIdeal (x : PrimeSpectrum R) :
((primeSpectrumProd R S).symm <| Sum.inl x).asIdeal = Ideal.prod x.asIdeal ⊤ := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inl_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inl_asIdeal
@[simp]
theorem primeSpectrumProd_symm_inr_asIdeal (x : PrimeSpectrum S) :
((primeSpectrumProd R S).symm <| Sum.inr x).asIdeal = Ideal.prod ⊤ x.asIdeal := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inr_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inr_asIdeal
def zeroLocus (s : Set R) : Set (PrimeSpectrum R) :=
{ x | s ⊆ x.asIdeal }
#align prime_spectrum.zero_locus PrimeSpectrum.zeroLocus
@[simp]
theorem mem_zeroLocus (x : PrimeSpectrum R) (s : Set R) : x ∈ zeroLocus s ↔ s ⊆ x.asIdeal :=
Iff.rfl
#align prime_spectrum.mem_zero_locus PrimeSpectrum.mem_zeroLocus
@[simp]
theorem zeroLocus_span (s : Set R) : zeroLocus (Ideal.span s : Set R) = zeroLocus s := by
ext x
exact (Submodule.gi R R).gc s x.asIdeal
#align prime_spectrum.zero_locus_span PrimeSpectrum.zeroLocus_span
def vanishingIdeal (t : Set (PrimeSpectrum R)) : Ideal R :=
⨅ (x : PrimeSpectrum R) (_ : x ∈ t), x.asIdeal
#align prime_spectrum.vanishing_ideal PrimeSpectrum.vanishingIdeal
theorem coe_vanishingIdeal (t : Set (PrimeSpectrum R)) :
(vanishingIdeal t : Set R) = { f : R | ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal } := by
ext f
rw [vanishingIdeal, SetLike.mem_coe, Submodule.mem_iInf]
apply forall_congr'; intro x
rw [Submodule.mem_iInf]
#align prime_spectrum.coe_vanishing_ideal PrimeSpectrum.coe_vanishingIdeal
theorem mem_vanishingIdeal (t : Set (PrimeSpectrum R)) (f : R) :
f ∈ vanishingIdeal t ↔ ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal := by
rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq]
#align prime_spectrum.mem_vanishing_ideal PrimeSpectrum.mem_vanishingIdeal
@[simp]
theorem vanishingIdeal_singleton (x : PrimeSpectrum R) :
vanishingIdeal ({x} : Set (PrimeSpectrum R)) = x.asIdeal := by simp [vanishingIdeal]
#align prime_spectrum.vanishing_ideal_singleton PrimeSpectrum.vanishingIdeal_singleton
theorem subset_zeroLocus_iff_le_vanishingIdeal (t : Set (PrimeSpectrum R)) (I : Ideal R) :
t ⊆ zeroLocus I ↔ I ≤ vanishingIdeal t :=
⟨fun h _ k => (mem_vanishingIdeal _ _).mpr fun _ j => (mem_zeroLocus _ _).mpr (h j) k, fun h =>
fun x j => (mem_zeroLocus _ _).mpr (le_trans h fun _ h => ((mem_vanishingIdeal _ _).mp h) x j)⟩
#align prime_spectrum.subset_zero_locus_iff_le_vanishing_ideal PrimeSpectrum.subset_zeroLocus_iff_le_vanishingIdeal
theorem subset_vanishingIdeal_zeroLocus (s : Set R) : s ⊆ vanishingIdeal (zeroLocus s) :=
(gc_set R).le_u_l s
#align prime_spectrum.subset_vanishing_ideal_zero_locus PrimeSpectrum.subset_vanishingIdeal_zeroLocus
theorem le_vanishingIdeal_zeroLocus (I : Ideal R) : I ≤ vanishingIdeal (zeroLocus I) :=
(gc R).le_u_l I
#align prime_spectrum.le_vanishing_ideal_zero_locus PrimeSpectrum.le_vanishingIdeal_zeroLocus
@[simp]
theorem vanishingIdeal_zeroLocus_eq_radical (I : Ideal R) :
vanishingIdeal (zeroLocus (I : Set R)) = I.radical :=
Ideal.ext fun f => by
rw [mem_vanishingIdeal, Ideal.radical_eq_sInf, Submodule.mem_sInf]
exact ⟨fun h x hx => h ⟨x, hx.2⟩ hx.1, fun h x hx => h x.1 ⟨hx, x.2⟩⟩
#align prime_spectrum.vanishing_ideal_zero_locus_eq_radical PrimeSpectrum.vanishingIdeal_zeroLocus_eq_radical
@[simp]
theorem zeroLocus_radical (I : Ideal R) : zeroLocus (I.radical : Set R) = zeroLocus I :=
vanishingIdeal_zeroLocus_eq_radical I ▸ (gc R).l_u_l_eq_l I
#align prime_spectrum.zero_locus_radical PrimeSpectrum.zeroLocus_radical
theorem subset_zeroLocus_vanishingIdeal (t : Set (PrimeSpectrum R)) :
t ⊆ zeroLocus (vanishingIdeal t) :=
(gc R).l_u_le t
#align prime_spectrum.subset_zero_locus_vanishing_ideal PrimeSpectrum.subset_zeroLocus_vanishingIdeal
theorem zeroLocus_anti_mono {s t : Set R} (h : s ⊆ t) : zeroLocus t ⊆ zeroLocus s :=
(gc_set R).monotone_l h
#align prime_spectrum.zero_locus_anti_mono PrimeSpectrum.zeroLocus_anti_mono
theorem zeroLocus_anti_mono_ideal {s t : Ideal R} (h : s ≤ t) :
zeroLocus (t : Set R) ⊆ zeroLocus (s : Set R) :=
(gc R).monotone_l h
#align prime_spectrum.zero_locus_anti_mono_ideal PrimeSpectrum.zeroLocus_anti_mono_ideal
theorem vanishingIdeal_anti_mono {s t : Set (PrimeSpectrum R)} (h : s ⊆ t) :
vanishingIdeal t ≤ vanishingIdeal s :=
(gc R).monotone_u h
#align prime_spectrum.vanishing_ideal_anti_mono PrimeSpectrum.vanishingIdeal_anti_mono
theorem zeroLocus_subset_zeroLocus_iff (I J : Ideal R) :
zeroLocus (I : Set R) ⊆ zeroLocus (J : Set R) ↔ J ≤ I.radical := by
rw [subset_zeroLocus_iff_le_vanishingIdeal, vanishingIdeal_zeroLocus_eq_radical]
#align prime_spectrum.zero_locus_subset_zero_locus_iff PrimeSpectrum.zeroLocus_subset_zeroLocus_iff
theorem zeroLocus_subset_zeroLocus_singleton_iff (f g : R) :
zeroLocus ({f} : Set R) ⊆ zeroLocus {g} ↔ g ∈ (Ideal.span ({f} : Set R)).radical := by
rw [← zeroLocus_span {f}, ← zeroLocus_span {g}, zeroLocus_subset_zeroLocus_iff, Ideal.span_le,
Set.singleton_subset_iff, SetLike.mem_coe]
#align prime_spectrum.zero_locus_subset_zero_locus_singleton_iff PrimeSpectrum.zeroLocus_subset_zeroLocus_singleton_iff
theorem zeroLocus_bot : zeroLocus ((⊥ : Ideal R) : Set R) = Set.univ :=
(gc R).l_bot
#align prime_spectrum.zero_locus_bot PrimeSpectrum.zeroLocus_bot
@[simp]
theorem zeroLocus_singleton_zero : zeroLocus ({0} : Set R) = Set.univ :=
zeroLocus_bot
#align prime_spectrum.zero_locus_singleton_zero PrimeSpectrum.zeroLocus_singleton_zero
@[simp]
theorem zeroLocus_empty : zeroLocus (∅ : Set R) = Set.univ :=
(gc_set R).l_bot
#align prime_spectrum.zero_locus_empty PrimeSpectrum.zeroLocus_empty
@[simp]
theorem vanishingIdeal_univ : vanishingIdeal (∅ : Set (PrimeSpectrum R)) = ⊤ := by
simpa using (gc R).u_top
#align prime_spectrum.vanishing_ideal_univ PrimeSpectrum.vanishingIdeal_univ
theorem zeroLocus_empty_of_one_mem {s : Set R} (h : (1 : R) ∈ s) : zeroLocus s = ∅ := by
rw [Set.eq_empty_iff_forall_not_mem]
intro x hx
rw [mem_zeroLocus] at hx
have x_prime : x.asIdeal.IsPrime := by infer_instance
have eq_top : x.asIdeal = ⊤ := by
rw [Ideal.eq_top_iff_one]
exact hx h
apply x_prime.ne_top eq_top
#align prime_spectrum.zero_locus_empty_of_one_mem PrimeSpectrum.zeroLocus_empty_of_one_mem
@[simp]
theorem zeroLocus_singleton_one : zeroLocus ({1} : Set R) = ∅ :=
zeroLocus_empty_of_one_mem (Set.mem_singleton (1 : R))
#align prime_spectrum.zero_locus_singleton_one PrimeSpectrum.zeroLocus_singleton_one
theorem zeroLocus_empty_iff_eq_top {I : Ideal R} : zeroLocus (I : Set R) = ∅ ↔ I = ⊤ := by
constructor
· contrapose!
intro h
rcases Ideal.exists_le_maximal I h with ⟨M, hM, hIM⟩
exact ⟨⟨M, hM.isPrime⟩, hIM⟩
· rintro rfl
apply zeroLocus_empty_of_one_mem
trivial
#align prime_spectrum.zero_locus_empty_iff_eq_top PrimeSpectrum.zeroLocus_empty_iff_eq_top
@[simp]
theorem zeroLocus_univ : zeroLocus (Set.univ : Set R) = ∅ :=
zeroLocus_empty_of_one_mem (Set.mem_univ 1)
#align prime_spectrum.zero_locus_univ PrimeSpectrum.zeroLocus_univ
theorem vanishingIdeal_eq_top_iff {s : Set (PrimeSpectrum R)} : vanishingIdeal s = ⊤ ↔ s = ∅ := by
rw [← top_le_iff, ← subset_zeroLocus_iff_le_vanishingIdeal, Submodule.top_coe, zeroLocus_univ,
Set.subset_empty_iff]
#align prime_spectrum.vanishing_ideal_eq_top_iff PrimeSpectrum.vanishingIdeal_eq_top_iff
theorem zeroLocus_sup (I J : Ideal R) :
zeroLocus ((I ⊔ J : Ideal R) : Set R) = zeroLocus I ∩ zeroLocus J :=
(gc R).l_sup
#align prime_spectrum.zero_locus_sup PrimeSpectrum.zeroLocus_sup
theorem zeroLocus_union (s s' : Set R) : zeroLocus (s ∪ s') = zeroLocus s ∩ zeroLocus s' :=
(gc_set R).l_sup
#align prime_spectrum.zero_locus_union PrimeSpectrum.zeroLocus_union
theorem vanishingIdeal_union (t t' : Set (PrimeSpectrum R)) :
vanishingIdeal (t ∪ t') = vanishingIdeal t ⊓ vanishingIdeal t' :=
(gc R).u_inf
#align prime_spectrum.vanishing_ideal_union PrimeSpectrum.vanishingIdeal_union
theorem zeroLocus_iSup {ι : Sort*} (I : ι → Ideal R) :
zeroLocus ((⨆ i, I i : Ideal R) : Set R) = ⋂ i, zeroLocus (I i) :=
(gc R).l_iSup
#align prime_spectrum.zero_locus_supr PrimeSpectrum.zeroLocus_iSup
theorem zeroLocus_iUnion {ι : Sort*} (s : ι → Set R) :
zeroLocus (⋃ i, s i) = ⋂ i, zeroLocus (s i) :=
(gc_set R).l_iSup
#align prime_spectrum.zero_locus_Union PrimeSpectrum.zeroLocus_iUnion
theorem zeroLocus_bUnion (s : Set (Set R)) :
zeroLocus (⋃ s' ∈ s, s' : Set R) = ⋂ s' ∈ s, zeroLocus s' := by simp only [zeroLocus_iUnion]
#align prime_spectrum.zero_locus_bUnion PrimeSpectrum.zeroLocus_bUnion
theorem vanishingIdeal_iUnion {ι : Sort*} (t : ι → Set (PrimeSpectrum R)) :
vanishingIdeal (⋃ i, t i) = ⨅ i, vanishingIdeal (t i) :=
(gc R).u_iInf
#align prime_spectrum.vanishing_ideal_Union PrimeSpectrum.vanishingIdeal_iUnion
theorem zeroLocus_inf (I J : Ideal R) :
zeroLocus ((I ⊓ J : Ideal R) : Set R) = zeroLocus I ∪ zeroLocus J :=
Set.ext fun x => x.2.inf_le
#align prime_spectrum.zero_locus_inf PrimeSpectrum.zeroLocus_inf
theorem union_zeroLocus (s s' : Set R) :
zeroLocus s ∪ zeroLocus s' = zeroLocus (Ideal.span s ⊓ Ideal.span s' : Ideal R) := by
rw [zeroLocus_inf]
simp
#align prime_spectrum.union_zero_locus PrimeSpectrum.union_zeroLocus
theorem zeroLocus_mul (I J : Ideal R) :
zeroLocus ((I * J : Ideal R) : Set R) = zeroLocus I ∪ zeroLocus J :=
Set.ext fun x => x.2.mul_le
#align prime_spectrum.zero_locus_mul PrimeSpectrum.zeroLocus_mul
theorem zeroLocus_singleton_mul (f g : R) :
zeroLocus ({f * g} : Set R) = zeroLocus {f} ∪ zeroLocus {g} :=
Set.ext fun x => by simpa using x.2.mul_mem_iff_mem_or_mem
#align prime_spectrum.zero_locus_singleton_mul PrimeSpectrum.zeroLocus_singleton_mul
@[simp]
theorem zeroLocus_pow (I : Ideal R) {n : ℕ} (hn : n ≠ 0) :
zeroLocus ((I ^ n : Ideal R) : Set R) = zeroLocus I :=
zeroLocus_radical (I ^ n) ▸ (I.radical_pow hn).symm ▸ zeroLocus_radical I
#align prime_spectrum.zero_locus_pow PrimeSpectrum.zeroLocus_pow
@[simp]
theorem zeroLocus_singleton_pow (f : R) (n : ℕ) (hn : 0 < n) :
zeroLocus ({f ^ n} : Set R) = zeroLocus {f} :=
Set.ext fun x => by simpa using x.2.pow_mem_iff_mem n hn
#align prime_spectrum.zero_locus_singleton_pow PrimeSpectrum.zeroLocus_singleton_pow
theorem sup_vanishingIdeal_le (t t' : Set (PrimeSpectrum R)) :
vanishingIdeal t ⊔ vanishingIdeal t' ≤ vanishingIdeal (t ∩ t') := by
intro r
rw [Submodule.mem_sup, mem_vanishingIdeal]
rintro ⟨f, hf, g, hg, rfl⟩ x ⟨hxt, hxt'⟩
rw [mem_vanishingIdeal] at hf hg
apply Submodule.add_mem <;> solve_by_elim
#align prime_spectrum.sup_vanishing_ideal_le PrimeSpectrum.sup_vanishingIdeal_le
theorem mem_compl_zeroLocus_iff_not_mem {f : R} {I : PrimeSpectrum R} :
I ∈ (zeroLocus {f} : Set (PrimeSpectrum R))ᶜ ↔ f ∉ I.asIdeal := by
rw [Set.mem_compl_iff, mem_zeroLocus, Set.singleton_subset_iff]; rfl
#align prime_spectrum.mem_compl_zero_locus_iff_not_mem PrimeSpectrum.mem_compl_zeroLocus_iff_not_mem
instance zariskiTopology : TopologicalSpace (PrimeSpectrum R) :=
TopologicalSpace.ofClosed (Set.range PrimeSpectrum.zeroLocus) ⟨Set.univ, by simp⟩
(by
intro Zs h
rw [Set.sInter_eq_iInter]
choose f hf using fun i : Zs => h i.prop
simp only [← hf]
exact ⟨_, zeroLocus_iUnion _⟩)
(by
rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩
exact ⟨_, (union_zeroLocus s t).symm⟩)
#align prime_spectrum.zariski_topology PrimeSpectrum.zariskiTopology
theorem isOpen_iff (U : Set (PrimeSpectrum R)) : IsOpen U ↔ ∃ s, Uᶜ = zeroLocus s := by
simp only [@eq_comm _ Uᶜ]; rfl
#align prime_spectrum.is_open_iff PrimeSpectrum.isOpen_iff
theorem isClosed_iff_zeroLocus (Z : Set (PrimeSpectrum R)) : IsClosed Z ↔ ∃ s, Z = zeroLocus s := by
rw [← isOpen_compl_iff, isOpen_iff, compl_compl]
#align prime_spectrum.is_closed_iff_zero_locus PrimeSpectrum.isClosed_iff_zeroLocus
theorem isClosed_iff_zeroLocus_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, Z = zeroLocus I :=
(isClosed_iff_zeroLocus _).trans
⟨fun ⟨s, hs⟩ => ⟨_, (zeroLocus_span s).substr hs⟩, fun ⟨I, hI⟩ => ⟨I, hI⟩⟩
#align prime_spectrum.is_closed_iff_zero_locus_ideal PrimeSpectrum.isClosed_iff_zeroLocus_ideal
theorem isClosed_iff_zeroLocus_radical_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, I.IsRadical ∧ Z = zeroLocus I :=
(isClosed_iff_zeroLocus_ideal _).trans
⟨fun ⟨I, hI⟩ => ⟨_, I.radical_isRadical, (zeroLocus_radical I).substr hI⟩, fun ⟨I, _, hI⟩ =>
⟨I, hI⟩⟩
#align prime_spectrum.is_closed_iff_zero_locus_radical_ideal PrimeSpectrum.isClosed_iff_zeroLocus_radical_ideal
theorem isClosed_zeroLocus (s : Set R) : IsClosed (zeroLocus s) := by
rw [isClosed_iff_zeroLocus]
exact ⟨s, rfl⟩
#align prime_spectrum.is_closed_zero_locus PrimeSpectrum.isClosed_zeroLocus
theorem zeroLocus_vanishingIdeal_eq_closure (t : Set (PrimeSpectrum R)) :
zeroLocus (vanishingIdeal t : Set R) = closure t := by
rcases isClosed_iff_zeroLocus (closure t) |>.mp isClosed_closure with ⟨I, hI⟩
rw [subset_antisymm_iff, (isClosed_zeroLocus _).closure_subset_iff, hI,
subset_zeroLocus_iff_subset_vanishingIdeal, (gc R).u_l_u_eq_u,
← subset_zeroLocus_iff_subset_vanishingIdeal, ← hI]
exact ⟨subset_closure, subset_zeroLocus_vanishingIdeal t⟩
#align prime_spectrum.zero_locus_vanishing_ideal_eq_closure PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure
theorem vanishingIdeal_closure (t : Set (PrimeSpectrum R)) :
vanishingIdeal (closure t) = vanishingIdeal t :=
zeroLocus_vanishingIdeal_eq_closure t ▸ (gc R).u_l_u_eq_u t
#align prime_spectrum.vanishing_ideal_closure PrimeSpectrum.vanishingIdeal_closure
theorem closure_singleton (x) : closure ({x} : Set (PrimeSpectrum R)) = zeroLocus x.asIdeal := by
rw [← zeroLocus_vanishingIdeal_eq_closure, vanishingIdeal_singleton]
#align prime_spectrum.closure_singleton PrimeSpectrum.closure_singleton
theorem isClosed_singleton_iff_isMaximal (x : PrimeSpectrum R) :
IsClosed ({x} : Set (PrimeSpectrum R)) ↔ x.asIdeal.IsMaximal := by
rw [← closure_subset_iff_isClosed, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_singleton]
constructor <;> intro H
· rcases x.asIdeal.exists_le_maximal x.2.1 with ⟨m, hm, hxm⟩
exact (congr_arg asIdeal (@H ⟨m, hm.isPrime⟩ hxm)) ▸ hm
· exact fun p hp ↦ PrimeSpectrum.ext _ _ (H.eq_of_le p.2.1 hp).symm
#align prime_spectrum.is_closed_singleton_iff_is_maximal PrimeSpectrum.isClosed_singleton_iff_isMaximal
theorem isRadical_vanishingIdeal (s : Set (PrimeSpectrum R)) : (vanishingIdeal s).IsRadical := by
rw [← vanishingIdeal_closure, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_zeroLocus_eq_radical]
apply Ideal.radical_isRadical
#align prime_spectrum.is_radical_vanishing_ideal PrimeSpectrum.isRadical_vanishingIdeal
theorem vanishingIdeal_anti_mono_iff {s t : Set (PrimeSpectrum R)} (ht : IsClosed t) :
s ⊆ t ↔ vanishingIdeal t ≤ vanishingIdeal s :=
⟨vanishingIdeal_anti_mono, fun h => by
rw [← ht.closure_subset_iff, ← ht.closure_eq]
convert ← zeroLocus_anti_mono_ideal h <;> apply zeroLocus_vanishingIdeal_eq_closure⟩
#align prime_spectrum.vanishing_ideal_anti_mono_iff PrimeSpectrum.vanishingIdeal_anti_mono_iff
theorem vanishingIdeal_strict_anti_mono_iff {s t : Set (PrimeSpectrum R)} (hs : IsClosed s)
(ht : IsClosed t) : s ⊂ t ↔ vanishingIdeal t < vanishingIdeal s := by
rw [Set.ssubset_def, vanishingIdeal_anti_mono_iff hs, vanishingIdeal_anti_mono_iff ht,
lt_iff_le_not_le]
#align prime_spectrum.vanishing_ideal_strict_anti_mono_iff PrimeSpectrum.vanishingIdeal_strict_anti_mono_iff
def closedsEmbedding (R : Type*) [CommSemiring R] :
(TopologicalSpace.Closeds <| PrimeSpectrum R)ᵒᵈ ↪o Ideal R :=
OrderEmbedding.ofMapLEIff (fun s => vanishingIdeal ↑(OrderDual.ofDual s)) fun s _ =>
(vanishingIdeal_anti_mono_iff s.2).symm
#align prime_spectrum.closeds_embedding PrimeSpectrum.closedsEmbedding
theorem t1Space_iff_isField [IsDomain R] : T1Space (PrimeSpectrum R) ↔ IsField R := by
refine ⟨?_, fun h => ?_⟩
· intro h
have hbot : Ideal.IsPrime (⊥ : Ideal R) := Ideal.bot_prime
exact
Classical.not_not.1
(mt
(Ring.ne_bot_of_isMaximal_of_not_isField <|
(isClosed_singleton_iff_isMaximal _).1 (T1Space.t1 ⟨⊥, hbot⟩))
(by aesop))
· refine ⟨fun x => (isClosed_singleton_iff_isMaximal x).2 ?_⟩
by_cases hx : x.asIdeal = ⊥
· letI := h.toSemifield
exact hx.symm ▸ Ideal.bot_isMaximal
· exact absurd h (Ring.not_isField_iff_exists_prime.2 ⟨x.asIdeal, ⟨hx, x.2⟩⟩)
#align prime_spectrum.t1_space_iff_is_field PrimeSpectrum.t1Space_iff_isField
local notation "Z(" a ")" => zeroLocus (a : Set R)
theorem isIrreducible_zeroLocus_iff_of_radical (I : Ideal R) (hI : I.IsRadical) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.IsPrime := by
rw [Ideal.isPrime_iff, IsIrreducible]
apply and_congr
· rw [Set.nonempty_iff_ne_empty, Ne, zeroLocus_empty_iff_eq_top]
· trans ∀ x y : Ideal R, Z(I) ⊆ Z(x) ∪ Z(y) → Z(I) ⊆ Z(x) ∨ Z(I) ⊆ Z(y)
· simp_rw [isPreirreducible_iff_closed_union_closed, isClosed_iff_zeroLocus_ideal]
constructor
· rintro h x y
exact h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
· rintro h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
exact h x y
· simp_rw [← zeroLocus_inf, subset_zeroLocus_iff_le_vanishingIdeal,
vanishingIdeal_zeroLocus_eq_radical, hI.radical]
constructor
· simp_rw [← SetLike.mem_coe, ← Set.singleton_subset_iff, ← Ideal.span_le, ←
Ideal.span_singleton_mul_span_singleton]
refine fun h x y h' => h _ _ ?_
rw [← hI.radical_le_iff] at h' ⊢
simpa only [Ideal.radical_inf, Ideal.radical_mul] using h'
· simp_rw [or_iff_not_imp_left, SetLike.not_le_iff_exists]
rintro h s t h' ⟨x, hx, hx'⟩ y hy
exact h (h' ⟨Ideal.mul_mem_right _ _ hx, Ideal.mul_mem_left _ _ hy⟩) hx'
#align prime_spectrum.is_irreducible_zero_locus_iff_of_radical PrimeSpectrum.isIrreducible_zeroLocus_iff_of_radical
theorem isIrreducible_zeroLocus_iff (I : Ideal R) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.radical.IsPrime :=
zeroLocus_radical I ▸ isIrreducible_zeroLocus_iff_of_radical _ I.radical_isRadical
#align prime_spectrum.is_irreducible_zero_locus_iff PrimeSpectrum.isIrreducible_zeroLocus_iff
theorem isIrreducible_iff_vanishingIdeal_isPrime {s : Set (PrimeSpectrum R)} :
IsIrreducible s ↔ (vanishingIdeal s).IsPrime := by
rw [← isIrreducible_iff_closure, ← zeroLocus_vanishingIdeal_eq_closure,
isIrreducible_zeroLocus_iff_of_radical _ (isRadical_vanishingIdeal s)]
#align prime_spectrum.is_irreducible_iff_vanishing_ideal_is_prime PrimeSpectrum.isIrreducible_iff_vanishingIdeal_isPrime
lemma vanishingIdeal_isIrreducible :
vanishingIdeal (R := R) '' {s | IsIrreducible s} = {P | P.IsPrime} :=
Set.ext fun I ↦ ⟨fun ⟨_, hs, e⟩ ↦ e ▸ isIrreducible_iff_vanishingIdeal_isPrime.mp hs,
fun h ↦ ⟨zeroLocus I, (isIrreducible_zeroLocus_iff_of_radical _ h.isRadical).mpr h,
(vanishingIdeal_zeroLocus_eq_radical I).trans h.radical⟩⟩
lemma vanishingIdeal_isClosed_isIrreducible :
vanishingIdeal (R := R) '' {s | IsClosed s ∧ IsIrreducible s} = {P | P.IsPrime} := by
refine (subset_antisymm ?_ ?_).trans vanishingIdeal_isIrreducible
· exact Set.image_subset _ fun _ ↦ And.right
rintro _ ⟨s, hs, rfl⟩
exact ⟨closure s, ⟨isClosed_closure, hs.closure⟩, vanishingIdeal_closure s⟩
instance irreducibleSpace [IsDomain R] : IrreducibleSpace (PrimeSpectrum R) := by
rw [irreducibleSpace_def, Set.top_eq_univ, ← zeroLocus_bot, isIrreducible_zeroLocus_iff]
simpa using Ideal.bot_prime
instance quasiSober : QuasiSober (PrimeSpectrum R) :=
⟨fun {S} h₁ h₂ =>
⟨⟨_, isIrreducible_iff_vanishingIdeal_isPrime.1 h₁⟩, by
rw [IsGenericPoint, closure_singleton, zeroLocus_vanishingIdeal_eq_closure, h₂.closure_eq]⟩⟩
instance compactSpace : CompactSpace (PrimeSpectrum R) := by
refine compactSpace_of_finite_subfamily_closed fun S S_closed S_empty ↦ ?_
choose I hI using fun i ↦ (isClosed_iff_zeroLocus_ideal (S i)).mp (S_closed i)
simp_rw [hI, ← zeroLocus_iSup, zeroLocus_empty_iff_eq_top, ← top_le_iff] at S_empty ⊢
exact Ideal.isCompactElement_top.exists_finset_of_le_iSup _ _ S_empty
section CommSemiRing
variable [CommSemiring R] [CommSemiring S]
variable {R S}
section BasicOpen
def basicOpen (r : R) : TopologicalSpace.Opens (PrimeSpectrum R) where
carrier := { x | r ∉ x.asIdeal }
is_open' := ⟨{r}, Set.ext fun _ => Set.singleton_subset_iff.trans <| Classical.not_not.symm⟩
#align prime_spectrum.basic_open PrimeSpectrum.basicOpen
@[simp]
theorem mem_basicOpen (f : R) (x : PrimeSpectrum R) : x ∈ basicOpen f ↔ f ∉ x.asIdeal :=
Iff.rfl
#align prime_spectrum.mem_basic_open PrimeSpectrum.mem_basicOpen
theorem isOpen_basicOpen {a : R} : IsOpen (basicOpen a : Set (PrimeSpectrum R)) :=
(basicOpen a).isOpen
#align prime_spectrum.is_open_basic_open PrimeSpectrum.isOpen_basicOpen
@[simp]
theorem basicOpen_eq_zeroLocus_compl (r : R) :
(basicOpen r : Set (PrimeSpectrum R)) = (zeroLocus {r})ᶜ :=
Set.ext fun x => by simp only [SetLike.mem_coe, mem_basicOpen, Set.mem_compl_iff, mem_zeroLocus,
Set.singleton_subset_iff]
#align prime_spectrum.basic_open_eq_zero_locus_compl PrimeSpectrum.basicOpen_eq_zeroLocus_compl
@[simp]
theorem basicOpen_one : basicOpen (1 : R) = ⊤ :=
TopologicalSpace.Opens.ext <| by simp
#align prime_spectrum.basic_open_one PrimeSpectrum.basicOpen_one
@[simp]
theorem basicOpen_zero : basicOpen (0 : R) = ⊥ :=
TopologicalSpace.Opens.ext <| by simp
#align prime_spectrum.basic_open_zero PrimeSpectrum.basicOpen_zero
theorem basicOpen_le_basicOpen_iff (f g : R) :
basicOpen f ≤ basicOpen g ↔ f ∈ (Ideal.span ({g} : Set R)).radical := by
rw [← SetLike.coe_subset_coe, basicOpen_eq_zeroLocus_compl, basicOpen_eq_zeroLocus_compl,
Set.compl_subset_compl, zeroLocus_subset_zeroLocus_singleton_iff]
#align prime_spectrum.basic_open_le_basic_open_iff PrimeSpectrum.basicOpen_le_basicOpen_iff
theorem basicOpen_mul (f g : R) : basicOpen (f * g) = basicOpen f ⊓ basicOpen g :=
TopologicalSpace.Opens.ext <| by simp [zeroLocus_singleton_mul]
#align prime_spectrum.basic_open_mul PrimeSpectrum.basicOpen_mul
theorem basicOpen_mul_le_left (f g : R) : basicOpen (f * g) ≤ basicOpen f := by
rw [basicOpen_mul f g]
exact inf_le_left
#align prime_spectrum.basic_open_mul_le_left PrimeSpectrum.basicOpen_mul_le_left
theorem basicOpen_mul_le_right (f g : R) : basicOpen (f * g) ≤ basicOpen g := by
rw [basicOpen_mul f g]
exact inf_le_right
#align prime_spectrum.basic_open_mul_le_right PrimeSpectrum.basicOpen_mul_le_right
@[simp]
theorem basicOpen_pow (f : R) (n : ℕ) (hn : 0 < n) : basicOpen (f ^ n) = basicOpen f :=
TopologicalSpace.Opens.ext <| by simpa using zeroLocus_singleton_pow f n hn
#align prime_spectrum.basic_open_pow PrimeSpectrum.basicOpen_pow
theorem isTopologicalBasis_basic_opens :
TopologicalSpace.IsTopologicalBasis
(Set.range fun r : R => (basicOpen r : Set (PrimeSpectrum R))) := by
apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
· rintro _ ⟨r, rfl⟩
exact isOpen_basicOpen
· rintro p U hp ⟨s, hs⟩
rw [← compl_compl U, Set.mem_compl_iff, ← hs, mem_zeroLocus, Set.not_subset] at hp
obtain ⟨f, hfs, hfp⟩ := hp
refine ⟨basicOpen f, ⟨f, rfl⟩, hfp, ?_⟩
rw [← Set.compl_subset_compl, ← hs, basicOpen_eq_zeroLocus_compl, compl_compl]
exact zeroLocus_anti_mono (Set.singleton_subset_iff.mpr hfs)
#align prime_spectrum.is_topological_basis_basic_opens PrimeSpectrum.isTopologicalBasis_basic_opens
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Basic.lean | 847 | 851 | theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by |
unfold TopologicalSpace.Opens.IsBasis
convert isTopologicalBasis_basic_opens (R := R)
rw [← Set.range_comp]
rfl
|
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]
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]
#align to_Ioc_mod_sub_self toIocMod_sub_self
@[simp]
theorem self_sub_toIcoMod (a b : α) : b - toIcoMod hp a b = toIcoDiv hp a b • p := by
rw [toIcoMod, sub_sub_cancel]
#align self_sub_to_Ico_mod self_sub_toIcoMod
@[simp]
theorem self_sub_toIocMod (a b : α) : b - toIocMod hp a b = toIocDiv hp a b • p := by
rw [toIocMod, sub_sub_cancel]
#align self_sub_to_Ioc_mod self_sub_toIocMod
@[simp]
theorem toIcoMod_add_toIcoDiv_zsmul (a b : α) : toIcoMod hp a b + toIcoDiv hp a b • p = b := by
rw [toIcoMod, sub_add_cancel]
#align to_Ico_mod_add_to_Ico_div_zsmul toIcoMod_add_toIcoDiv_zsmul
@[simp]
| Mathlib/Algebra/Order/ToIntervalMod.lean | 158 | 159 | theorem toIocMod_add_toIocDiv_zsmul (a b : α) : toIocMod hp a b + toIocDiv hp a b • p = b := by |
rw [toIocMod, sub_add_cancel]
|
import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp
#align_import measure_theory.integral.set_to_l1 from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology NNReal ENNReal MeasureTheory Pointwise
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {α E F F' G 𝕜 : Type*} {p : ℝ≥0∞} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F']
[NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α}
local infixr:25 " →ₛ " => SimpleFunc
open Finset
def DominatedFinMeasAdditive {β} [SeminormedAddCommGroup β] {_ : MeasurableSpace α} (μ : Measure α)
(T : Set α → β) (C : ℝ) : Prop :=
FinMeasAdditive μ T ∧ ∀ s, MeasurableSet s → μ s < ∞ → ‖T s‖ ≤ C * (μ s).toReal
#align measure_theory.dominated_fin_meas_additive MeasureTheory.DominatedFinMeasAdditive
namespace DominatedFinMeasAdditive
variable {β : Type*} [SeminormedAddCommGroup β] {T T' : Set α → β} {C C' : ℝ}
theorem zero {m : MeasurableSpace α} (μ : Measure α) (hC : 0 ≤ C) :
DominatedFinMeasAdditive μ (0 : Set α → β) C := by
refine ⟨FinMeasAdditive.zero, fun s _ _ => ?_⟩
rw [Pi.zero_apply, norm_zero]
exact mul_nonneg hC toReal_nonneg
#align measure_theory.dominated_fin_meas_additive.zero MeasureTheory.DominatedFinMeasAdditive.zero
theorem eq_zero_of_measure_zero {β : Type*} [NormedAddCommGroup β] {T : Set α → β} {C : ℝ}
(hT : DominatedFinMeasAdditive μ T C) {s : Set α} (hs : MeasurableSet s) (hs_zero : μ s = 0) :
T s = 0 := by
refine norm_eq_zero.mp ?_
refine ((hT.2 s hs (by simp [hs_zero])).trans (le_of_eq ?_)).antisymm (norm_nonneg _)
rw [hs_zero, ENNReal.zero_toReal, mul_zero]
#align measure_theory.dominated_fin_meas_additive.eq_zero_of_measure_zero MeasureTheory.DominatedFinMeasAdditive.eq_zero_of_measure_zero
theorem eq_zero {β : Type*} [NormedAddCommGroup β] {T : Set α → β} {C : ℝ} {m : MeasurableSpace α}
(hT : DominatedFinMeasAdditive (0 : Measure α) T C) {s : Set α} (hs : MeasurableSet s) :
T s = 0 :=
eq_zero_of_measure_zero hT hs (by simp only [Measure.coe_zero, Pi.zero_apply])
#align measure_theory.dominated_fin_meas_additive.eq_zero MeasureTheory.DominatedFinMeasAdditive.eq_zero
theorem add (hT : DominatedFinMeasAdditive μ T C) (hT' : DominatedFinMeasAdditive μ T' C') :
DominatedFinMeasAdditive μ (T + T') (C + C') := by
refine ⟨hT.1.add hT'.1, fun s hs hμs => ?_⟩
rw [Pi.add_apply, add_mul]
exact (norm_add_le _ _).trans (add_le_add (hT.2 s hs hμs) (hT'.2 s hs hμs))
#align measure_theory.dominated_fin_meas_additive.add MeasureTheory.DominatedFinMeasAdditive.add
theorem smul [NormedField 𝕜] [NormedSpace 𝕜 β] (hT : DominatedFinMeasAdditive μ T C) (c : 𝕜) :
DominatedFinMeasAdditive μ (fun s => c • T s) (‖c‖ * C) := by
refine ⟨hT.1.smul c, fun s hs hμs => ?_⟩
dsimp only
rw [norm_smul, mul_assoc]
exact mul_le_mul le_rfl (hT.2 s hs hμs) (norm_nonneg _) (norm_nonneg _)
#align measure_theory.dominated_fin_meas_additive.smul MeasureTheory.DominatedFinMeasAdditive.smul
| Mathlib/MeasureTheory/Integral/SetToL1.lean | 231 | 238 | theorem of_measure_le {μ' : Measure α} (h : μ ≤ μ') (hT : DominatedFinMeasAdditive μ T C)
(hC : 0 ≤ C) : DominatedFinMeasAdditive μ' T C := by |
have h' : ∀ s, μ s = ∞ → μ' s = ∞ := fun s hs ↦ top_unique <| hs.symm.trans_le (h _)
refine ⟨hT.1.of_eq_top_imp_eq_top fun s _ ↦ h' s, fun s hs hμ's ↦ ?_⟩
have hμs : μ s < ∞ := (h s).trans_lt hμ's
calc
‖T s‖ ≤ C * (μ s).toReal := hT.2 s hs hμs
_ ≤ C * (μ' s).toReal := by gcongr; exacts [hμ's.ne, h _]
|
import Mathlib.CategoryTheory.Abelian.Basic
#align_import category_theory.idempotents.basic from "leanprover-community/mathlib"@"3a061790136d13594ec10c7c90d202335ac5d854"
open CategoryTheory
open CategoryTheory.Category
open CategoryTheory.Limits
open CategoryTheory.Preadditive
open Opposite
namespace CategoryTheory
variable (C : Type*) [Category C]
class IsIdempotentComplete : Prop where
idempotents_split :
∀ (X : C) (p : X ⟶ X), p ≫ p = p → ∃ (Y : C) (i : Y ⟶ X) (e : X ⟶ Y), i ≫ e = 𝟙 Y ∧ e ≫ i = p
#align category_theory.is_idempotent_complete CategoryTheory.IsIdempotentComplete
namespace Idempotents
theorem isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent :
IsIdempotentComplete C ↔ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p := by
constructor
· intro
intro X p hp
rcases IsIdempotentComplete.idempotents_split X p hp with ⟨Y, i, e, ⟨h₁, h₂⟩⟩
exact
⟨Nonempty.intro
{ cone := Fork.ofι i (show i ≫ 𝟙 X = i ≫ p by rw [comp_id, ← h₂, ← assoc, h₁, id_comp])
isLimit := by
apply Fork.IsLimit.mk'
intro s
refine ⟨s.ι ≫ e, ?_⟩
constructor
· erw [assoc, h₂, ← Limits.Fork.condition s, comp_id]
· intro m hm
rw [Fork.ι_ofι] at hm
rw [← hm]
simp only [← hm, assoc, h₁]
exact (comp_id m).symm }⟩
· intro h
refine ⟨?_⟩
intro X p hp
haveI : HasEqualizer (𝟙 X) p := h X p hp
refine ⟨equalizer (𝟙 X) p, equalizer.ι (𝟙 X) p,
equalizer.lift p (show p ≫ 𝟙 X = p ≫ p by rw [hp, comp_id]), ?_, equalizer.lift_ι _ _⟩
ext
simp only [assoc, limit.lift_π, Eq.ndrec, id_eq, eq_mpr_eq_cast, Fork.ofι_pt,
Fork.ofι_π_app, id_comp]
rw [← equalizer.condition, comp_id]
#align category_theory.idempotents.is_idempotent_complete_iff_has_equalizer_of_id_and_idempotent CategoryTheory.Idempotents.isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent
variable {C}
| Mathlib/CategoryTheory/Idempotents/Basic.lean | 99 | 101 | theorem idem_of_id_sub_idem [Preadditive C] {X : C} (p : X ⟶ X) (hp : p ≫ p = p) :
(𝟙 _ - p) ≫ (𝟙 _ - p) = 𝟙 _ - p := by |
simp only [comp_sub, sub_comp, id_comp, comp_id, hp, sub_self, sub_zero]
|
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 α}
theorem IsBigOWith.isBigO (h : IsBigOWith c l f g) : f =O[l] g := by rw [IsBigO_def]; exact ⟨c, h⟩
#align asymptotics.is_O_with.is_O Asymptotics.IsBigOWith.isBigO
theorem IsLittleO.isBigOWith (hgf : f =o[l] g) : IsBigOWith 1 l f g :=
hgf.def' zero_lt_one
#align asymptotics.is_o.is_O_with Asymptotics.IsLittleO.isBigOWith
theorem IsLittleO.isBigO (hgf : f =o[l] g) : f =O[l] g :=
hgf.isBigOWith.isBigO
#align asymptotics.is_o.is_O Asymptotics.IsLittleO.isBigO
theorem IsBigO.isBigOWith : f =O[l] g → ∃ c : ℝ, IsBigOWith c l f g :=
isBigO_iff_isBigOWith.1
#align asymptotics.is_O.is_O_with Asymptotics.IsBigO.isBigOWith
theorem IsBigOWith.weaken (h : IsBigOWith c l f g') (hc : c ≤ c') : IsBigOWith c' l f g' :=
IsBigOWith.of_bound <|
mem_of_superset h.bound fun x hx =>
calc
‖f x‖ ≤ c * ‖g' x‖ := hx
_ ≤ _ := by gcongr
#align asymptotics.is_O_with.weaken Asymptotics.IsBigOWith.weaken
theorem IsBigOWith.exists_pos (h : IsBigOWith c l f g') :
∃ c' > 0, IsBigOWith c' l f g' :=
⟨max c 1, lt_of_lt_of_le zero_lt_one (le_max_right c 1), h.weaken <| le_max_left c 1⟩
#align asymptotics.is_O_with.exists_pos Asymptotics.IsBigOWith.exists_pos
theorem IsBigO.exists_pos (h : f =O[l] g') : ∃ c > 0, IsBigOWith c l f g' :=
let ⟨_c, hc⟩ := h.isBigOWith
hc.exists_pos
#align asymptotics.is_O.exists_pos Asymptotics.IsBigO.exists_pos
theorem IsBigOWith.exists_nonneg (h : IsBigOWith c l f g') :
∃ c' ≥ 0, IsBigOWith c' l f g' :=
let ⟨c, cpos, hc⟩ := h.exists_pos
⟨c, le_of_lt cpos, hc⟩
#align asymptotics.is_O_with.exists_nonneg Asymptotics.IsBigOWith.exists_nonneg
theorem IsBigO.exists_nonneg (h : f =O[l] g') : ∃ c ≥ 0, IsBigOWith c l f g' :=
let ⟨_c, hc⟩ := h.isBigOWith
hc.exists_nonneg
#align asymptotics.is_O.exists_nonneg Asymptotics.IsBigO.exists_nonneg
theorem isBigO_iff_eventually_isBigOWith : f =O[l] g' ↔ ∀ᶠ c in atTop, IsBigOWith c l f g' :=
isBigO_iff_isBigOWith.trans
⟨fun ⟨c, hc⟩ => mem_atTop_sets.2 ⟨c, fun _c' hc' => hc.weaken hc'⟩, fun h => h.exists⟩
#align asymptotics.is_O_iff_eventually_is_O_with Asymptotics.isBigO_iff_eventually_isBigOWith
theorem isBigO_iff_eventually : f =O[l] g' ↔ ∀ᶠ c in atTop, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g' x‖ :=
isBigO_iff_eventually_isBigOWith.trans <| by simp only [IsBigOWith_def]
#align asymptotics.is_O_iff_eventually Asymptotics.isBigO_iff_eventually
theorem IsBigO.exists_mem_basis {ι} {p : ι → Prop} {s : ι → Set α} (h : f =O[l] g')
(hb : l.HasBasis p s) :
∃ c > 0, ∃ i : ι, p i ∧ ∀ x ∈ s i, ‖f x‖ ≤ c * ‖g' x‖ :=
flip Exists.imp h.exists_pos fun c h => by
simpa only [isBigOWith_iff, hb.eventually_iff, exists_prop] using h
#align asymptotics.is_O.exists_mem_basis Asymptotics.IsBigO.exists_mem_basis
theorem isBigOWith_inv (hc : 0 < c) : IsBigOWith c⁻¹ l f g ↔ ∀ᶠ x in l, c * ‖f x‖ ≤ ‖g x‖ := by
simp only [IsBigOWith_def, ← div_eq_inv_mul, le_div_iff' hc]
#align asymptotics.is_O_with_inv Asymptotics.isBigOWith_inv
-- We prove this lemma with strange assumptions to get two lemmas below automatically
theorem isLittleO_iff_nat_mul_le_aux (h₀ : (∀ x, 0 ≤ ‖f x‖) ∨ ∀ x, 0 ≤ ‖g x‖) :
f =o[l] g ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f x‖ ≤ ‖g x‖ := by
constructor
· rintro H (_ | n)
· refine (H.def one_pos).mono fun x h₀' => ?_
rw [Nat.cast_zero, zero_mul]
refine h₀.elim (fun hf => (hf x).trans ?_) fun hg => hg x
rwa [one_mul] at h₀'
· have : (0 : ℝ) < n.succ := Nat.cast_pos.2 n.succ_pos
exact (isBigOWith_inv this).1 (H.def' <| inv_pos.2 this)
· refine fun H => isLittleO_iff.2 fun ε ε0 => ?_
rcases exists_nat_gt ε⁻¹ with ⟨n, hn⟩
have hn₀ : (0 : ℝ) < n := (inv_pos.2 ε0).trans hn
refine ((isBigOWith_inv hn₀).2 (H n)).bound.mono fun x hfg => ?_
refine hfg.trans (mul_le_mul_of_nonneg_right (inv_le_of_inv_le ε0 hn.le) ?_)
refine h₀.elim (fun hf => nonneg_of_mul_nonneg_right ((hf x).trans hfg) ?_) fun h => h x
exact inv_pos.2 hn₀
#align asymptotics.is_o_iff_nat_mul_le_aux Asymptotics.isLittleO_iff_nat_mul_le_aux
theorem isLittleO_iff_nat_mul_le : f =o[l] g' ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f x‖ ≤ ‖g' x‖ :=
isLittleO_iff_nat_mul_le_aux (Or.inr fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le Asymptotics.isLittleO_iff_nat_mul_le
theorem isLittleO_iff_nat_mul_le' : f' =o[l] g ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖f' x‖ ≤ ‖g x‖ :=
isLittleO_iff_nat_mul_le_aux (Or.inl fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le' Asymptotics.isLittleO_iff_nat_mul_le'
@[nontriviality]
theorem isLittleO_of_subsingleton [Subsingleton E'] : f' =o[l] g' :=
IsLittleO.of_bound fun c hc => by simp [Subsingleton.elim (f' _) 0, mul_nonneg hc.le]
#align asymptotics.is_o_of_subsingleton Asymptotics.isLittleO_of_subsingleton
@[nontriviality]
theorem isBigO_of_subsingleton [Subsingleton E'] : f' =O[l] g' :=
isLittleO_of_subsingleton.isBigO
#align asymptotics.is_O_of_subsingleton Asymptotics.isBigO_of_subsingleton
theorem IsBigOWith.comp_tendsto (hcfg : IsBigOWith c l f g) {k : β → α} {l' : Filter β}
(hk : Tendsto k l' l) : IsBigOWith c l' (f ∘ k) (g ∘ k) :=
IsBigOWith.of_bound <| hk hcfg.bound
#align asymptotics.is_O_with.comp_tendsto Asymptotics.IsBigOWith.comp_tendsto
theorem IsBigO.comp_tendsto (hfg : f =O[l] g) {k : β → α} {l' : Filter β} (hk : Tendsto k l' l) :
(f ∘ k) =O[l'] (g ∘ k) :=
isBigO_iff_isBigOWith.2 <| hfg.isBigOWith.imp fun _c h => h.comp_tendsto hk
#align asymptotics.is_O.comp_tendsto Asymptotics.IsBigO.comp_tendsto
theorem IsLittleO.comp_tendsto (hfg : f =o[l] g) {k : β → α} {l' : Filter β} (hk : Tendsto k l' l) :
(f ∘ k) =o[l'] (g ∘ k) :=
IsLittleO.of_isBigOWith fun _c cpos => (hfg.forall_isBigOWith cpos).comp_tendsto hk
#align asymptotics.is_o.comp_tendsto Asymptotics.IsLittleO.comp_tendsto
@[simp]
theorem isBigOWith_map {k : β → α} {l : Filter β} :
IsBigOWith c (map k l) f g ↔ IsBigOWith c l (f ∘ k) (g ∘ k) := by
simp only [IsBigOWith_def]
exact eventually_map
#align asymptotics.is_O_with_map Asymptotics.isBigOWith_map
@[simp]
theorem isBigO_map {k : β → α} {l : Filter β} : f =O[map k l] g ↔ (f ∘ k) =O[l] (g ∘ k) := by
simp only [IsBigO_def, isBigOWith_map]
#align asymptotics.is_O_map Asymptotics.isBigO_map
@[simp]
theorem isLittleO_map {k : β → α} {l : Filter β} : f =o[map k l] g ↔ (f ∘ k) =o[l] (g ∘ k) := by
simp only [IsLittleO_def, isBigOWith_map]
#align asymptotics.is_o_map Asymptotics.isLittleO_map
theorem IsBigOWith.mono (h : IsBigOWith c l' f g) (hl : l ≤ l') : IsBigOWith c l f g :=
IsBigOWith.of_bound <| hl h.bound
#align asymptotics.is_O_with.mono Asymptotics.IsBigOWith.mono
theorem IsBigO.mono (h : f =O[l'] g) (hl : l ≤ l') : f =O[l] g :=
isBigO_iff_isBigOWith.2 <| h.isBigOWith.imp fun _c h => h.mono hl
#align asymptotics.is_O.mono Asymptotics.IsBigO.mono
theorem IsLittleO.mono (h : f =o[l'] g) (hl : l ≤ l') : f =o[l] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).mono hl
#align asymptotics.is_o.mono Asymptotics.IsLittleO.mono
theorem IsBigOWith.trans (hfg : IsBigOWith c l f g) (hgk : IsBigOWith c' l g k) (hc : 0 ≤ c) :
IsBigOWith (c * c') l f k := by
simp only [IsBigOWith_def] at *
filter_upwards [hfg, hgk] with x hx hx'
calc
‖f x‖ ≤ c * ‖g x‖ := hx
_ ≤ c * (c' * ‖k x‖) := by gcongr
_ = c * c' * ‖k x‖ := (mul_assoc _ _ _).symm
#align asymptotics.is_O_with.trans Asymptotics.IsBigOWith.trans
@[trans]
theorem IsBigO.trans {f : α → E} {g : α → F'} {k : α → G} (hfg : f =O[l] g) (hgk : g =O[l] k) :
f =O[l] k :=
let ⟨_c, cnonneg, hc⟩ := hfg.exists_nonneg
let ⟨_c', hc'⟩ := hgk.isBigOWith
(hc.trans hc' cnonneg).isBigO
#align asymptotics.is_O.trans Asymptotics.IsBigO.trans
instance transIsBigOIsBigO :
@Trans (α → E) (α → F') (α → G) (· =O[l] ·) (· =O[l] ·) (· =O[l] ·) where
trans := IsBigO.trans
theorem IsLittleO.trans_isBigOWith (hfg : f =o[l] g) (hgk : IsBigOWith c l g k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact ((hfg this).trans hgk this.le).congr_const (div_mul_cancel₀ _ hc.ne')
#align asymptotics.is_o.trans_is_O_with Asymptotics.IsLittleO.trans_isBigOWith
@[trans]
theorem IsLittleO.trans_isBigO {f : α → E} {g : α → F} {k : α → G'} (hfg : f =o[l] g)
(hgk : g =O[l] k) : f =o[l] k :=
let ⟨_c, cpos, hc⟩ := hgk.exists_pos
hfg.trans_isBigOWith hc cpos
#align asymptotics.is_o.trans_is_O Asymptotics.IsLittleO.trans_isBigO
instance transIsLittleOIsBigO :
@Trans (α → E) (α → F) (α → G') (· =o[l] ·) (· =O[l] ·) (· =o[l] ·) where
trans := IsLittleO.trans_isBigO
theorem IsBigOWith.trans_isLittleO (hfg : IsBigOWith c l f g) (hgk : g =o[l] k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact (hfg.trans (hgk this) hc.le).congr_const (mul_div_cancel₀ _ hc.ne')
#align asymptotics.is_O_with.trans_is_o Asymptotics.IsBigOWith.trans_isLittleO
@[trans]
theorem IsBigO.trans_isLittleO {f : α → E} {g : α → F'} {k : α → G} (hfg : f =O[l] g)
(hgk : g =o[l] k) : f =o[l] k :=
let ⟨_c, cpos, hc⟩ := hfg.exists_pos
hc.trans_isLittleO hgk cpos
#align asymptotics.is_O.trans_is_o Asymptotics.IsBigO.trans_isLittleO
instance transIsBigOIsLittleO :
@Trans (α → E) (α → F') (α → G) (· =O[l] ·) (· =o[l] ·) (· =o[l] ·) where
trans := IsBigO.trans_isLittleO
@[trans]
theorem IsLittleO.trans {f : α → E} {g : α → F} {k : α → G} (hfg : f =o[l] g) (hgk : g =o[l] k) :
f =o[l] k :=
hfg.trans_isBigOWith hgk.isBigOWith one_pos
#align asymptotics.is_o.trans Asymptotics.IsLittleO.trans
instance transIsLittleOIsLittleO :
@Trans (α → E) (α → F) (α → G) (· =o[l] ·) (· =o[l] ·) (· =o[l] ·) where
trans := IsLittleO.trans
theorem _root_.Filter.Eventually.trans_isBigO {f : α → E} {g : α → F'} {k : α → G}
(hfg : ∀ᶠ x in l, ‖f x‖ ≤ ‖g x‖) (hgk : g =O[l] k) : f =O[l] k :=
(IsBigO.of_bound' hfg).trans hgk
#align filter.eventually.trans_is_O Filter.Eventually.trans_isBigO
theorem _root_.Filter.Eventually.isBigO {f : α → E} {g : α → ℝ} {l : Filter α}
(hfg : ∀ᶠ x in l, ‖f x‖ ≤ g x) : f =O[l] g :=
IsBigO.of_bound' <| hfg.mono fun _x hx => hx.trans <| Real.le_norm_self _
#align filter.eventually.is_O Filter.Eventually.isBigO
section
variable (l)
theorem isBigOWith_of_le' (hfg : ∀ x, ‖f x‖ ≤ c * ‖g x‖) : IsBigOWith c l f g :=
IsBigOWith.of_bound <| univ_mem' hfg
#align asymptotics.is_O_with_of_le' Asymptotics.isBigOWith_of_le'
theorem isBigOWith_of_le (hfg : ∀ x, ‖f x‖ ≤ ‖g x‖) : IsBigOWith 1 l f g :=
isBigOWith_of_le' l fun x => by
rw [one_mul]
exact hfg x
#align asymptotics.is_O_with_of_le Asymptotics.isBigOWith_of_le
theorem isBigO_of_le' (hfg : ∀ x, ‖f x‖ ≤ c * ‖g x‖) : f =O[l] g :=
(isBigOWith_of_le' l hfg).isBigO
#align asymptotics.is_O_of_le' Asymptotics.isBigO_of_le'
theorem isBigO_of_le (hfg : ∀ x, ‖f x‖ ≤ ‖g x‖) : f =O[l] g :=
(isBigOWith_of_le l hfg).isBigO
#align asymptotics.is_O_of_le Asymptotics.isBigO_of_le
end
theorem isBigOWith_refl (f : α → E) (l : Filter α) : IsBigOWith 1 l f f :=
isBigOWith_of_le l fun _ => le_rfl
#align asymptotics.is_O_with_refl Asymptotics.isBigOWith_refl
theorem isBigO_refl (f : α → E) (l : Filter α) : f =O[l] f :=
(isBigOWith_refl f l).isBigO
#align asymptotics.is_O_refl Asymptotics.isBigO_refl
theorem _root_.Filter.EventuallyEq.isBigO {f₁ f₂ : α → E} (hf : f₁ =ᶠ[l] f₂) : f₁ =O[l] f₂ :=
hf.trans_isBigO (isBigO_refl _ _)
theorem IsBigOWith.trans_le (hfg : IsBigOWith c l f g) (hgk : ∀ x, ‖g x‖ ≤ ‖k x‖) (hc : 0 ≤ c) :
IsBigOWith c l f k :=
(hfg.trans (isBigOWith_of_le l hgk) hc).congr_const <| mul_one c
#align asymptotics.is_O_with.trans_le Asymptotics.IsBigOWith.trans_le
theorem IsBigO.trans_le (hfg : f =O[l] g') (hgk : ∀ x, ‖g' x‖ ≤ ‖k x‖) : f =O[l] k :=
hfg.trans (isBigO_of_le l hgk)
#align asymptotics.is_O.trans_le Asymptotics.IsBigO.trans_le
theorem IsLittleO.trans_le (hfg : f =o[l] g) (hgk : ∀ x, ‖g x‖ ≤ ‖k x‖) : f =o[l] k :=
hfg.trans_isBigOWith (isBigOWith_of_le _ hgk) zero_lt_one
#align asymptotics.is_o.trans_le Asymptotics.IsLittleO.trans_le
theorem isLittleO_irrefl' (h : ∃ᶠ x in l, ‖f' x‖ ≠ 0) : ¬f' =o[l] f' := by
intro ho
rcases ((ho.bound one_half_pos).and_frequently h).exists with ⟨x, hle, hne⟩
rw [one_div, ← div_eq_inv_mul] at hle
exact (half_lt_self (lt_of_le_of_ne (norm_nonneg _) hne.symm)).not_le hle
#align asymptotics.is_o_irrefl' Asymptotics.isLittleO_irrefl'
theorem isLittleO_irrefl (h : ∃ᶠ x in l, f'' x ≠ 0) : ¬f'' =o[l] f'' :=
isLittleO_irrefl' <| h.mono fun _x => norm_ne_zero_iff.mpr
#align asymptotics.is_o_irrefl Asymptotics.isLittleO_irrefl
theorem IsBigO.not_isLittleO (h : f'' =O[l] g') (hf : ∃ᶠ x in l, f'' x ≠ 0) :
¬g' =o[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isLittleO h')
#align asymptotics.is_O.not_is_o Asymptotics.IsBigO.not_isLittleO
theorem IsLittleO.not_isBigO (h : f'' =o[l] g') (hf : ∃ᶠ x in l, f'' x ≠ 0) :
¬g' =O[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isBigO h')
#align asymptotics.is_o.not_is_O Asymptotics.IsLittleO.not_isBigO
@[simp]
theorem isBigOWith_pure {x} : IsBigOWith c (pure x) f g ↔ ‖f x‖ ≤ c * ‖g x‖ :=
isBigOWith_iff
#align asymptotics.is_O_with_pure Asymptotics.isBigOWith_pure
theorem IsBigOWith.sup (h : IsBigOWith c l f g) (h' : IsBigOWith c l' f g) :
IsBigOWith c (l ⊔ l') f g :=
IsBigOWith.of_bound <| mem_sup.2 ⟨h.bound, h'.bound⟩
#align asymptotics.is_O_with.sup Asymptotics.IsBigOWith.sup
theorem IsBigOWith.sup' (h : IsBigOWith c l f g') (h' : IsBigOWith c' l' f g') :
IsBigOWith (max c c') (l ⊔ l') f g' :=
IsBigOWith.of_bound <|
mem_sup.2 ⟨(h.weaken <| le_max_left c c').bound, (h'.weaken <| le_max_right c c').bound⟩
#align asymptotics.is_O_with.sup' Asymptotics.IsBigOWith.sup'
theorem IsBigO.sup (h : f =O[l] g') (h' : f =O[l'] g') : f =O[l ⊔ l'] g' :=
let ⟨_c, hc⟩ := h.isBigOWith
let ⟨_c', hc'⟩ := h'.isBigOWith
(hc.sup' hc').isBigO
#align asymptotics.is_O.sup Asymptotics.IsBigO.sup
theorem IsLittleO.sup (h : f =o[l] g) (h' : f =o[l'] g) : f =o[l ⊔ l'] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).sup (h'.forall_isBigOWith cpos)
#align asymptotics.is_o.sup Asymptotics.IsLittleO.sup
@[simp]
theorem isBigO_sup : f =O[l ⊔ l'] g' ↔ f =O[l] g' ∧ f =O[l'] g' :=
⟨fun h => ⟨h.mono le_sup_left, h.mono le_sup_right⟩, fun h => h.1.sup h.2⟩
#align asymptotics.is_O_sup Asymptotics.isBigO_sup
@[simp]
theorem isLittleO_sup : f =o[l ⊔ l'] g ↔ f =o[l] g ∧ f =o[l'] g :=
⟨fun h => ⟨h.mono le_sup_left, h.mono le_sup_right⟩, fun h => h.1.sup h.2⟩
#align asymptotics.is_o_sup Asymptotics.isLittleO_sup
theorem isBigOWith_insert [TopologicalSpace α] {x : α} {s : Set α} {C : ℝ} {g : α → E} {g' : α → F}
(h : ‖g x‖ ≤ C * ‖g' x‖) : IsBigOWith C (𝓝[insert x s] x) g g' ↔
IsBigOWith C (𝓝[s] x) g g' := by
simp_rw [IsBigOWith_def, nhdsWithin_insert, eventually_sup, eventually_pure, h, true_and_iff]
#align asymptotics.is_O_with_insert Asymptotics.isBigOWith_insert
protected theorem IsBigOWith.insert [TopologicalSpace α] {x : α} {s : Set α} {C : ℝ} {g : α → E}
{g' : α → F} (h1 : IsBigOWith C (𝓝[s] x) g g') (h2 : ‖g x‖ ≤ C * ‖g' x‖) :
IsBigOWith C (𝓝[insert x s] x) g g' :=
(isBigOWith_insert h2).mpr h1
#align asymptotics.is_O_with.insert Asymptotics.IsBigOWith.insert
theorem isLittleO_insert [TopologicalSpace α] {x : α} {s : Set α} {g : α → E'} {g' : α → F'}
(h : g x = 0) : g =o[𝓝[insert x s] x] g' ↔ g =o[𝓝[s] x] g' := by
simp_rw [IsLittleO_def]
refine forall_congr' fun c => forall_congr' fun hc => ?_
rw [isBigOWith_insert]
rw [h, norm_zero]
exact mul_nonneg hc.le (norm_nonneg _)
#align asymptotics.is_o_insert Asymptotics.isLittleO_insert
protected theorem IsLittleO.insert [TopologicalSpace α] {x : α} {s : Set α} {g : α → E'}
{g' : α → F'} (h1 : g =o[𝓝[s] x] g') (h2 : g x = 0) : g =o[𝓝[insert x s] x] g' :=
(isLittleO_insert h2).mpr h1
#align asymptotics.is_o.insert Asymptotics.IsLittleO.insert
@[simp]
theorem isBigOWith_neg_right : (IsBigOWith c l f fun x => -g' x) ↔ IsBigOWith c l f g' := by
simp only [IsBigOWith_def, norm_neg]
#align asymptotics.is_O_with_neg_right Asymptotics.isBigOWith_neg_right
alias ⟨IsBigOWith.of_neg_right, IsBigOWith.neg_right⟩ := isBigOWith_neg_right
#align asymptotics.is_O_with.of_neg_right Asymptotics.IsBigOWith.of_neg_right
#align asymptotics.is_O_with.neg_right Asymptotics.IsBigOWith.neg_right
@[simp]
theorem isBigO_neg_right : (f =O[l] fun x => -g' x) ↔ f =O[l] g' := by
simp only [IsBigO_def]
exact exists_congr fun _ => isBigOWith_neg_right
#align asymptotics.is_O_neg_right Asymptotics.isBigO_neg_right
alias ⟨IsBigO.of_neg_right, IsBigO.neg_right⟩ := isBigO_neg_right
#align asymptotics.is_O.of_neg_right Asymptotics.IsBigO.of_neg_right
#align asymptotics.is_O.neg_right Asymptotics.IsBigO.neg_right
@[simp]
theorem isLittleO_neg_right : (f =o[l] fun x => -g' x) ↔ f =o[l] g' := by
simp only [IsLittleO_def]
exact forall₂_congr fun _ _ => isBigOWith_neg_right
#align asymptotics.is_o_neg_right Asymptotics.isLittleO_neg_right
alias ⟨IsLittleO.of_neg_right, IsLittleO.neg_right⟩ := isLittleO_neg_right
#align asymptotics.is_o.of_neg_right Asymptotics.IsLittleO.of_neg_right
#align asymptotics.is_o.neg_right Asymptotics.IsLittleO.neg_right
@[simp]
theorem isBigOWith_neg_left : IsBigOWith c l (fun x => -f' x) g ↔ IsBigOWith c l f' g := by
simp only [IsBigOWith_def, norm_neg]
#align asymptotics.is_O_with_neg_left Asymptotics.isBigOWith_neg_left
alias ⟨IsBigOWith.of_neg_left, IsBigOWith.neg_left⟩ := isBigOWith_neg_left
#align asymptotics.is_O_with.of_neg_left Asymptotics.IsBigOWith.of_neg_left
#align asymptotics.is_O_with.neg_left Asymptotics.IsBigOWith.neg_left
@[simp]
theorem isBigO_neg_left : (fun x => -f' x) =O[l] g ↔ f' =O[l] g := by
simp only [IsBigO_def]
exact exists_congr fun _ => isBigOWith_neg_left
#align asymptotics.is_O_neg_left Asymptotics.isBigO_neg_left
alias ⟨IsBigO.of_neg_left, IsBigO.neg_left⟩ := isBigO_neg_left
#align asymptotics.is_O.of_neg_left Asymptotics.IsBigO.of_neg_left
#align asymptotics.is_O.neg_left Asymptotics.IsBigO.neg_left
@[simp]
theorem isLittleO_neg_left : (fun x => -f' x) =o[l] g ↔ f' =o[l] g := by
simp only [IsLittleO_def]
exact forall₂_congr fun _ _ => isBigOWith_neg_left
#align asymptotics.is_o_neg_left Asymptotics.isLittleO_neg_left
alias ⟨IsLittleO.of_neg_left, IsLittleO.neg_left⟩ := isLittleO_neg_left
#align asymptotics.is_o.of_neg_left Asymptotics.IsLittleO.of_neg_left
#align asymptotics.is_o.neg_left Asymptotics.IsLittleO.neg_left
theorem isBigOWith_fst_prod : IsBigOWith 1 l f' fun x => (f' x, g' x) :=
isBigOWith_of_le l fun _x => le_max_left _ _
#align asymptotics.is_O_with_fst_prod Asymptotics.isBigOWith_fst_prod
theorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' x) :=
isBigOWith_of_le l fun _x => le_max_right _ _
#align asymptotics.is_O_with_snd_prod Asymptotics.isBigOWith_snd_prod
theorem isBigO_fst_prod : f' =O[l] fun x => (f' x, g' x) :=
isBigOWith_fst_prod.isBigO
#align asymptotics.is_O_fst_prod Asymptotics.isBigO_fst_prod
theorem isBigO_snd_prod : g' =O[l] fun x => (f' x, g' x) :=
isBigOWith_snd_prod.isBigO
#align asymptotics.is_O_snd_prod Asymptotics.isBigO_snd_prod
theorem isBigO_fst_prod' {f' : α → E' × F'} : (fun x => (f' x).1) =O[l] f' := by
simpa [IsBigO_def, IsBigOWith_def] using isBigO_fst_prod (E' := E') (F' := F')
#align asymptotics.is_O_fst_prod' Asymptotics.isBigO_fst_prod'
theorem isBigO_snd_prod' {f' : α → E' × F'} : (fun x => (f' x).2) =O[l] f' := by
simpa [IsBigO_def, IsBigOWith_def] using isBigO_snd_prod (E' := E') (F' := F')
#align asymptotics.is_O_snd_prod' Asymptotics.isBigO_snd_prod'
section
variable (f' k')
theorem IsBigOWith.prod_rightl (h : IsBigOWith c l f g') (hc : 0 ≤ c) :
IsBigOWith c l f fun x => (g' x, k' x) :=
(h.trans isBigOWith_fst_prod hc).congr_const (mul_one c)
#align asymptotics.is_O_with.prod_rightl Asymptotics.IsBigOWith.prod_rightl
theorem IsBigO.prod_rightl (h : f =O[l] g') : f =O[l] fun x => (g' x, k' x) :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.prod_rightl k' cnonneg).isBigO
#align asymptotics.is_O.prod_rightl Asymptotics.IsBigO.prod_rightl
theorem IsLittleO.prod_rightl (h : f =o[l] g') : f =o[l] fun x => (g' x, k' x) :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).prod_rightl k' cpos.le
#align asymptotics.is_o.prod_rightl Asymptotics.IsLittleO.prod_rightl
theorem IsBigOWith.prod_rightr (h : IsBigOWith c l f g') (hc : 0 ≤ c) :
IsBigOWith c l f fun x => (f' x, g' x) :=
(h.trans isBigOWith_snd_prod hc).congr_const (mul_one c)
#align asymptotics.is_O_with.prod_rightr Asymptotics.IsBigOWith.prod_rightr
theorem IsBigO.prod_rightr (h : f =O[l] g') : f =O[l] fun x => (f' x, g' x) :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.prod_rightr f' cnonneg).isBigO
#align asymptotics.is_O.prod_rightr Asymptotics.IsBigO.prod_rightr
theorem IsLittleO.prod_rightr (h : f =o[l] g') : f =o[l] fun x => (f' x, g' x) :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).prod_rightr f' cpos.le
#align asymptotics.is_o.prod_rightr Asymptotics.IsLittleO.prod_rightr
end
theorem IsBigOWith.prod_left_same (hf : IsBigOWith c l f' k') (hg : IsBigOWith c l g' k') :
IsBigOWith c l (fun x => (f' x, g' x)) k' := by
rw [isBigOWith_iff] at *; filter_upwards [hf, hg] with x using max_le
#align asymptotics.is_O_with.prod_left_same Asymptotics.IsBigOWith.prod_left_same
theorem IsBigOWith.prod_left (hf : IsBigOWith c l f' k') (hg : IsBigOWith c' l g' k') :
IsBigOWith (max c c') l (fun x => (f' x, g' x)) k' :=
(hf.weaken <| le_max_left c c').prod_left_same (hg.weaken <| le_max_right c c')
#align asymptotics.is_O_with.prod_left Asymptotics.IsBigOWith.prod_left
theorem IsBigOWith.prod_left_fst (h : IsBigOWith c l (fun x => (f' x, g' x)) k') :
IsBigOWith c l f' k' :=
(isBigOWith_fst_prod.trans h zero_le_one).congr_const <| one_mul c
#align asymptotics.is_O_with.prod_left_fst Asymptotics.IsBigOWith.prod_left_fst
theorem IsBigOWith.prod_left_snd (h : IsBigOWith c l (fun x => (f' x, g' x)) k') :
IsBigOWith c l g' k' :=
(isBigOWith_snd_prod.trans h zero_le_one).congr_const <| one_mul c
#align asymptotics.is_O_with.prod_left_snd Asymptotics.IsBigOWith.prod_left_snd
theorem isBigOWith_prod_left :
IsBigOWith c l (fun x => (f' x, g' x)) k' ↔ IsBigOWith c l f' k' ∧ IsBigOWith c l g' k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left_same h.2⟩
#align asymptotics.is_O_with_prod_left Asymptotics.isBigOWith_prod_left
theorem IsBigO.prod_left (hf : f' =O[l] k') (hg : g' =O[l] k') : (fun x => (f' x, g' x)) =O[l] k' :=
let ⟨_c, hf⟩ := hf.isBigOWith
let ⟨_c', hg⟩ := hg.isBigOWith
(hf.prod_left hg).isBigO
#align asymptotics.is_O.prod_left Asymptotics.IsBigO.prod_left
theorem IsBigO.prod_left_fst : (fun x => (f' x, g' x)) =O[l] k' → f' =O[l] k' :=
IsBigO.trans isBigO_fst_prod
#align asymptotics.is_O.prod_left_fst Asymptotics.IsBigO.prod_left_fst
theorem IsBigO.prod_left_snd : (fun x => (f' x, g' x)) =O[l] k' → g' =O[l] k' :=
IsBigO.trans isBigO_snd_prod
#align asymptotics.is_O.prod_left_snd Asymptotics.IsBigO.prod_left_snd
@[simp]
theorem isBigO_prod_left : (fun x => (f' x, g' x)) =O[l] k' ↔ f' =O[l] k' ∧ g' =O[l] k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left h.2⟩
#align asymptotics.is_O_prod_left Asymptotics.isBigO_prod_left
theorem IsLittleO.prod_left (hf : f' =o[l] k') (hg : g' =o[l] k') :
(fun x => (f' x, g' x)) =o[l] k' :=
IsLittleO.of_isBigOWith fun _c hc =>
(hf.forall_isBigOWith hc).prod_left_same (hg.forall_isBigOWith hc)
#align asymptotics.is_o.prod_left Asymptotics.IsLittleO.prod_left
theorem IsLittleO.prod_left_fst : (fun x => (f' x, g' x)) =o[l] k' → f' =o[l] k' :=
IsBigO.trans_isLittleO isBigO_fst_prod
#align asymptotics.is_o.prod_left_fst Asymptotics.IsLittleO.prod_left_fst
theorem IsLittleO.prod_left_snd : (fun x => (f' x, g' x)) =o[l] k' → g' =o[l] k' :=
IsBigO.trans_isLittleO isBigO_snd_prod
#align asymptotics.is_o.prod_left_snd Asymptotics.IsLittleO.prod_left_snd
@[simp]
theorem isLittleO_prod_left : (fun x => (f' x, g' x)) =o[l] k' ↔ f' =o[l] k' ∧ g' =o[l] k' :=
⟨fun h => ⟨h.prod_left_fst, h.prod_left_snd⟩, fun h => h.1.prod_left h.2⟩
#align asymptotics.is_o_prod_left Asymptotics.isLittleO_prod_left
theorem IsBigOWith.eq_zero_imp (h : IsBigOWith c l f'' g'') : ∀ᶠ x in l, g'' x = 0 → f'' x = 0 :=
Eventually.mono h.bound fun x hx hg => norm_le_zero_iff.1 <| by simpa [hg] using hx
#align asymptotics.is_O_with.eq_zero_imp Asymptotics.IsBigOWith.eq_zero_imp
theorem IsBigO.eq_zero_imp (h : f'' =O[l] g'') : ∀ᶠ x in l, g'' x = 0 → f'' x = 0 :=
let ⟨_C, hC⟩ := h.isBigOWith
hC.eq_zero_imp
#align asymptotics.is_O.eq_zero_imp Asymptotics.IsBigO.eq_zero_imp
@[simp]
theorem isBigOWith_principal {s : Set α} : IsBigOWith c (𝓟 s) f g ↔ ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖ := by
rw [IsBigOWith_def, eventually_principal]
#align asymptotics.is_O_with_principal Asymptotics.isBigOWith_principal
theorem isBigO_principal {s : Set α} : f =O[𝓟 s] g ↔ ∃ c, ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖ := by
simp_rw [isBigO_iff, eventually_principal]
#align asymptotics.is_O_principal Asymptotics.isBigO_principal
@[simp]
theorem isLittleO_principal {s : Set α} : f'' =o[𝓟 s] g' ↔ ∀ x ∈ s, f'' x = 0 := by
refine ⟨fun h x hx ↦ norm_le_zero_iff.1 ?_, fun h ↦ ?_⟩
· simp only [isLittleO_iff, isBigOWith_principal] at h
have : Tendsto (fun c : ℝ => c * ‖g' x‖) (𝓝[>] 0) (𝓝 0) :=
((continuous_id.mul continuous_const).tendsto' _ _ (zero_mul _)).mono_left
inf_le_left
apply le_of_tendsto_of_tendsto tendsto_const_nhds this
apply eventually_nhdsWithin_iff.2 (eventually_of_forall (fun c hc ↦ ?_))
exact eventually_principal.1 (h hc) x hx
· apply (isLittleO_zero g' _).congr' ?_ EventuallyEq.rfl
exact fun x hx ↦ (h x hx).symm
@[simp]
theorem isBigOWith_top : IsBigOWith c ⊤ f g ↔ ∀ x, ‖f x‖ ≤ c * ‖g x‖ := by
rw [IsBigOWith_def, eventually_top]
#align asymptotics.is_O_with_top Asymptotics.isBigOWith_top
@[simp]
theorem isBigO_top : f =O[⊤] g ↔ ∃ C, ∀ x, ‖f x‖ ≤ C * ‖g x‖ := by
simp_rw [isBigO_iff, eventually_top]
#align asymptotics.is_O_top Asymptotics.isBigO_top
@[simp]
theorem isLittleO_top : f'' =o[⊤] g' ↔ ∀ x, f'' x = 0 := by
simp only [← principal_univ, isLittleO_principal, mem_univ, forall_true_left]
#align asymptotics.is_o_top Asymptotics.isLittleO_top
section
variable (F)
variable [One F] [NormOneClass F]
theorem isBigOWith_const_one (c : E) (l : Filter α) :
IsBigOWith ‖c‖ l (fun _x : α => c) fun _x => (1 : F) := by simp [isBigOWith_iff]
#align asymptotics.is_O_with_const_one Asymptotics.isBigOWith_const_one
theorem isBigO_const_one (c : E) (l : Filter α) : (fun _x : α => c) =O[l] fun _x => (1 : F) :=
(isBigOWith_const_one F c l).isBigO
#align asymptotics.is_O_const_one Asymptotics.isBigO_const_one
theorem isLittleO_const_iff_isLittleO_one {c : F''} (hc : c ≠ 0) :
(f =o[l] fun _x => c) ↔ f =o[l] fun _x => (1 : F) :=
⟨fun h => h.trans_isBigOWith (isBigOWith_const_one _ _ _) (norm_pos_iff.2 hc),
fun h => h.trans_isBigO <| isBigO_const_const _ hc _⟩
#align asymptotics.is_o_const_iff_is_o_one Asymptotics.isLittleO_const_iff_isLittleO_one
@[simp]
theorem isLittleO_one_iff : f' =o[l] (fun _x => 1 : α → F) ↔ Tendsto f' l (𝓝 0) := by
simp only [isLittleO_iff, norm_one, mul_one, Metric.nhds_basis_closedBall.tendsto_right_iff,
Metric.mem_closedBall, dist_zero_right]
#align asymptotics.is_o_one_iff Asymptotics.isLittleO_one_iff
@[simp]
theorem isBigO_one_iff : f =O[l] (fun _x => 1 : α → F) ↔
IsBoundedUnder (· ≤ ·) l fun x => ‖f x‖ := by
simp only [isBigO_iff, norm_one, mul_one, IsBoundedUnder, IsBounded, eventually_map]
#align asymptotics.is_O_one_iff Asymptotics.isBigO_one_iff
alias ⟨_, _root_.Filter.IsBoundedUnder.isBigO_one⟩ := isBigO_one_iff
#align filter.is_bounded_under.is_O_one Filter.IsBoundedUnder.isBigO_one
@[simp]
theorem isLittleO_one_left_iff : (fun _x => 1 : α → F) =o[l] f ↔ Tendsto (fun x => ‖f x‖) l atTop :=
calc
(fun _x => 1 : α → F) =o[l] f ↔ ∀ n : ℕ, ∀ᶠ x in l, ↑n * ‖(1 : F)‖ ≤ ‖f x‖ :=
isLittleO_iff_nat_mul_le_aux <| Or.inl fun _x => by simp only [norm_one, zero_le_one]
_ ↔ ∀ n : ℕ, True → ∀ᶠ x in l, ‖f x‖ ∈ Ici (n : ℝ) := by
simp only [norm_one, mul_one, true_imp_iff, mem_Ici]
_ ↔ Tendsto (fun x => ‖f x‖) l atTop :=
atTop_hasCountableBasis_of_archimedean.1.tendsto_right_iff.symm
#align asymptotics.is_o_one_left_iff Asymptotics.isLittleO_one_left_iff
theorem _root_.Filter.Tendsto.isBigO_one {c : E'} (h : Tendsto f' l (𝓝 c)) :
f' =O[l] (fun _x => 1 : α → F) :=
h.norm.isBoundedUnder_le.isBigO_one F
#align filter.tendsto.is_O_one Filter.Tendsto.isBigO_one
theorem IsBigO.trans_tendsto_nhds (hfg : f =O[l] g') {y : F'} (hg : Tendsto g' l (𝓝 y)) :
f =O[l] (fun _x => 1 : α → F) :=
hfg.trans <| hg.isBigO_one F
#align asymptotics.is_O.trans_tendsto_nhds Asymptotics.IsBigO.trans_tendsto_nhds
lemma isBigO_one_nhds_ne_iff [TopologicalSpace α] {a : α} :
f =O[𝓝[≠] a] (fun _ ↦ 1 : α → F) ↔ f =O[𝓝 a] (fun _ ↦ 1 : α → F) := by
refine ⟨fun h ↦ ?_, fun h ↦ h.mono nhdsWithin_le_nhds⟩
simp only [isBigO_one_iff, IsBoundedUnder, IsBounded, eventually_map] at h ⊢
obtain ⟨c, hc⟩ := h
use max c ‖f a‖
filter_upwards [eventually_nhdsWithin_iff.mp hc] with b hb
rcases eq_or_ne b a with rfl | hb'
· apply le_max_right
· exact (hb hb').trans (le_max_left ..)
end
theorem isLittleO_const_iff {c : F''} (hc : c ≠ 0) :
(f'' =o[l] fun _x => c) ↔ Tendsto f'' l (𝓝 0) :=
(isLittleO_const_iff_isLittleO_one ℝ hc).trans (isLittleO_one_iff _)
#align asymptotics.is_o_const_iff Asymptotics.isLittleO_const_iff
theorem isLittleO_id_const {c : F''} (hc : c ≠ 0) : (fun x : E'' => x) =o[𝓝 0] fun _x => c :=
(isLittleO_const_iff hc).mpr (continuous_id.tendsto 0)
#align asymptotics.is_o_id_const Asymptotics.isLittleO_id_const
theorem _root_.Filter.IsBoundedUnder.isBigO_const (h : IsBoundedUnder (· ≤ ·) l (norm ∘ f))
{c : F''} (hc : c ≠ 0) : f =O[l] fun _x => c :=
(h.isBigO_one ℝ).trans (isBigO_const_const _ hc _)
#align filter.is_bounded_under.is_O_const Filter.IsBoundedUnder.isBigO_const
theorem isBigO_const_of_tendsto {y : E''} (h : Tendsto f'' l (𝓝 y)) {c : F''} (hc : c ≠ 0) :
f'' =O[l] fun _x => c :=
h.norm.isBoundedUnder_le.isBigO_const hc
#align asymptotics.is_O_const_of_tendsto Asymptotics.isBigO_const_of_tendsto
theorem IsBigO.isBoundedUnder_le {c : F} (h : f =O[l] fun _x => c) :
IsBoundedUnder (· ≤ ·) l (norm ∘ f) :=
let ⟨c', hc'⟩ := h.bound
⟨c' * ‖c‖, eventually_map.2 hc'⟩
#align asymptotics.is_O.is_bounded_under_le Asymptotics.IsBigO.isBoundedUnder_le
theorem isBigO_const_of_ne {c : F''} (hc : c ≠ 0) :
(f =O[l] fun _x => c) ↔ IsBoundedUnder (· ≤ ·) l (norm ∘ f) :=
⟨fun h => h.isBoundedUnder_le, fun h => h.isBigO_const hc⟩
#align asymptotics.is_O_const_of_ne Asymptotics.isBigO_const_of_ne
theorem isBigO_const_iff {c : F''} : (f'' =O[l] fun _x => c) ↔
(c = 0 → f'' =ᶠ[l] 0) ∧ IsBoundedUnder (· ≤ ·) l fun x => ‖f'' x‖ := by
refine ⟨fun h => ⟨fun hc => isBigO_zero_right_iff.1 (by rwa [← hc]), h.isBoundedUnder_le⟩, ?_⟩
rintro ⟨hcf, hf⟩
rcases eq_or_ne c 0 with (hc | hc)
exacts [(hcf hc).trans_isBigO (isBigO_zero _ _), hf.isBigO_const hc]
#align asymptotics.is_O_const_iff Asymptotics.isBigO_const_iff
theorem isBigO_iff_isBoundedUnder_le_div (h : ∀ᶠ x in l, g'' x ≠ 0) :
f =O[l] g'' ↔ IsBoundedUnder (· ≤ ·) l fun x => ‖f x‖ / ‖g'' x‖ := by
simp only [isBigO_iff, IsBoundedUnder, IsBounded, eventually_map]
exact
exists_congr fun c =>
eventually_congr <| h.mono fun x hx => (div_le_iff <| norm_pos_iff.2 hx).symm
#align asymptotics.is_O_iff_is_bounded_under_le_div Asymptotics.isBigO_iff_isBoundedUnder_le_div
theorem isBigO_const_left_iff_pos_le_norm {c : E''} (hc : c ≠ 0) :
(fun _x => c) =O[l] f' ↔ ∃ b, 0 < b ∧ ∀ᶠ x in l, b ≤ ‖f' x‖ := by
constructor
· intro h
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨‖c‖ / C, div_pos (norm_pos_iff.2 hc) hC₀, ?_⟩
exact hC.bound.mono fun x => (div_le_iff' hC₀).2
· rintro ⟨b, hb₀, hb⟩
refine IsBigO.of_bound (‖c‖ / b) (hb.mono fun x hx => ?_)
rw [div_mul_eq_mul_div, mul_div_assoc]
exact le_mul_of_one_le_right (norm_nonneg _) ((one_le_div hb₀).2 hx)
#align asymptotics.is_O_const_left_iff_pos_le_norm Asymptotics.isBigO_const_left_iff_pos_le_norm
theorem IsBigO.trans_tendsto (hfg : f'' =O[l] g'') (hg : Tendsto g'' l (𝓝 0)) :
Tendsto f'' l (𝓝 0) :=
(isLittleO_one_iff ℝ).1 <| hfg.trans_isLittleO <| (isLittleO_one_iff ℝ).2 hg
#align asymptotics.is_O.trans_tendsto Asymptotics.IsBigO.trans_tendsto
theorem IsLittleO.trans_tendsto (hfg : f'' =o[l] g'') (hg : Tendsto g'' l (𝓝 0)) :
Tendsto f'' l (𝓝 0) :=
hfg.isBigO.trans_tendsto hg
#align asymptotics.is_o.trans_tendsto Asymptotics.IsLittleO.trans_tendsto
theorem isBigOWith_const_mul_self (c : R) (f : α → R) (l : Filter α) :
IsBigOWith ‖c‖ l (fun x => c * f x) f :=
isBigOWith_of_le' _ fun _x => norm_mul_le _ _
#align asymptotics.is_O_with_const_mul_self Asymptotics.isBigOWith_const_mul_self
theorem isBigO_const_mul_self (c : R) (f : α → R) (l : Filter α) : (fun x => c * f x) =O[l] f :=
(isBigOWith_const_mul_self c f l).isBigO
#align asymptotics.is_O_const_mul_self Asymptotics.isBigO_const_mul_self
theorem IsBigOWith.const_mul_left {f : α → R} (h : IsBigOWith c l f g) (c' : R) :
IsBigOWith (‖c'‖ * c) l (fun x => c' * f x) g :=
(isBigOWith_const_mul_self c' f l).trans h (norm_nonneg c')
#align asymptotics.is_O_with.const_mul_left Asymptotics.IsBigOWith.const_mul_left
theorem IsBigO.const_mul_left {f : α → R} (h : f =O[l] g) (c' : R) : (fun x => c' * f x) =O[l] g :=
let ⟨_c, hc⟩ := h.isBigOWith
(hc.const_mul_left c').isBigO
#align asymptotics.is_O.const_mul_left Asymptotics.IsBigO.const_mul_left
theorem isBigOWith_self_const_mul' (u : Rˣ) (f : α → R) (l : Filter α) :
IsBigOWith ‖(↑u⁻¹ : R)‖ l f fun x => ↑u * f x :=
(isBigOWith_const_mul_self ↑u⁻¹ (fun x ↦ ↑u * f x) l).congr_left
fun x ↦ u.inv_mul_cancel_left (f x)
#align asymptotics.is_O_with_self_const_mul' Asymptotics.isBigOWith_self_const_mul'
theorem isBigOWith_self_const_mul (c : 𝕜) (hc : c ≠ 0) (f : α → 𝕜) (l : Filter α) :
IsBigOWith ‖c‖⁻¹ l f fun x => c * f x :=
(isBigOWith_self_const_mul' (Units.mk0 c hc) f l).congr_const <| norm_inv c
#align asymptotics.is_O_with_self_const_mul Asymptotics.isBigOWith_self_const_mul
theorem isBigO_self_const_mul' {c : R} (hc : IsUnit c) (f : α → R) (l : Filter α) :
f =O[l] fun x => c * f x :=
let ⟨u, hu⟩ := hc
hu ▸ (isBigOWith_self_const_mul' u f l).isBigO
#align asymptotics.is_O_self_const_mul' Asymptotics.isBigO_self_const_mul'
theorem isBigO_self_const_mul (c : 𝕜) (hc : c ≠ 0) (f : α → 𝕜) (l : Filter α) :
f =O[l] fun x => c * f x :=
isBigO_self_const_mul' (IsUnit.mk0 c hc) f l
#align asymptotics.is_O_self_const_mul Asymptotics.isBigO_self_const_mul
theorem isBigO_const_mul_left_iff' {f : α → R} {c : R} (hc : IsUnit c) :
(fun x => c * f x) =O[l] g ↔ f =O[l] g :=
⟨(isBigO_self_const_mul' hc f l).trans, fun h => h.const_mul_left c⟩
#align asymptotics.is_O_const_mul_left_iff' Asymptotics.isBigO_const_mul_left_iff'
theorem isBigO_const_mul_left_iff {f : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(fun x => c * f x) =O[l] g ↔ f =O[l] g :=
isBigO_const_mul_left_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_O_const_mul_left_iff Asymptotics.isBigO_const_mul_left_iff
theorem IsLittleO.const_mul_left {f : α → R} (h : f =o[l] g) (c : R) : (fun x => c * f x) =o[l] g :=
(isBigO_const_mul_self c f l).trans_isLittleO h
#align asymptotics.is_o.const_mul_left Asymptotics.IsLittleO.const_mul_left
theorem isLittleO_const_mul_left_iff' {f : α → R} {c : R} (hc : IsUnit c) :
(fun x => c * f x) =o[l] g ↔ f =o[l] g :=
⟨(isBigO_self_const_mul' hc f l).trans_isLittleO, fun h => h.const_mul_left c⟩
#align asymptotics.is_o_const_mul_left_iff' Asymptotics.isLittleO_const_mul_left_iff'
theorem isLittleO_const_mul_left_iff {f : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(fun x => c * f x) =o[l] g ↔ f =o[l] g :=
isLittleO_const_mul_left_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_o_const_mul_left_iff Asymptotics.isLittleO_const_mul_left_iff
theorem IsBigOWith.of_const_mul_right {g : α → R} {c : R} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f fun x => c * g x) : IsBigOWith (c' * ‖c‖) l f g :=
h.trans (isBigOWith_const_mul_self c g l) hc'
#align asymptotics.is_O_with.of_const_mul_right Asymptotics.IsBigOWith.of_const_mul_right
theorem IsBigO.of_const_mul_right {g : α → R} {c : R} (h : f =O[l] fun x => c * g x) : f =O[l] g :=
let ⟨_c, cnonneg, hc⟩ := h.exists_nonneg
(hc.of_const_mul_right cnonneg).isBigO
#align asymptotics.is_O.of_const_mul_right Asymptotics.IsBigO.of_const_mul_right
theorem IsBigOWith.const_mul_right' {g : α → R} {u : Rˣ} {c' : ℝ} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f g) : IsBigOWith (c' * ‖(↑u⁻¹ : R)‖) l f fun x => ↑u * g x :=
h.trans (isBigOWith_self_const_mul' _ _ _) hc'
#align asymptotics.is_O_with.const_mul_right' Asymptotics.IsBigOWith.const_mul_right'
theorem IsBigOWith.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) {c' : ℝ} (hc' : 0 ≤ c')
(h : IsBigOWith c' l f g) : IsBigOWith (c' * ‖c‖⁻¹) l f fun x => c * g x :=
h.trans (isBigOWith_self_const_mul c hc g l) hc'
#align asymptotics.is_O_with.const_mul_right Asymptotics.IsBigOWith.const_mul_right
theorem IsBigO.const_mul_right' {g : α → R} {c : R} (hc : IsUnit c) (h : f =O[l] g) :
f =O[l] fun x => c * g x :=
h.trans (isBigO_self_const_mul' hc g l)
#align asymptotics.is_O.const_mul_right' Asymptotics.IsBigO.const_mul_right'
theorem IsBigO.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) (h : f =O[l] g) :
f =O[l] fun x => c * g x :=
h.const_mul_right' <| IsUnit.mk0 c hc
#align asymptotics.is_O.const_mul_right Asymptotics.IsBigO.const_mul_right
theorem isBigO_const_mul_right_iff' {g : α → R} {c : R} (hc : IsUnit c) :
(f =O[l] fun x => c * g x) ↔ f =O[l] g :=
⟨fun h => h.of_const_mul_right, fun h => h.const_mul_right' hc⟩
#align asymptotics.is_O_const_mul_right_iff' Asymptotics.isBigO_const_mul_right_iff'
theorem isBigO_const_mul_right_iff {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(f =O[l] fun x => c * g x) ↔ f =O[l] g :=
isBigO_const_mul_right_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_O_const_mul_right_iff Asymptotics.isBigO_const_mul_right_iff
theorem IsLittleO.of_const_mul_right {g : α → R} {c : R} (h : f =o[l] fun x => c * g x) :
f =o[l] g :=
h.trans_isBigO (isBigO_const_mul_self c g l)
#align asymptotics.is_o.of_const_mul_right Asymptotics.IsLittleO.of_const_mul_right
theorem IsLittleO.const_mul_right' {g : α → R} {c : R} (hc : IsUnit c) (h : f =o[l] g) :
f =o[l] fun x => c * g x :=
h.trans_isBigO (isBigO_self_const_mul' hc g l)
#align asymptotics.is_o.const_mul_right' Asymptotics.IsLittleO.const_mul_right'
theorem IsLittleO.const_mul_right {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) (h : f =o[l] g) :
f =o[l] fun x => c * g x :=
h.const_mul_right' <| IsUnit.mk0 c hc
#align asymptotics.is_o.const_mul_right Asymptotics.IsLittleO.const_mul_right
theorem isLittleO_const_mul_right_iff' {g : α → R} {c : R} (hc : IsUnit c) :
(f =o[l] fun x => c * g x) ↔ f =o[l] g :=
⟨fun h => h.of_const_mul_right, fun h => h.const_mul_right' hc⟩
#align asymptotics.is_o_const_mul_right_iff' Asymptotics.isLittleO_const_mul_right_iff'
theorem isLittleO_const_mul_right_iff {g : α → 𝕜} {c : 𝕜} (hc : c ≠ 0) :
(f =o[l] fun x => c * g x) ↔ f =o[l] g :=
isLittleO_const_mul_right_iff' <| IsUnit.mk0 c hc
#align asymptotics.is_o_const_mul_right_iff Asymptotics.isLittleO_const_mul_right_iff
theorem IsBigOWith.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} {c₁ c₂ : ℝ} (h₁ : IsBigOWith c₁ l f₁ g₁)
(h₂ : IsBigOWith c₂ l f₂ g₂) :
IsBigOWith (c₁ * c₂) l (fun x => f₁ x * f₂ x) fun x => g₁ x * g₂ x := by
simp only [IsBigOWith_def] at *
filter_upwards [h₁, h₂] with _ hx₁ hx₂
apply le_trans (norm_mul_le _ _)
convert mul_le_mul hx₁ hx₂ (norm_nonneg _) (le_trans (norm_nonneg _) hx₁) using 1
rw [norm_mul, mul_mul_mul_comm]
#align asymptotics.is_O_with.mul Asymptotics.IsBigOWith.mul
theorem IsBigO.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =O[l] g₁) (h₂ : f₂ =O[l] g₂) :
(fun x => f₁ x * f₂ x) =O[l] fun x => g₁ x * g₂ x :=
let ⟨_c, hc⟩ := h₁.isBigOWith
let ⟨_c', hc'⟩ := h₂.isBigOWith
(hc.mul hc').isBigO
#align asymptotics.is_O.mul Asymptotics.IsBigO.mul
theorem IsBigO.mul_isLittleO {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =O[l] g₁) (h₂ : f₂ =o[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x := by
simp only [IsLittleO_def] at *
intro c cpos
rcases h₁.exists_pos with ⟨c', c'pos, hc'⟩
exact (hc'.mul (h₂ (div_pos cpos c'pos))).congr_const (mul_div_cancel₀ _ (ne_of_gt c'pos))
#align asymptotics.is_O.mul_is_o Asymptotics.IsBigO.mul_isLittleO
theorem IsLittleO.mul_isBigO {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =o[l] g₁) (h₂ : f₂ =O[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x := by
simp only [IsLittleO_def] at *
intro c cpos
rcases h₂.exists_pos with ⟨c', c'pos, hc'⟩
exact ((h₁ (div_pos cpos c'pos)).mul hc').congr_const (div_mul_cancel₀ _ (ne_of_gt c'pos))
#align asymptotics.is_o.mul_is_O Asymptotics.IsLittleO.mul_isBigO
theorem IsLittleO.mul {f₁ f₂ : α → R} {g₁ g₂ : α → 𝕜} (h₁ : f₁ =o[l] g₁) (h₂ : f₂ =o[l] g₂) :
(fun x => f₁ x * f₂ x) =o[l] fun x => g₁ x * g₂ x :=
h₁.mul_isBigO h₂.isBigO
#align asymptotics.is_o.mul Asymptotics.IsLittleO.mul
theorem IsBigOWith.pow' {f : α → R} {g : α → 𝕜} (h : IsBigOWith c l f g) :
∀ n : ℕ, IsBigOWith (Nat.casesOn n ‖(1 : R)‖ fun n => c ^ (n + 1))
l (fun x => f x ^ n) fun x => g x ^ n
| 0 => by simpa using isBigOWith_const_const (1 : R) (one_ne_zero' 𝕜) l
| 1 => by simpa
| n + 2 => by simpa [pow_succ] using (IsBigOWith.pow' h (n + 1)).mul h
#align asymptotics.is_O_with.pow' Asymptotics.IsBigOWith.pow'
theorem IsBigOWith.pow [NormOneClass R] {f : α → R} {g : α → 𝕜} (h : IsBigOWith c l f g) :
∀ n : ℕ, IsBigOWith (c ^ n) l (fun x => f x ^ n) fun x => g x ^ n
| 0 => by simpa using h.pow' 0
| n + 1 => h.pow' (n + 1)
#align asymptotics.is_O_with.pow Asymptotics.IsBigOWith.pow
theorem IsBigOWith.of_pow {n : ℕ} {f : α → 𝕜} {g : α → R} (h : IsBigOWith c l (f ^ n) (g ^ n))
(hn : n ≠ 0) (hc : c ≤ c' ^ n) (hc' : 0 ≤ c') : IsBigOWith c' l f g :=
IsBigOWith.of_bound <| (h.weaken hc).bound.mono fun x hx ↦
le_of_pow_le_pow_left hn (by positivity) <|
calc
‖f x‖ ^ n = ‖f x ^ n‖ := (norm_pow _ _).symm
_ ≤ c' ^ n * ‖g x ^ n‖ := hx
_ ≤ c' ^ n * ‖g x‖ ^ n := by gcongr; exact norm_pow_le' _ hn.bot_lt
_ = (c' * ‖g x‖) ^ n := (mul_pow _ _ _).symm
#align asymptotics.is_O_with.of_pow Asymptotics.IsBigOWith.of_pow
theorem IsBigO.pow {f : α → R} {g : α → 𝕜} (h : f =O[l] g) (n : ℕ) :
(fun x => f x ^ n) =O[l] fun x => g x ^ n :=
let ⟨_C, hC⟩ := h.isBigOWith
isBigO_iff_isBigOWith.2 ⟨_, hC.pow' n⟩
#align asymptotics.is_O.pow Asymptotics.IsBigO.pow
theorem IsBigO.of_pow {f : α → 𝕜} {g : α → R} {n : ℕ} (hn : n ≠ 0) (h : (f ^ n) =O[l] (g ^ n)) :
f =O[l] g := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
obtain ⟨c : ℝ, hc₀ : 0 ≤ c, hc : C ≤ c ^ n⟩ :=
((eventually_ge_atTop _).and <| (tendsto_pow_atTop hn).eventually_ge_atTop C).exists
exact (hC.of_pow hn hc hc₀).isBigO
#align asymptotics.is_O.of_pow Asymptotics.IsBigO.of_pow
theorem IsLittleO.pow {f : α → R} {g : α → 𝕜} (h : f =o[l] g) {n : ℕ} (hn : 0 < n) :
(fun x => f x ^ n) =o[l] fun x => g x ^ n := by
obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hn.ne'; clear hn
induction' n with n ihn
· simpa only [Nat.zero_eq, ← Nat.one_eq_succ_zero, pow_one]
· convert ihn.mul h <;> simp [pow_succ]
#align asymptotics.is_o.pow Asymptotics.IsLittleO.pow
theorem IsLittleO.of_pow {f : α → 𝕜} {g : α → R} {n : ℕ} (h : (f ^ n) =o[l] (g ^ n)) (hn : n ≠ 0) :
f =o[l] g :=
IsLittleO.of_isBigOWith fun _c hc => (h.def' <| pow_pos hc _).of_pow hn le_rfl hc.le
#align asymptotics.is_o.of_pow Asymptotics.IsLittleO.of_pow
theorem IsBigOWith.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : IsBigOWith c l f g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : IsBigOWith c l (fun x => (g x)⁻¹) fun x => (f x)⁻¹ := by
refine IsBigOWith.of_bound (h.bound.mp (h₀.mono fun x h₀ hle => ?_))
rcases eq_or_ne (f x) 0 with hx | hx
· simp only [hx, h₀ hx, inv_zero, norm_zero, mul_zero, le_rfl]
· have hc : 0 < c := pos_of_mul_pos_left ((norm_pos_iff.2 hx).trans_le hle) (norm_nonneg _)
replace hle := inv_le_inv_of_le (norm_pos_iff.2 hx) hle
simpa only [norm_inv, mul_inv, ← div_eq_inv_mul, div_le_iff hc] using hle
#align asymptotics.is_O_with.inv_rev Asymptotics.IsBigOWith.inv_rev
theorem IsBigO.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : f =O[l] g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : (fun x => (g x)⁻¹) =O[l] fun x => (f x)⁻¹ :=
let ⟨_c, hc⟩ := h.isBigOWith
(hc.inv_rev h₀).isBigO
#align asymptotics.is_O.inv_rev Asymptotics.IsBigO.inv_rev
theorem IsLittleO.inv_rev {f : α → 𝕜} {g : α → 𝕜'} (h : f =o[l] g)
(h₀ : ∀ᶠ x in l, f x = 0 → g x = 0) : (fun x => (g x)⁻¹) =o[l] fun x => (f x)⁻¹ :=
IsLittleO.of_isBigOWith fun _c hc => (h.def' hc).inv_rev h₀
#align asymptotics.is_o.inv_rev Asymptotics.IsLittleO.inv_rev
theorem IsLittleO.tendsto_div_nhds_zero {f g : α → 𝕜} (h : f =o[l] g) :
Tendsto (fun x => f x / g x) l (𝓝 0) :=
(isLittleO_one_iff 𝕜).mp <| by
calc
(fun x => f x / g x) =o[l] fun x => g x / g x := by
simpa only [div_eq_mul_inv] using h.mul_isBigO (isBigO_refl _ _)
_ =O[l] fun _x => (1 : 𝕜) := isBigO_of_le _ fun x => by simp [div_self_le_one]
#align asymptotics.is_o.tendsto_div_nhds_zero Asymptotics.IsLittleO.tendsto_div_nhds_zero
theorem IsLittleO.tendsto_inv_smul_nhds_zero [Module 𝕜 E'] [BoundedSMul 𝕜 E']
{f : α → E'} {g : α → 𝕜}
{l : Filter α} (h : f =o[l] g) : Tendsto (fun x => (g x)⁻¹ • f x) l (𝓝 0) := by
simpa only [div_eq_inv_mul, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero] using
h.norm_norm.tendsto_div_nhds_zero
#align asymptotics.is_o.tendsto_inv_smul_nhds_zero Asymptotics.IsLittleO.tendsto_inv_smul_nhds_zero
theorem isLittleO_iff_tendsto' {f g : α → 𝕜} (hgf : ∀ᶠ x in l, g x = 0 → f x = 0) :
f =o[l] g ↔ Tendsto (fun x => f x / g x) l (𝓝 0) :=
⟨IsLittleO.tendsto_div_nhds_zero, fun h =>
(((isLittleO_one_iff _).mpr h).mul_isBigO (isBigO_refl g l)).congr'
(hgf.mono fun _x => div_mul_cancel_of_imp) (eventually_of_forall fun _x => one_mul _)⟩
#align asymptotics.is_o_iff_tendsto' Asymptotics.isLittleO_iff_tendsto'
theorem isLittleO_iff_tendsto {f g : α → 𝕜} (hgf : ∀ x, g x = 0 → f x = 0) :
f =o[l] g ↔ Tendsto (fun x => f x / g x) l (𝓝 0) :=
isLittleO_iff_tendsto' (eventually_of_forall hgf)
#align asymptotics.is_o_iff_tendsto Asymptotics.isLittleO_iff_tendsto
alias ⟨_, isLittleO_of_tendsto'⟩ := isLittleO_iff_tendsto'
#align asymptotics.is_o_of_tendsto' Asymptotics.isLittleO_of_tendsto'
alias ⟨_, isLittleO_of_tendsto⟩ := isLittleO_iff_tendsto
#align asymptotics.is_o_of_tendsto Asymptotics.isLittleO_of_tendsto
theorem isLittleO_const_left_of_ne {c : E''} (hc : c ≠ 0) :
(fun _x => c) =o[l] g ↔ Tendsto (fun x => ‖g x‖) l atTop := by
simp only [← isLittleO_one_left_iff ℝ]
exact ⟨(isBigO_const_const (1 : ℝ) hc l).trans_isLittleO,
(isBigO_const_one ℝ c l).trans_isLittleO⟩
#align asymptotics.is_o_const_left_of_ne Asymptotics.isLittleO_const_left_of_ne
@[simp]
theorem isLittleO_const_left {c : E''} :
(fun _x => c) =o[l] g'' ↔ c = 0 ∨ Tendsto (norm ∘ g'') l atTop := by
rcases eq_or_ne c 0 with (rfl | hc)
· simp only [isLittleO_zero, eq_self_iff_true, true_or_iff]
· simp only [hc, false_or_iff, isLittleO_const_left_of_ne hc]; rfl
#align asymptotics.is_o_const_left Asymptotics.isLittleO_const_left
@[simp 1001] -- Porting note: increase priority so that this triggers before `isLittleO_const_left`
theorem isLittleO_const_const_iff [NeBot l] {d : E''} {c : F''} :
((fun _x => d) =o[l] fun _x => c) ↔ d = 0 := by
have : ¬Tendsto (Function.const α ‖c‖) l atTop :=
not_tendsto_atTop_of_tendsto_nhds tendsto_const_nhds
simp only [isLittleO_const_left, or_iff_left_iff_imp]
exact fun h => (this h).elim
#align asymptotics.is_o_const_const_iff Asymptotics.isLittleO_const_const_iff
@[simp]
theorem isLittleO_pure {x} : f'' =o[pure x] g'' ↔ f'' x = 0 :=
calc
f'' =o[pure x] g'' ↔ (fun _y : α => f'' x) =o[pure x] fun _ => g'' x := isLittleO_congr rfl rfl
_ ↔ f'' x = 0 := isLittleO_const_const_iff
#align asymptotics.is_o_pure Asymptotics.isLittleO_pure
theorem isLittleO_const_id_cobounded (c : F'') :
(fun _ => c) =o[Bornology.cobounded E''] id :=
isLittleO_const_left.2 <| .inr tendsto_norm_cobounded_atTop
#align asymptotics.is_o_const_id_comap_norm_at_top Asymptotics.isLittleO_const_id_cobounded
theorem isLittleO_const_id_atTop (c : E'') : (fun _x : ℝ => c) =o[atTop] id :=
isLittleO_const_left.2 <| Or.inr tendsto_abs_atTop_atTop
#align asymptotics.is_o_const_id_at_top Asymptotics.isLittleO_const_id_atTop
theorem isLittleO_const_id_atBot (c : E'') : (fun _x : ℝ => c) =o[atBot] id :=
isLittleO_const_left.2 <| Or.inr tendsto_abs_atBot_atTop
#align asymptotics.is_o_const_id_at_bot Asymptotics.isLittleO_const_id_atBot
theorem div_isBoundedUnder_of_isBigO {α : Type*} {l : Filter α} {f g : α → 𝕜} (h : f =O[l] g) :
IsBoundedUnder (· ≤ ·) l fun x => ‖f x / g x‖ := by
obtain ⟨c, h₀, hc⟩ := h.exists_nonneg
refine ⟨c, eventually_map.2 (hc.bound.mono fun x hx => ?_)⟩
rw [norm_div]
exact div_le_of_nonneg_of_le_mul (norm_nonneg _) h₀ hx
#align asymptotics.div_is_bounded_under_of_is_O Asymptotics.div_isBoundedUnder_of_isBigO
theorem isBigO_iff_div_isBoundedUnder {α : Type*} {l : Filter α} {f g : α → 𝕜}
(hgf : ∀ᶠ x in l, g x = 0 → f x = 0) :
f =O[l] g ↔ IsBoundedUnder (· ≤ ·) l fun x => ‖f x / g x‖ := by
refine ⟨div_isBoundedUnder_of_isBigO, fun h => ?_⟩
obtain ⟨c, hc⟩ := h
simp only [eventually_map, norm_div] at hc
refine IsBigO.of_bound c (hc.mp <| hgf.mono fun x hx₁ hx₂ => ?_)
by_cases hgx : g x = 0
· simp [hx₁ hgx, hgx]
· exact (div_le_iff (norm_pos_iff.2 hgx)).mp hx₂
#align asymptotics.is_O_iff_div_is_bounded_under Asymptotics.isBigO_iff_div_isBoundedUnder
theorem isBigO_of_div_tendsto_nhds {α : Type*} {l : Filter α} {f g : α → 𝕜}
(hgf : ∀ᶠ x in l, g x = 0 → f x = 0) (c : 𝕜) (H : Filter.Tendsto (f / g) l (𝓝 c)) :
f =O[l] g :=
(isBigO_iff_div_isBoundedUnder hgf).2 <| H.norm.isBoundedUnder_le
#align asymptotics.is_O_of_div_tendsto_nhds Asymptotics.isBigO_of_div_tendsto_nhds
theorem IsLittleO.tendsto_zero_of_tendsto {α E 𝕜 : Type*} [NormedAddCommGroup E] [NormedField 𝕜]
{u : α → E} {v : α → 𝕜} {l : Filter α} {y : 𝕜} (huv : u =o[l] v) (hv : Tendsto v l (𝓝 y)) :
Tendsto u l (𝓝 0) := by
suffices h : u =o[l] fun _x => (1 : 𝕜) by
rwa [isLittleO_one_iff] at h
exact huv.trans_isBigO (hv.isBigO_one 𝕜)
#align asymptotics.is_o.tendsto_zero_of_tendsto Asymptotics.IsLittleO.tendsto_zero_of_tendsto
theorem isLittleO_pow_pow {m n : ℕ} (h : m < n) : (fun x : 𝕜 => x ^ n) =o[𝓝 0] fun x => x ^ m := by
rcases lt_iff_exists_add.1 h with ⟨p, hp0 : 0 < p, rfl⟩
suffices (fun x : 𝕜 => x ^ m * x ^ p) =o[𝓝 0] fun x => x ^ m * 1 ^ p by
simpa only [pow_add, one_pow, mul_one]
exact IsBigO.mul_isLittleO (isBigO_refl _ _)
(IsLittleO.pow ((isLittleO_one_iff _).2 tendsto_id) hp0)
#align asymptotics.is_o_pow_pow Asymptotics.isLittleO_pow_pow
theorem isLittleO_norm_pow_norm_pow {m n : ℕ} (h : m < n) :
(fun x : E' => ‖x‖ ^ n) =o[𝓝 0] fun x => ‖x‖ ^ m :=
(isLittleO_pow_pow h).comp_tendsto tendsto_norm_zero
#align asymptotics.is_o_norm_pow_norm_pow Asymptotics.isLittleO_norm_pow_norm_pow
theorem isLittleO_pow_id {n : ℕ} (h : 1 < n) : (fun x : 𝕜 => x ^ n) =o[𝓝 0] fun x => x := by
convert isLittleO_pow_pow h (𝕜 := 𝕜)
simp only [pow_one]
#align asymptotics.is_o_pow_id Asymptotics.isLittleO_pow_id
theorem isLittleO_norm_pow_id {n : ℕ} (h : 1 < n) :
(fun x : E' => ‖x‖ ^ n) =o[𝓝 0] fun x => x := by
have := @isLittleO_norm_pow_norm_pow E' _ _ _ h
simp only [pow_one] at this
exact isLittleO_norm_right.mp this
#align asymptotics.is_o_norm_pow_id Asymptotics.isLittleO_norm_pow_id
theorem IsBigO.eq_zero_of_norm_pow_within {f : E'' → F''} {s : Set E''} {x₀ : E''} {n : ℕ}
(h : f =O[𝓝[s] x₀] fun x => ‖x - x₀‖ ^ n) (hx₀ : x₀ ∈ s) (hn : n ≠ 0) : f x₀ = 0 :=
mem_of_mem_nhdsWithin hx₀ h.eq_zero_imp <| by simp_rw [sub_self, norm_zero, zero_pow hn]
#align asymptotics.is_O.eq_zero_of_norm_pow_within Asymptotics.IsBigO.eq_zero_of_norm_pow_within
theorem IsBigO.eq_zero_of_norm_pow {f : E'' → F''} {x₀ : E''} {n : ℕ}
(h : f =O[𝓝 x₀] fun x => ‖x - x₀‖ ^ n) (hn : n ≠ 0) : f x₀ = 0 := by
rw [← nhdsWithin_univ] at h
exact h.eq_zero_of_norm_pow_within (mem_univ _) hn
#align asymptotics.is_O.eq_zero_of_norm_pow Asymptotics.IsBigO.eq_zero_of_norm_pow
theorem isLittleO_pow_sub_pow_sub (x₀ : E') {n m : ℕ} (h : n < m) :
(fun x => ‖x - x₀‖ ^ m) =o[𝓝 x₀] fun x => ‖x - x₀‖ ^ n :=
haveI : Tendsto (fun x => ‖x - x₀‖) (𝓝 x₀) (𝓝 0) := by
apply tendsto_norm_zero.comp
rw [← sub_self x₀]
exact tendsto_id.sub tendsto_const_nhds
(isLittleO_pow_pow h).comp_tendsto this
#align asymptotics.is_o_pow_sub_pow_sub Asymptotics.isLittleO_pow_sub_pow_sub
theorem isLittleO_pow_sub_sub (x₀ : E') {m : ℕ} (h : 1 < m) :
(fun x => ‖x - x₀‖ ^ m) =o[𝓝 x₀] fun x => x - x₀ := by
simpa only [isLittleO_norm_right, pow_one] using isLittleO_pow_sub_pow_sub x₀ h
#align asymptotics.is_o_pow_sub_sub Asymptotics.isLittleO_pow_sub_sub
theorem IsBigOWith.right_le_sub_of_lt_one {f₁ f₂ : α → E'} (h : IsBigOWith c l f₁ f₂) (hc : c < 1) :
IsBigOWith (1 / (1 - c)) l f₂ fun x => f₂ x - f₁ x :=
IsBigOWith.of_bound <|
mem_of_superset h.bound fun x hx => by
simp only [mem_setOf_eq] at hx ⊢
rw [mul_comm, one_div, ← div_eq_mul_inv, _root_.le_div_iff, mul_sub, mul_one, mul_comm]
· exact le_trans (sub_le_sub_left hx _) (norm_sub_norm_le _ _)
· exact sub_pos.2 hc
#align asymptotics.is_O_with.right_le_sub_of_lt_1 Asymptotics.IsBigOWith.right_le_sub_of_lt_one
theorem IsBigOWith.right_le_add_of_lt_one {f₁ f₂ : α → E'} (h : IsBigOWith c l f₁ f₂) (hc : c < 1) :
IsBigOWith (1 / (1 - c)) l f₂ fun x => f₁ x + f₂ x :=
(h.neg_right.right_le_sub_of_lt_one hc).neg_right.of_neg_left.congr rfl (fun x ↦ rfl) fun x ↦ by
rw [neg_sub, sub_neg_eq_add]
#align asymptotics.is_O_with.right_le_add_of_lt_1 Asymptotics.IsBigOWith.right_le_add_of_lt_one
-- 2024-01-31
@[deprecated] alias IsBigOWith.right_le_sub_of_lt_1 := IsBigOWith.right_le_sub_of_lt_one
@[deprecated] alias IsBigOWith.right_le_add_of_lt_1 := IsBigOWith.right_le_add_of_lt_one
theorem IsLittleO.right_isBigO_sub {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂) :
f₂ =O[l] fun x => f₂ x - f₁ x :=
((h.def' one_half_pos).right_le_sub_of_lt_one one_half_lt_one).isBigO
#align asymptotics.is_o.right_is_O_sub Asymptotics.IsLittleO.right_isBigO_sub
theorem IsLittleO.right_isBigO_add {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂) :
f₂ =O[l] fun x => f₁ x + f₂ x :=
((h.def' one_half_pos).right_le_add_of_lt_one one_half_lt_one).isBigO
#align asymptotics.is_o.right_is_O_add Asymptotics.IsLittleO.right_isBigO_add
theorem IsLittleO.right_isBigO_add' {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂) :
f₂ =O[l] (f₂ + f₁) :=
add_comm f₁ f₂ ▸ h.right_isBigO_add
theorem bound_of_isBigO_cofinite (h : f =O[cofinite] g'') :
∃ C > 0, ∀ ⦃x⦄, g'' x ≠ 0 → ‖f x‖ ≤ C * ‖g'' x‖ := by
rcases h.exists_pos with ⟨C, C₀, hC⟩
rw [IsBigOWith_def, eventually_cofinite] at hC
rcases (hC.toFinset.image fun x => ‖f x‖ / ‖g'' x‖).exists_le with ⟨C', hC'⟩
have : ∀ x, C * ‖g'' x‖ < ‖f x‖ → ‖f x‖ / ‖g'' x‖ ≤ C' := by simpa using hC'
refine ⟨max C C', lt_max_iff.2 (Or.inl C₀), fun x h₀ => ?_⟩
rw [max_mul_of_nonneg _ _ (norm_nonneg _), le_max_iff, or_iff_not_imp_left, not_le]
exact fun hx => (div_le_iff (norm_pos_iff.2 h₀)).1 (this _ hx)
#align asymptotics.bound_of_is_O_cofinite Asymptotics.bound_of_isBigO_cofinite
theorem isBigO_cofinite_iff (h : ∀ x, g'' x = 0 → f'' x = 0) :
f'' =O[cofinite] g'' ↔ ∃ C, ∀ x, ‖f'' x‖ ≤ C * ‖g'' x‖ :=
⟨fun h' =>
let ⟨C, _C₀, hC⟩ := bound_of_isBigO_cofinite h'
⟨C, fun x => if hx : g'' x = 0 then by simp [h _ hx, hx] else hC hx⟩,
fun h => (isBigO_top.2 h).mono le_top⟩
#align asymptotics.is_O_cofinite_iff Asymptotics.isBigO_cofinite_iff
theorem bound_of_isBigO_nat_atTop {f : ℕ → E} {g'' : ℕ → E''} (h : f =O[atTop] g'') :
∃ C > 0, ∀ ⦃x⦄, g'' x ≠ 0 → ‖f x‖ ≤ C * ‖g'' x‖ :=
bound_of_isBigO_cofinite <| by rwa [Nat.cofinite_eq_atTop]
#align asymptotics.bound_of_is_O_nat_at_top Asymptotics.bound_of_isBigO_nat_atTop
theorem isBigO_nat_atTop_iff {f : ℕ → E''} {g : ℕ → F''} (h : ∀ x, g x = 0 → f x = 0) :
f =O[atTop] g ↔ ∃ C, ∀ x, ‖f x‖ ≤ C * ‖g x‖ := by
rw [← Nat.cofinite_eq_atTop, isBigO_cofinite_iff h]
#align asymptotics.is_O_nat_at_top_iff Asymptotics.isBigO_nat_atTop_iff
theorem isBigO_one_nat_atTop_iff {f : ℕ → E''} :
f =O[atTop] (fun _n => 1 : ℕ → ℝ) ↔ ∃ C, ∀ n, ‖f n‖ ≤ C :=
Iff.trans (isBigO_nat_atTop_iff fun n h => (one_ne_zero h).elim) <| by
simp only [norm_one, mul_one]
#align asymptotics.is_O_one_nat_at_top_iff Asymptotics.isBigO_one_nat_atTop_iff
theorem isBigOWith_pi {ι : Type*} [Fintype ι] {E' : ι → Type*} [∀ i, NormedAddCommGroup (E' i)]
{f : α → ∀ i, E' i} {C : ℝ} (hC : 0 ≤ C) :
IsBigOWith C l f g' ↔ ∀ i, IsBigOWith C l (fun x => f x i) g' := by
have : ∀ x, 0 ≤ C * ‖g' x‖ := fun x => mul_nonneg hC (norm_nonneg _)
simp only [isBigOWith_iff, pi_norm_le_iff_of_nonneg (this _), eventually_all]
#align asymptotics.is_O_with_pi Asymptotics.isBigOWith_pi
@[simp]
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 2,208 | 2,211 | theorem isBigO_pi {ι : Type*} [Fintype ι] {E' : ι → Type*} [∀ i, NormedAddCommGroup (E' i)]
{f : α → ∀ i, E' i} : f =O[l] g' ↔ ∀ i, (fun x => f x i) =O[l] g' := by |
simp only [isBigO_iff_eventually_isBigOWith, ← eventually_all]
exact eventually_congr (eventually_atTop.2 ⟨0, fun c => isBigOWith_pi⟩)
|
import Mathlib.Analysis.Complex.CauchyIntegral
import Mathlib.Analysis.NormedSpace.Completion
import Mathlib.Analysis.NormedSpace.Extr
import Mathlib.Topology.Order.ExtrClosure
#align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology
open scoped Topology Filter NNReal Real
universe u v w
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F]
[NormedSpace ℂ F]
local postfix:100 "̂" => UniformSpace.Completion
namespace Complex
theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ}
(hd : DiffContOnCl ℂ f (ball z (dist w z)))
(hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
-- Consider a circle of radius `r = dist w z`.
set r : ℝ := dist w z
have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl
-- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`.
refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_)
rintro hw_lt : ‖f w‖ < ‖f z‖
have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne)
-- Due to Cauchy integral formula, it suffices to prove the following inequality.
suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by
refine this.ne ?_
have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z :=
hd.circleIntegral_sub_inv_smul (mem_ball_self hr)
simp [A, norm_smul, Real.pi_pos.le]
suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by
rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this
have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall
refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩
· show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r)
refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub)
exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne')
· show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r
rintro ζ (hζ : abs (ζ - z) = r)
rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne']
exact hz (hsub hζ)
show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r
rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul]
exact (div_lt_div_right hr).2 hw_lt
#align complex.norm_max_aux₁ Complex.norm_max_aux₁
theorem norm_max_aux₂ {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z)))
(hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
set e : F →L[ℂ] F̂ := UniformSpace.Completion.toComplL
have he : ∀ x, ‖e x‖ = ‖x‖ := UniformSpace.Completion.norm_coe
replace hz : IsMaxOn (norm ∘ e ∘ f) (closedBall z (dist w z)) z := by
simpa only [IsMaxOn, (· ∘ ·), he] using hz
simpa only [he, (· ∘ ·)]
using norm_max_aux₁ (e.differentiable.comp_diffContOnCl hd) hz
#align complex.norm_max_aux₂ Complex.norm_max_aux₂
theorem norm_max_aux₃ {f : ℂ → F} {z w : ℂ} {r : ℝ} (hr : dist w z = r)
(hd : DiffContOnCl ℂ f (ball z r)) (hz : IsMaxOn (norm ∘ f) (ball z r) z) : ‖f w‖ = ‖f z‖ := by
subst r
rcases eq_or_ne w z with (rfl | hne); · rfl
rw [← dist_ne_zero] at hne
exact norm_max_aux₂ hd (closure_ball z hne ▸ hz.closure hd.continuousOn.norm)
#align complex.norm_max_aux₃ Complex.norm_max_aux₃
theorem norm_eqOn_closedBall_of_isMaxOn {f : E → F} {z : E} {r : ℝ}
(hd : DiffContOnCl ℂ f (ball z r)) (hz : IsMaxOn (norm ∘ f) (ball z r) z) :
EqOn (norm ∘ f) (const E ‖f z‖) (closedBall z r) := by
intro w hw
rw [mem_closedBall, dist_comm] at hw
rcases eq_or_ne z w with (rfl | hne); · rfl
set e := (lineMap z w : ℂ → E)
have hde : Differentiable ℂ e := (differentiable_id.smul_const (w - z)).add_const z
suffices ‖(f ∘ e) (1 : ℂ)‖ = ‖(f ∘ e) (0 : ℂ)‖ by simpa [e]
have hr : dist (1 : ℂ) 0 = 1 := by simp
have hball : MapsTo e (ball 0 1) (ball z r) := by
refine ((lipschitzWith_lineMap z w).mapsTo_ball (mt nndist_eq_zero.1 hne) 0 1).mono
Subset.rfl ?_
simpa only [lineMap_apply_zero, mul_one, coe_nndist] using ball_subset_ball hw
exact norm_max_aux₃ hr (hd.comp hde.diffContOnCl hball)
(hz.comp_mapsTo hball (lineMap_apply_zero z w))
#align complex.norm_eq_on_closed_ball_of_is_max_on Complex.norm_eqOn_closedBall_of_isMaxOn
theorem norm_eq_norm_of_isMaxOn_of_ball_subset {f : E → F} {s : Set E} {z w : E}
(hd : DiffContOnCl ℂ f s) (hz : IsMaxOn (norm ∘ f) s z) (hsub : ball z (dist w z) ⊆ s) :
‖f w‖ = ‖f z‖ :=
norm_eqOn_closedBall_of_isMaxOn (hd.mono hsub) (hz.on_subset hsub) (mem_closedBall.2 le_rfl)
#align complex.norm_eq_norm_of_is_max_on_of_ball_subset Complex.norm_eq_norm_of_isMaxOn_of_ball_subset
theorem norm_eventually_eq_of_isLocalMax {f : E → F} {c : E}
(hd : ∀ᶠ z in 𝓝 c, DifferentiableAt ℂ f z) (hc : IsLocalMax (norm ∘ f) c) :
∀ᶠ y in 𝓝 c, ‖f y‖ = ‖f c‖ := by
rcases nhds_basis_closedBall.eventually_iff.1 (hd.and hc) with ⟨r, hr₀, hr⟩
exact nhds_basis_closedBall.eventually_iff.2
⟨r, hr₀, norm_eqOn_closedBall_of_isMaxOn (DifferentiableOn.diffContOnCl fun x hx =>
(hr <| closure_ball_subset_closedBall hx).1.differentiableWithinAt) fun x hx =>
(hr <| ball_subset_closedBall hx).2⟩
#align complex.norm_eventually_eq_of_is_local_max Complex.norm_eventually_eq_of_isLocalMax
theorem isOpen_setOf_mem_nhds_and_isMaxOn_norm {f : E → F} {s : Set E}
(hd : DifferentiableOn ℂ f s) : IsOpen {z | s ∈ 𝓝 z ∧ IsMaxOn (norm ∘ f) s z} := by
refine isOpen_iff_mem_nhds.2 fun z hz => (eventually_eventually_nhds.2 hz.1).and ?_
replace hd : ∀ᶠ w in 𝓝 z, DifferentiableAt ℂ f w := hd.eventually_differentiableAt hz.1
exact (norm_eventually_eq_of_isLocalMax hd <| hz.2.isLocalMax hz.1).mono fun x hx y hy =>
le_trans (hz.2 hy).out hx.ge
#align complex.is_open_set_of_mem_nhds_and_is_max_on_norm Complex.isOpen_setOf_mem_nhds_and_isMaxOn_norm
theorem norm_eqOn_of_isPreconnected_of_isMaxOn {f : E → F} {U : Set E} {c : E}
(hc : IsPreconnected U) (ho : IsOpen U) (hd : DifferentiableOn ℂ f U) (hcU : c ∈ U)
(hm : IsMaxOn (norm ∘ f) U c) : EqOn (norm ∘ f) (const E ‖f c‖) U := by
set V := U ∩ {z | IsMaxOn (norm ∘ f) U z}
have hV : ∀ x ∈ V, ‖f x‖ = ‖f c‖ := fun x hx => le_antisymm (hm hx.1) (hx.2 hcU)
suffices U ⊆ V from fun x hx => hV x (this hx)
have hVo : IsOpen V := by
simpa only [ho.mem_nhds_iff, setOf_and, setOf_mem_eq]
using isOpen_setOf_mem_nhds_and_isMaxOn_norm hd
have hVne : (U ∩ V).Nonempty := ⟨c, hcU, hcU, hm⟩
set W := U ∩ {z | ‖f z‖ ≠ ‖f c‖}
have hWo : IsOpen W := hd.continuousOn.norm.isOpen_inter_preimage ho isOpen_ne
have hdVW : Disjoint V W := disjoint_left.mpr fun x hxV hxW => hxW.2 (hV x hxV)
have hUVW : U ⊆ V ∪ W := fun x hx =>
(eq_or_ne ‖f x‖ ‖f c‖).imp (fun h => ⟨hx, fun y hy => (hm hy).out.trans_eq h.symm⟩)
(And.intro hx)
exact hc.subset_left_of_subset_union hVo hWo hdVW hUVW hVne
#align complex.norm_eq_on_of_is_preconnected_of_is_max_on Complex.norm_eqOn_of_isPreconnected_of_isMaxOn
theorem norm_eqOn_closure_of_isPreconnected_of_isMaxOn {f : E → F} {U : Set E} {c : E}
(hc : IsPreconnected U) (ho : IsOpen U) (hd : DiffContOnCl ℂ f U) (hcU : c ∈ U)
(hm : IsMaxOn (norm ∘ f) U c) : EqOn (norm ∘ f) (const E ‖f c‖) (closure U) :=
(norm_eqOn_of_isPreconnected_of_isMaxOn hc ho hd.differentiableOn hcU hm).of_subset_closure
hd.continuousOn.norm continuousOn_const subset_closure Subset.rfl
#align complex.norm_eq_on_closure_of_is_preconnected_of_is_max_on Complex.norm_eqOn_closure_of_isPreconnected_of_isMaxOn
variable [Nontrivial E]
| Mathlib/Analysis/Complex/AbsMax.lean | 369 | 382 | theorem exists_mem_frontier_isMaxOn_norm [FiniteDimensional ℂ E] {f : E → F} {U : Set E}
(hb : IsBounded U) (hne : U.Nonempty) (hd : DiffContOnCl ℂ f U) :
∃ z ∈ frontier U, IsMaxOn (norm ∘ f) (closure U) z := by |
have hc : IsCompact (closure U) := hb.isCompact_closure
obtain ⟨w, hwU, hle⟩ : ∃ w ∈ closure U, IsMaxOn (norm ∘ f) (closure U) w :=
hc.exists_isMaxOn hne.closure hd.continuousOn.norm
rw [closure_eq_interior_union_frontier, mem_union] at hwU
cases' hwU with hwU hwU; rotate_left; · exact ⟨w, hwU, hle⟩
have : interior U ≠ univ := ne_top_of_le_ne_top hc.ne_univ interior_subset_closure
rcases exists_mem_frontier_infDist_compl_eq_dist hwU this with ⟨z, hzU, hzw⟩
refine ⟨z, frontier_interior_subset hzU, fun x hx => (hle hx).out.trans_eq ?_⟩
refine (norm_eq_norm_of_isMaxOn_of_ball_subset hd (hle.on_subset subset_closure) ?_).symm
rw [dist_comm, ← hzw]
exact ball_infDist_compl_subset.trans interior_subset
|
import Batteries.Tactic.SeqFocus
namespace Batteries
class TotalBLE (le : α → α → Bool) : Prop where
total : le a b ∨ le b a
class OrientedCmp (cmp : α → α → Ordering) : Prop where
symm (x y) : (cmp x y).swap = cmp y x
class TransCmp (cmp : α → α → Ordering) extends OrientedCmp cmp : Prop where
le_trans : cmp x y ≠ .gt → cmp y z ≠ .gt → cmp x z ≠ .gt
instance [inst : OrientedCmp cmp] : OrientedCmp (flip cmp) where
symm _ _ := inst.symm ..
instance [inst : TransCmp cmp] : TransCmp (flip cmp) where
le_trans h1 h2 := inst.le_trans h2 h1
class BEqCmp [BEq α] (cmp : α → α → Ordering) : Prop where
cmp_iff_beq : cmp x y = .eq ↔ x == y
theorem BEqCmp.cmp_iff_eq [BEq α] [LawfulBEq α] [BEqCmp (α := α) cmp] : cmp x y = .eq ↔ x = y := by
simp [BEqCmp.cmp_iff_beq]
class LTCmp [LT α] (cmp : α → α → Ordering) extends OrientedCmp cmp : Prop where
cmp_iff_lt : cmp x y = .lt ↔ x < y
theorem LTCmp.cmp_iff_gt [LT α] [LTCmp (α := α) cmp] : cmp x y = .gt ↔ y < x := by
rw [OrientedCmp.cmp_eq_gt, LTCmp.cmp_iff_lt]
class LECmp [LE α] (cmp : α → α → Ordering) extends OrientedCmp cmp : Prop where
cmp_iff_le : cmp x y ≠ .gt ↔ x ≤ y
theorem LECmp.cmp_iff_ge [LE α] [LECmp (α := α) cmp] : cmp x y ≠ .lt ↔ y ≤ x := by
rw [← OrientedCmp.cmp_ne_gt, LECmp.cmp_iff_le]
class LawfulCmp [LE α] [LT α] [BEq α] (cmp : α → α → Ordering) extends
TransCmp cmp, BEqCmp cmp, LTCmp cmp, LECmp cmp : Prop
abbrev OrientedOrd (α) [Ord α] := OrientedCmp (α := α) compare
abbrev TransOrd (α) [Ord α] := TransCmp (α := α) compare
abbrev BEqOrd (α) [BEq α] [Ord α] := BEqCmp (α := α) compare
abbrev LTOrd (α) [LT α] [Ord α] := LTCmp (α := α) compare
abbrev LEOrd (α) [LE α] [Ord α] := LECmp (α := α) compare
abbrev LawfulOrd (α) [LE α] [LT α] [BEq α] [Ord α] := LawfulCmp (α := α) compare
| .lake/packages/batteries/Batteries/Classes/Order.lean | 163 | 166 | theorem compareOfLessAndEq_eq_lt {x y : α} [LT α] [Decidable (x < y)] [DecidableEq α] :
compareOfLessAndEq x y = .lt ↔ x < y := by |
simp [compareOfLessAndEq]
split <;> simp
|
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : ℕ)
def divisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (ℕ × ℕ) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n ≠ 0) :
(Finset.range n).filter (· ∣ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
#align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
theorem cons_self_properDivisors (h : n ≠ 0) :
cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by
rw [cons_eq_insert, insert_self_properDivisors h]
#align nat.cons_self_proper_divisors Nat.cons_self_properDivisors
@[simp]
theorem mem_divisors {m : ℕ} : n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0 := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors]
simp only [hm, Ne, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter,
mem_range, and_iff_right_iff_imp, Nat.lt_succ_iff]
exact le_of_dvd hm.bot_lt
#align nat.mem_divisors Nat.mem_divisors
theorem one_mem_divisors : 1 ∈ divisors n ↔ n ≠ 0 := by simp
#align nat.one_mem_divisors Nat.one_mem_divisors
theorem mem_divisors_self (n : ℕ) (h : n ≠ 0) : n ∈ n.divisors :=
mem_divisors.2 ⟨dvd_rfl, h⟩
#align nat.mem_divisors_self Nat.mem_divisors_self
theorem dvd_of_mem_divisors {m : ℕ} (h : n ∈ divisors m) : n ∣ m := by
cases m
· apply dvd_zero
· simp [mem_divisors.1 h]
#align nat.dvd_of_mem_divisors Nat.dvd_of_mem_divisors
@[simp]
| Mathlib/NumberTheory/Divisors.lean | 116 | 131 | theorem mem_divisorsAntidiagonal {x : ℕ × ℕ} :
x ∈ divisorsAntidiagonal n ↔ x.fst * x.snd = n ∧ n ≠ 0 := by |
simp only [divisorsAntidiagonal, Finset.mem_Ico, Ne, Finset.mem_filter, Finset.mem_product]
rw [and_comm]
apply and_congr_right
rintro rfl
constructor <;> intro h
· contrapose! h
simp [h]
· rw [Nat.lt_add_one_iff, Nat.lt_add_one_iff]
rw [mul_eq_zero, not_or] at h
simp only [succ_le_of_lt (Nat.pos_of_ne_zero h.1), succ_le_of_lt (Nat.pos_of_ne_zero h.2),
true_and_iff]
exact
⟨Nat.le_mul_of_pos_right _ (Nat.pos_of_ne_zero h.2),
Nat.le_mul_of_pos_left _ (Nat.pos_of_ne_zero h.1)⟩
|
import Mathlib.Algebra.Polynomial.Reverse
import Mathlib.Algebra.Regular.SMul
#align_import data.polynomial.monic from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5"
noncomputable section
open Finset
open Polynomial
namespace Polynomial
universe u v y
variable {R : Type u} {S : Type v} {a b : R} {m n : ℕ} {ι : Type y}
section Semiring
variable [Semiring R] {p q r : R[X]}
theorem monic_zero_iff_subsingleton : Monic (0 : R[X]) ↔ Subsingleton R :=
subsingleton_iff_zero_eq_one
#align polynomial.monic_zero_iff_subsingleton Polynomial.monic_zero_iff_subsingleton
theorem not_monic_zero_iff : ¬Monic (0 : R[X]) ↔ (0 : R) ≠ 1 :=
(monic_zero_iff_subsingleton.trans subsingleton_iff_zero_eq_one.symm).not
#align polynomial.not_monic_zero_iff Polynomial.not_monic_zero_iff
theorem monic_zero_iff_subsingleton' :
Monic (0 : R[X]) ↔ (∀ f g : R[X], f = g) ∧ ∀ a b : R, a = b :=
Polynomial.monic_zero_iff_subsingleton.trans
⟨by
intro
simp [eq_iff_true_of_subsingleton], fun h => subsingleton_iff.mpr h.2⟩
#align polynomial.monic_zero_iff_subsingleton' Polynomial.monic_zero_iff_subsingleton'
theorem Monic.as_sum (hp : p.Monic) :
p = X ^ p.natDegree + ∑ i ∈ range p.natDegree, C (p.coeff i) * X ^ i := by
conv_lhs => rw [p.as_sum_range_C_mul_X_pow, sum_range_succ_comm]
suffices C (p.coeff p.natDegree) = 1 by rw [this, one_mul]
exact congr_arg C hp
#align polynomial.monic.as_sum Polynomial.Monic.as_sum
theorem ne_zero_of_ne_zero_of_monic (hp : p ≠ 0) (hq : Monic q) : q ≠ 0 := by
rintro rfl
rw [Monic.def, leadingCoeff_zero] at hq
rw [← mul_one p, ← C_1, ← hq, C_0, mul_zero] at hp
exact hp rfl
#align polynomial.ne_zero_of_ne_zero_of_monic Polynomial.ne_zero_of_ne_zero_of_monic
theorem Monic.map [Semiring S] (f : R →+* S) (hp : Monic p) : Monic (p.map f) := by
unfold Monic
nontriviality
have : f p.leadingCoeff ≠ 0 := by
rw [show _ = _ from hp, f.map_one]
exact one_ne_zero
rw [Polynomial.leadingCoeff, coeff_map]
suffices p.coeff (p.map f).natDegree = 1 by simp [this]
rwa [natDegree_eq_of_degree_eq (degree_map_eq_of_leadingCoeff_ne_zero f this)]
#align polynomial.monic.map Polynomial.Monic.map
theorem monic_C_mul_of_mul_leadingCoeff_eq_one {b : R} (hp : b * p.leadingCoeff = 1) :
Monic (C b * p) := by
unfold Monic
nontriviality
rw [leadingCoeff_mul' _] <;> simp [leadingCoeff_C b, hp]
set_option linter.uppercaseLean3 false in
#align polynomial.monic_C_mul_of_mul_leading_coeff_eq_one Polynomial.monic_C_mul_of_mul_leadingCoeff_eq_one
theorem monic_mul_C_of_leadingCoeff_mul_eq_one {b : R} (hp : p.leadingCoeff * b = 1) :
Monic (p * C b) := by
unfold Monic
nontriviality
rw [leadingCoeff_mul' _] <;> simp [leadingCoeff_C b, hp]
set_option linter.uppercaseLean3 false in
#align polynomial.monic_mul_C_of_leading_coeff_mul_eq_one Polynomial.monic_mul_C_of_leadingCoeff_mul_eq_one
theorem monic_of_degree_le (n : ℕ) (H1 : degree p ≤ n) (H2 : coeff p n = 1) : Monic p :=
Decidable.byCases
(fun H : degree p < n => eq_of_zero_eq_one (H2 ▸ (coeff_eq_zero_of_degree_lt H).symm) _ _)
fun H : ¬degree p < n => by
rwa [Monic, Polynomial.leadingCoeff, natDegree, (lt_or_eq_of_le H1).resolve_left H]
#align polynomial.monic_of_degree_le Polynomial.monic_of_degree_le
theorem monic_X_pow_add {n : ℕ} (H : degree p ≤ n) : Monic (X ^ (n + 1) + p) :=
have H1 : degree p < (n + 1 : ℕ) := lt_of_le_of_lt H (WithBot.coe_lt_coe.2 (Nat.lt_succ_self n))
monic_of_degree_le (n + 1)
(le_trans (degree_add_le _ _) (max_le (degree_X_pow_le _) (le_of_lt H1)))
(by rw [coeff_add, coeff_X_pow, if_pos rfl, coeff_eq_zero_of_degree_lt H1, add_zero])
set_option linter.uppercaseLean3 false in
#align polynomial.monic_X_pow_add Polynomial.monic_X_pow_add
variable (a) in
theorem monic_X_pow_add_C {n : ℕ} (h : n ≠ 0) : (X ^ n + C a).Monic := by
obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
exact monic_X_pow_add <| degree_C_le.trans Nat.WithBot.coe_nonneg
theorem monic_X_add_C (x : R) : Monic (X + C x) :=
pow_one (X : R[X]) ▸ monic_X_pow_add_C x one_ne_zero
set_option linter.uppercaseLean3 false in
#align polynomial.monic_X_add_C Polynomial.monic_X_add_C
theorem Monic.mul (hp : Monic p) (hq : Monic q) : Monic (p * q) :=
letI := Classical.decEq R
if h0 : (0 : R) = 1 then
haveI := subsingleton_of_zero_eq_one h0
Subsingleton.elim _ _
else by
have : p.leadingCoeff * q.leadingCoeff ≠ 0 := by
simp [Monic.def.1 hp, Monic.def.1 hq, Ne.symm h0]
rw [Monic.def, leadingCoeff_mul' this, Monic.def.1 hp, Monic.def.1 hq, one_mul]
#align polynomial.monic.mul Polynomial.Monic.mul
theorem Monic.pow (hp : Monic p) : ∀ n : ℕ, Monic (p ^ n)
| 0 => monic_one
| n + 1 => by
rw [pow_succ]
exact (Monic.pow hp n).mul hp
#align polynomial.monic.pow Polynomial.Monic.pow
theorem Monic.add_of_left (hp : Monic p) (hpq : degree q < degree p) : Monic (p + q) := by
rwa [Monic, add_comm, leadingCoeff_add_of_degree_lt hpq]
#align polynomial.monic.add_of_left Polynomial.Monic.add_of_left
theorem Monic.add_of_right (hq : Monic q) (hpq : degree p < degree q) : Monic (p + q) := by
rwa [Monic, leadingCoeff_add_of_degree_lt hpq]
#align polynomial.monic.add_of_right Polynomial.Monic.add_of_right
theorem Monic.of_mul_monic_left (hp : p.Monic) (hpq : (p * q).Monic) : q.Monic := by
contrapose! hpq
rw [Monic.def] at hpq ⊢
rwa [leadingCoeff_monic_mul hp]
#align polynomial.monic.of_mul_monic_left Polynomial.Monic.of_mul_monic_left
theorem Monic.of_mul_monic_right (hq : q.Monic) (hpq : (p * q).Monic) : p.Monic := by
contrapose! hpq
rw [Monic.def] at hpq ⊢
rwa [leadingCoeff_mul_monic hq]
#align polynomial.monic.of_mul_monic_right Polynomial.Monic.of_mul_monic_right
namespace Monic
@[simp]
theorem natDegree_eq_zero_iff_eq_one (hp : p.Monic) : p.natDegree = 0 ↔ p = 1 := by
constructor <;> intro h
swap
· rw [h]
exact natDegree_one
have : p = C (p.coeff 0) := by
rw [← Polynomial.degree_le_zero_iff]
rwa [Polynomial.natDegree_eq_zero_iff_degree_le_zero] at h
rw [this]
rw [← h, ← Polynomial.leadingCoeff, Monic.def.1 hp, C_1]
#align polynomial.monic.nat_degree_eq_zero_iff_eq_one Polynomial.Monic.natDegree_eq_zero_iff_eq_one
@[simp]
theorem degree_le_zero_iff_eq_one (hp : p.Monic) : p.degree ≤ 0 ↔ p = 1 := by
rw [← hp.natDegree_eq_zero_iff_eq_one, natDegree_eq_zero_iff_degree_le_zero]
#align polynomial.monic.degree_le_zero_iff_eq_one Polynomial.Monic.degree_le_zero_iff_eq_one
theorem natDegree_mul (hp : p.Monic) (hq : q.Monic) :
(p * q).natDegree = p.natDegree + q.natDegree := by
nontriviality R
apply natDegree_mul'
simp [hp.leadingCoeff, hq.leadingCoeff]
#align polynomial.monic.nat_degree_mul Polynomial.Monic.natDegree_mul
| Mathlib/Algebra/Polynomial/Monic.lean | 182 | 187 | theorem degree_mul_comm (hp : p.Monic) (q : R[X]) : (p * q).degree = (q * p).degree := by |
by_cases h : q = 0
· simp [h]
rw [degree_mul', hp.degree_mul]
· exact add_comm _ _
· rwa [hp.leadingCoeff, one_mul, leadingCoeff_ne_zero]
|
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.Tactic.FieldSimp
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.Basis
#align_import linear_algebra.determinant from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
noncomputable section
open Matrix LinearMap Submodule Set Function
universe u v w
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {M' : Type*} [AddCommGroup M'] [Module R M']
variable {ι : Type*} [DecidableEq ι] [Fintype ι]
variable (e : Basis ι R M)
section Conjugate
variable {A : Type*} [CommRing A]
variable {m n : Type*}
def equivOfPiLEquivPi {R : Type*} [Finite m] [Finite n] [CommRing R] [Nontrivial R]
(e : (m → R) ≃ₗ[R] n → R) : m ≃ n :=
Basis.indexEquiv (Basis.ofEquivFun e.symm) (Pi.basisFun _ _)
#align equiv_of_pi_lequiv_pi equivOfPiLEquivPi
@[simp]
theorem LinearEquiv.det_mul_det_symm {A : Type*} [CommRing A] [Module A M] (f : M ≃ₗ[A] M) :
LinearMap.det (f : M →ₗ[A] M) * LinearMap.det (f.symm : M →ₗ[A] M) = 1 := by
simp [← LinearMap.det_comp]
#align linear_equiv.det_mul_det_symm LinearEquiv.det_mul_det_symm
@[simp]
theorem LinearEquiv.det_symm_mul_det {A : Type*} [CommRing A] [Module A M] (f : M ≃ₗ[A] M) :
LinearMap.det (f.symm : M →ₗ[A] M) * LinearMap.det (f : M →ₗ[A] M) = 1 := by
simp [← LinearMap.det_comp]
#align linear_equiv.det_symm_mul_det LinearEquiv.det_symm_mul_det
-- Cannot be stated using `LinearMap.det` because `f` is not an endomorphism.
| Mathlib/LinearAlgebra/Determinant.lean | 424 | 427 | theorem LinearEquiv.isUnit_det (f : M ≃ₗ[R] M') (v : Basis ι R M) (v' : Basis ι R M') :
IsUnit (LinearMap.toMatrix v v' f).det := by |
apply isUnit_det_of_left_inverse
simpa using (LinearMap.toMatrix_comp v v' v f.symm f).symm
|
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Zip
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Infix
#align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u
variable {α : Type u}
open Nat Function
namespace List
theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by simp [rotate]
#align list.rotate_mod List.rotate_mod
@[simp]
theorem rotate_nil (n : ℕ) : ([] : List α).rotate n = [] := by simp [rotate]
#align list.rotate_nil List.rotate_nil
@[simp]
theorem rotate_zero (l : List α) : l.rotate 0 = l := by simp [rotate]
#align list.rotate_zero List.rotate_zero
-- Porting note: removing simp, simp can prove it
| Mathlib/Data/List/Rotate.lean | 49 | 49 | theorem rotate'_nil (n : ℕ) : ([] : List α).rotate' n = [] := by | cases n <;> rfl
|
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 : ℝ} {n : ℕ}
theorem rpow_mul {x : ℝ} (hx : 0 ≤ x) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z := by
rw [← Complex.ofReal_inj, Complex.ofReal_cpow (rpow_nonneg hx _),
Complex.ofReal_cpow hx, Complex.ofReal_mul, Complex.cpow_mul, Complex.ofReal_cpow hx] <;>
simp only [(Complex.ofReal_mul _ _).symm, (Complex.ofReal_log hx).symm, Complex.ofReal_im,
neg_lt_zero, pi_pos, le_of_lt pi_pos]
#align real.rpow_mul Real.rpow_mul
theorem rpow_add_int {x : ℝ} (hx : x ≠ 0) (y : ℝ) (n : ℤ) : x ^ (y + n) = x ^ y * x ^ n := by
rw [rpow_def, rpow_def, Complex.ofReal_add,
Complex.cpow_add _ _ (Complex.ofReal_ne_zero.mpr hx), Complex.ofReal_intCast,
Complex.cpow_intCast, ← Complex.ofReal_zpow, mul_comm, Complex.re_ofReal_mul, mul_comm]
#align real.rpow_add_int Real.rpow_add_int
theorem rpow_add_nat {x : ℝ} (hx : x ≠ 0) (y : ℝ) (n : ℕ) : x ^ (y + n) = x ^ y * x ^ n := by
simpa using rpow_add_int hx y n
#align real.rpow_add_nat Real.rpow_add_nat
theorem rpow_sub_int {x : ℝ} (hx : x ≠ 0) (y : ℝ) (n : ℕ) : x ^ (y - n) = x ^ y / x ^ n := by
simpa using rpow_add_int hx y (-n)
#align real.rpow_sub_int Real.rpow_sub_int
theorem rpow_sub_nat {x : ℝ} (hx : x ≠ 0) (y : ℝ) (n : ℕ) : x ^ (y - n) = x ^ y / x ^ n := by
simpa using rpow_sub_int hx y n
#align real.rpow_sub_nat Real.rpow_sub_nat
lemma rpow_add_int' (hx : 0 ≤ x) {n : ℤ} (h : y + n ≠ 0) : x ^ (y + n) = x ^ y * x ^ n := by
rw [rpow_add' hx h, rpow_intCast]
lemma rpow_add_nat' (hx : 0 ≤ x) (h : y + n ≠ 0) : x ^ (y + n) = x ^ y * x ^ n := by
rw [rpow_add' hx h, rpow_natCast]
lemma rpow_sub_int' (hx : 0 ≤ x) {n : ℤ} (h : y - n ≠ 0) : x ^ (y - n) = x ^ y / x ^ n := by
rw [rpow_sub' hx h, rpow_intCast]
lemma rpow_sub_nat' (hx : 0 ≤ x) (h : y - n ≠ 0) : x ^ (y - n) = x ^ y / x ^ n := by
rw [rpow_sub' hx h, rpow_natCast]
theorem rpow_add_one {x : ℝ} (hx : x ≠ 0) (y : ℝ) : x ^ (y + 1) = x ^ y * x := by
simpa using rpow_add_nat hx y 1
#align real.rpow_add_one Real.rpow_add_one
theorem rpow_sub_one {x : ℝ} (hx : x ≠ 0) (y : ℝ) : x ^ (y - 1) = x ^ y / x := by
simpa using rpow_sub_nat hx y 1
#align real.rpow_sub_one Real.rpow_sub_one
lemma rpow_add_one' (hx : 0 ≤ x) (h : y + 1 ≠ 0) : x ^ (y + 1) = x ^ y * x := by
rw [rpow_add' hx h, rpow_one]
lemma rpow_one_add' (hx : 0 ≤ x) (h : 1 + y ≠ 0) : x ^ (1 + y) = x * x ^ y := by
rw [rpow_add' hx h, rpow_one]
lemma rpow_sub_one' (hx : 0 ≤ x) (h : y - 1 ≠ 0) : x ^ (y - 1) = x ^ y / x := by
rw [rpow_sub' hx h, rpow_one]
lemma rpow_one_sub' (hx : 0 ≤ x) (h : 1 - y ≠ 0) : x ^ (1 - y) = x / x ^ y := by
rw [rpow_sub' hx h, rpow_one]
@[simp]
theorem rpow_two (x : ℝ) : x ^ (2 : ℝ) = x ^ 2 := by
rw [← rpow_natCast]
simp only [Nat.cast_ofNat]
#align real.rpow_two Real.rpow_two
theorem rpow_neg_one (x : ℝ) : x ^ (-1 : ℝ) = x⁻¹ := by
suffices H : x ^ ((-1 : ℤ) : ℝ) = x⁻¹ by rwa [Int.cast_neg, Int.cast_one] at H
simp only [rpow_intCast, zpow_one, zpow_neg]
#align real.rpow_neg_one Real.rpow_neg_one
theorem mul_rpow (hx : 0 ≤ x) (hy : 0 ≤ y) : (x * y) ^ z = x ^ z * y ^ z := by
iterate 2 rw [Real.rpow_def_of_nonneg]; split_ifs with h_ifs <;> simp_all
· rw [log_mul ‹_› ‹_›, add_mul, exp_add, rpow_def_of_pos (hy.lt_of_ne' ‹_›)]
all_goals positivity
#align real.mul_rpow Real.mul_rpow
theorem inv_rpow (hx : 0 ≤ x) (y : ℝ) : x⁻¹ ^ y = (x ^ y)⁻¹ := by
simp only [← rpow_neg_one, ← rpow_mul hx, mul_comm]
#align real.inv_rpow Real.inv_rpow
theorem div_rpow (hx : 0 ≤ x) (hy : 0 ≤ y) (z : ℝ) : (x / y) ^ z = x ^ z / y ^ z := by
simp only [div_eq_mul_inv, mul_rpow hx (inv_nonneg.2 hy), inv_rpow hy]
#align real.div_rpow Real.div_rpow
theorem log_rpow {x : ℝ} (hx : 0 < x) (y : ℝ) : log (x ^ y) = y * log x := by
apply exp_injective
rw [exp_log (rpow_pos_of_pos hx y), ← exp_log hx, mul_comm, rpow_def_of_pos (exp_pos (log x)) y]
#align real.log_rpow Real.log_rpow
theorem mul_log_eq_log_iff {x y z : ℝ} (hx : 0 < x) (hz : 0 < z) :
y * log x = log z ↔ x ^ y = z :=
⟨fun h ↦ log_injOn_pos (rpow_pos_of_pos hx _) hz <| log_rpow hx _ |>.trans h,
by rintro rfl; rw [log_rpow hx]⟩
@[simp] lemma rpow_rpow_inv (hx : 0 ≤ x) (hy : y ≠ 0) : (x ^ y) ^ y⁻¹ = x := by
rw [← rpow_mul hx, mul_inv_cancel hy, rpow_one]
@[simp] lemma rpow_inv_rpow (hx : 0 ≤ x) (hy : y ≠ 0) : (x ^ y⁻¹) ^ y = x := by
rw [← rpow_mul hx, inv_mul_cancel hy, rpow_one]
theorem pow_rpow_inv_natCast (hx : 0 ≤ x) (hn : n ≠ 0) : (x ^ n) ^ (n⁻¹ : ℝ) = x := by
have hn0 : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.2 hn
rw [← rpow_natCast, ← rpow_mul hx, mul_inv_cancel hn0, rpow_one]
#align real.pow_nat_rpow_nat_inv Real.pow_rpow_inv_natCast
theorem rpow_inv_natCast_pow (hx : 0 ≤ x) (hn : n ≠ 0) : (x ^ (n⁻¹ : ℝ)) ^ n = x := by
have hn0 : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.2 hn
rw [← rpow_natCast, ← rpow_mul hx, inv_mul_cancel hn0, rpow_one]
#align real.rpow_nat_inv_pow_nat Real.rpow_inv_natCast_pow
lemma rpow_natCast_mul (hx : 0 ≤ x) (n : ℕ) (z : ℝ) : x ^ (n * z) = (x ^ n) ^ z := by
rw [rpow_mul hx, rpow_natCast]
lemma rpow_mul_natCast (hx : 0 ≤ x) (y : ℝ) (n : ℕ) : x ^ (y * n) = (x ^ y) ^ n := by
rw [rpow_mul hx, rpow_natCast]
lemma rpow_intCast_mul (hx : 0 ≤ x) (n : ℤ) (z : ℝ) : x ^ (n * z) = (x ^ n) ^ z := by
rw [rpow_mul hx, rpow_intCast]
lemma rpow_mul_intCast (hx : 0 ≤ x) (y : ℝ) (n : ℤ) : x ^ (y * n) = (x ^ y) ^ n := by
rw [rpow_mul hx, rpow_intCast]
@[gcongr]
theorem rpow_lt_rpow (hx : 0 ≤ x) (hxy : x < y) (hz : 0 < z) : x ^ z < y ^ z := by
rw [le_iff_eq_or_lt] at hx; cases' hx with hx hx
· rw [← hx, zero_rpow (ne_of_gt hz)]
exact rpow_pos_of_pos (by rwa [← hx] at hxy) _
· rw [rpow_def_of_pos hx, rpow_def_of_pos (lt_trans hx hxy), exp_lt_exp]
exact mul_lt_mul_of_pos_right (log_lt_log hx hxy) hz
#align real.rpow_lt_rpow Real.rpow_lt_rpow
theorem strictMonoOn_rpow_Ici_of_exponent_pos {r : ℝ} (hr : 0 < r) :
StrictMonoOn (fun (x : ℝ) => x ^ r) (Set.Ici 0) :=
fun _ ha _ _ hab => rpow_lt_rpow ha hab hr
@[gcongr]
theorem rpow_le_rpow {x y z : ℝ} (h : 0 ≤ x) (h₁ : x ≤ y) (h₂ : 0 ≤ z) : x ^ z ≤ y ^ z := by
rcases eq_or_lt_of_le h₁ with (rfl | h₁'); · rfl
rcases eq_or_lt_of_le h₂ with (rfl | h₂'); · simp
exact le_of_lt (rpow_lt_rpow h h₁' h₂')
#align real.rpow_le_rpow Real.rpow_le_rpow
theorem monotoneOn_rpow_Ici_of_exponent_nonneg {r : ℝ} (hr : 0 ≤ r) :
MonotoneOn (fun (x : ℝ) => x ^ r) (Set.Ici 0) :=
fun _ ha _ _ hab => rpow_le_rpow ha hab hr
lemma rpow_lt_rpow_of_neg (hx : 0 < x) (hxy : x < y) (hz : z < 0) : y ^ z < x ^ z := by
have := hx.trans hxy
rw [← inv_lt_inv, ← rpow_neg, ← rpow_neg]
on_goal 1 => refine rpow_lt_rpow ?_ hxy (neg_pos.2 hz)
all_goals positivity
lemma rpow_le_rpow_of_nonpos (hx : 0 < x) (hxy : x ≤ y) (hz : z ≤ 0) : y ^ z ≤ x ^ z := by
have := hx.trans_le hxy
rw [← inv_le_inv, ← rpow_neg, ← rpow_neg]
on_goal 1 => refine rpow_le_rpow ?_ hxy (neg_nonneg.2 hz)
all_goals positivity
theorem rpow_lt_rpow_iff (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x ^ z < y ^ z ↔ x < y :=
⟨lt_imp_lt_of_le_imp_le fun h => rpow_le_rpow hy h (le_of_lt hz), fun h => rpow_lt_rpow hx h hz⟩
#align real.rpow_lt_rpow_iff Real.rpow_lt_rpow_iff
theorem rpow_le_rpow_iff (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x ^ z ≤ y ^ z ↔ x ≤ y :=
le_iff_le_iff_lt_iff_lt.2 <| rpow_lt_rpow_iff hy hx hz
#align real.rpow_le_rpow_iff Real.rpow_le_rpow_iff
lemma rpow_lt_rpow_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) : x ^ z < y ^ z ↔ y < x :=
⟨lt_imp_lt_of_le_imp_le fun h ↦ rpow_le_rpow_of_nonpos hx h hz.le,
fun h ↦ rpow_lt_rpow_of_neg hy h hz⟩
lemma rpow_le_rpow_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) : x ^ z ≤ y ^ z ↔ y ≤ x :=
le_iff_le_iff_lt_iff_lt.2 <| rpow_lt_rpow_iff_of_neg hy hx hz
lemma le_rpow_inv_iff_of_pos (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x ≤ y ^ z⁻¹ ↔ x ^ z ≤ y := by
rw [← rpow_le_rpow_iff hx _ hz, rpow_inv_rpow] <;> positivity
lemma rpow_inv_le_iff_of_pos (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x ^ z⁻¹ ≤ y ↔ x ≤ y ^ z := by
rw [← rpow_le_rpow_iff _ hy hz, rpow_inv_rpow] <;> positivity
lemma lt_rpow_inv_iff_of_pos (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x < y ^ z⁻¹ ↔ x ^ z < y :=
lt_iff_lt_of_le_iff_le <| rpow_inv_le_iff_of_pos hy hx hz
lemma rpow_inv_lt_iff_of_pos (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 < z) : x ^ z⁻¹ < y ↔ x < y ^ z :=
lt_iff_lt_of_le_iff_le <| le_rpow_inv_iff_of_pos hy hx hz
theorem le_rpow_inv_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) :
x ≤ y ^ z⁻¹ ↔ y ≤ x ^ z := by
rw [← rpow_le_rpow_iff_of_neg _ hx hz, rpow_inv_rpow _ hz.ne] <;> positivity
#align real.le_rpow_inv_iff_of_neg Real.le_rpow_inv_iff_of_neg
theorem lt_rpow_inv_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) :
x < y ^ z⁻¹ ↔ y < x ^ z := by
rw [← rpow_lt_rpow_iff_of_neg _ hx hz, rpow_inv_rpow _ hz.ne] <;> positivity
#align real.lt_rpow_inv_iff_of_neg Real.lt_rpow_inv_iff_of_neg
theorem rpow_inv_lt_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) :
x ^ z⁻¹ < y ↔ y ^ z < x := by
rw [← rpow_lt_rpow_iff_of_neg hy _ hz, rpow_inv_rpow _ hz.ne] <;> positivity
#align real.rpow_inv_lt_iff_of_neg Real.rpow_inv_lt_iff_of_neg
theorem rpow_inv_le_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) :
x ^ z⁻¹ ≤ y ↔ y ^ z ≤ x := by
rw [← rpow_le_rpow_iff_of_neg hy _ hz, rpow_inv_rpow _ hz.ne] <;> positivity
#align real.rpow_inv_le_iff_of_neg Real.rpow_inv_le_iff_of_neg
theorem rpow_lt_rpow_of_exponent_lt (hx : 1 < x) (hyz : y < z) : x ^ y < x ^ z := by
repeat' rw [rpow_def_of_pos (lt_trans zero_lt_one hx)]
rw [exp_lt_exp]; exact mul_lt_mul_of_pos_left hyz (log_pos hx)
#align real.rpow_lt_rpow_of_exponent_lt Real.rpow_lt_rpow_of_exponent_lt
@[gcongr]
theorem rpow_le_rpow_of_exponent_le (hx : 1 ≤ x) (hyz : y ≤ z) : x ^ y ≤ x ^ z := by
repeat' rw [rpow_def_of_pos (lt_of_lt_of_le zero_lt_one hx)]
rw [exp_le_exp]; exact mul_le_mul_of_nonneg_left hyz (log_nonneg hx)
#align real.rpow_le_rpow_of_exponent_le Real.rpow_le_rpow_of_exponent_le
theorem rpow_lt_rpow_of_exponent_neg {x y z : ℝ} (hy : 0 < y) (hxy : y < x) (hz : z < 0) :
x ^ z < y ^ z := by
have hx : 0 < x := hy.trans hxy
rw [← neg_neg z, Real.rpow_neg (le_of_lt hx) (-z), Real.rpow_neg (le_of_lt hy) (-z),
inv_lt_inv (rpow_pos_of_pos hx _) (rpow_pos_of_pos hy _)]
exact Real.rpow_lt_rpow (by positivity) hxy <| neg_pos_of_neg hz
theorem strictAntiOn_rpow_Ioi_of_exponent_neg {r : ℝ} (hr : r < 0) :
StrictAntiOn (fun (x:ℝ) => x ^ r) (Set.Ioi 0) :=
fun _ ha _ _ hab => rpow_lt_rpow_of_exponent_neg ha hab hr
theorem rpow_le_rpow_of_exponent_nonpos {x y : ℝ} (hy : 0 < y) (hxy : y ≤ x) (hz : z ≤ 0) :
x ^ z ≤ y ^ z := by
rcases ne_or_eq z 0 with hz_zero | rfl
case inl =>
rcases ne_or_eq x y with hxy' | rfl
case inl =>
exact le_of_lt <| rpow_lt_rpow_of_exponent_neg hy (Ne.lt_of_le (id (Ne.symm hxy')) hxy)
(Ne.lt_of_le hz_zero hz)
case inr => simp
case inr => simp
theorem antitoneOn_rpow_Ioi_of_exponent_nonpos {r : ℝ} (hr : r ≤ 0) :
AntitoneOn (fun (x:ℝ) => x ^ r) (Set.Ioi 0) :=
fun _ ha _ _ hab => rpow_le_rpow_of_exponent_nonpos ha hab hr
@[simp]
theorem rpow_le_rpow_left_iff (hx : 1 < x) : x ^ y ≤ x ^ z ↔ y ≤ z := by
have x_pos : 0 < x := lt_trans zero_lt_one hx
rw [← log_le_log_iff (rpow_pos_of_pos x_pos y) (rpow_pos_of_pos x_pos z), log_rpow x_pos,
log_rpow x_pos, mul_le_mul_right (log_pos hx)]
#align real.rpow_le_rpow_left_iff Real.rpow_le_rpow_left_iff
@[simp]
theorem rpow_lt_rpow_left_iff (hx : 1 < x) : x ^ y < x ^ z ↔ y < z := by
rw [lt_iff_not_le, rpow_le_rpow_left_iff hx, lt_iff_not_le]
#align real.rpow_lt_rpow_left_iff Real.rpow_lt_rpow_left_iff
theorem rpow_lt_rpow_of_exponent_gt (hx0 : 0 < x) (hx1 : x < 1) (hyz : z < y) : x ^ y < x ^ z := by
repeat' rw [rpow_def_of_pos hx0]
rw [exp_lt_exp]; exact mul_lt_mul_of_neg_left hyz (log_neg hx0 hx1)
#align real.rpow_lt_rpow_of_exponent_gt Real.rpow_lt_rpow_of_exponent_gt
theorem rpow_le_rpow_of_exponent_ge (hx0 : 0 < x) (hx1 : x ≤ 1) (hyz : z ≤ y) : x ^ y ≤ x ^ z := by
repeat' rw [rpow_def_of_pos hx0]
rw [exp_le_exp]; exact mul_le_mul_of_nonpos_left hyz (log_nonpos (le_of_lt hx0) hx1)
#align real.rpow_le_rpow_of_exponent_ge Real.rpow_le_rpow_of_exponent_ge
@[simp]
theorem rpow_le_rpow_left_iff_of_base_lt_one (hx0 : 0 < x) (hx1 : x < 1) :
x ^ y ≤ x ^ z ↔ z ≤ y := by
rw [← log_le_log_iff (rpow_pos_of_pos hx0 y) (rpow_pos_of_pos hx0 z), log_rpow hx0, log_rpow hx0,
mul_le_mul_right_of_neg (log_neg hx0 hx1)]
#align real.rpow_le_rpow_left_iff_of_base_lt_one Real.rpow_le_rpow_left_iff_of_base_lt_one
@[simp]
theorem rpow_lt_rpow_left_iff_of_base_lt_one (hx0 : 0 < x) (hx1 : x < 1) :
x ^ y < x ^ z ↔ z < y := by
rw [lt_iff_not_le, rpow_le_rpow_left_iff_of_base_lt_one hx0 hx1, lt_iff_not_le]
#align real.rpow_lt_rpow_left_iff_of_base_lt_one Real.rpow_lt_rpow_left_iff_of_base_lt_one
theorem rpow_lt_one {x z : ℝ} (hx1 : 0 ≤ x) (hx2 : x < 1) (hz : 0 < z) : x ^ z < 1 := by
rw [← one_rpow z]
exact rpow_lt_rpow hx1 hx2 hz
#align real.rpow_lt_one Real.rpow_lt_one
theorem rpow_le_one {x z : ℝ} (hx1 : 0 ≤ x) (hx2 : x ≤ 1) (hz : 0 ≤ z) : x ^ z ≤ 1 := by
rw [← one_rpow z]
exact rpow_le_rpow hx1 hx2 hz
#align real.rpow_le_one Real.rpow_le_one
| Mathlib/Analysis/SpecialFunctions/Pow/Real.lean | 703 | 705 | theorem rpow_lt_one_of_one_lt_of_neg {x z : ℝ} (hx : 1 < x) (hz : z < 0) : x ^ z < 1 := by |
convert rpow_lt_rpow_of_exponent_lt hx hz
exact (rpow_zero x).symm
|
import Mathlib.GroupTheory.Sylow
import Mathlib.GroupTheory.Transfer
#align_import group_theory.schur_zassenhaus from "leanprover-community/mathlib"@"d57133e49cf06508700ef69030cd099917e0f0de"
namespace Subgroup
open scoped Classical
universe u
variable {n : ℕ} {G : Type u} [Group G]
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
{N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
∃ H : Subgroup G, IsComplement' N H := by
revert G
apply Nat.strongInductionOn n
rintro n ih G _ _ rfl N _ hN
refine not_forall_not.mp fun h3 => ?_
haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by apply ih _ hG'; rfl) h3
rw [← Nat.card_eq_fintype_card] at hN
exact not_exists_of_forall_not h3 (exists_right_complement'_of_coprime_aux hN)
theorem exists_right_complement'_of_coprime_of_fintype [Fintype G] {N : Subgroup G} [N.Normal]
(hN : Nat.Coprime (Fintype.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H :=
exists_right_complement'_of_coprime_aux' rfl hN
#align subgroup.exists_right_complement'_of_coprime_of_fintype Subgroup.exists_right_complement'_of_coprime_of_fintype
| Mathlib/GroupTheory/SchurZassenhaus.lean | 287 | 304 | theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
(hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by |
by_cases hN1 : Nat.card N = 0
· rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
rw [hN]
exact ⟨⊥, isComplement'_top_bot⟩
by_cases hN2 : N.index = 0
· rw [hN2, Nat.coprime_zero_right] at hN
haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
rw [N.eq_bot_of_subsingleton]
exact ⟨⊤, isComplement'_bot_top⟩
have hN3 : Nat.card G ≠ 0 := by
rw [← N.card_mul_index]
exact mul_ne_zero hN1 hN2
haveI := (Cardinal.lt_aleph0_iff_fintype.mp
(lt_of_not_ge (mt Cardinal.toNat_apply_of_aleph0_le hN3))).some
apply exists_right_complement'_of_coprime_of_fintype
rwa [← Nat.card_eq_fintype_card]
|
import Mathlib.Data.Matrix.Block
import Mathlib.Data.Matrix.Notation
import Mathlib.LinearAlgebra.StdBasis
import Mathlib.RingTheory.AlgebraTower
import Mathlib.Algebra.Algebra.Subalgebra.Tower
#align_import linear_algebra.matrix.to_lin from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6"
noncomputable section
open LinearMap Matrix Set Submodule
section ToMatrix
section Finite
variable {R : Type*} [CommSemiring R]
variable {l m n : Type*} [Fintype n] [Finite m] [DecidableEq n]
variable {M₁ M₂ : Type*} [AddCommMonoid M₁] [AddCommMonoid M₂] [Module R M₁] [Module R M₂]
variable (v₁ : Basis n R M₁) (v₂ : Basis m R M₂)
def LinearMap.toMatrix : (M₁ →ₗ[R] M₂) ≃ₗ[R] Matrix m n R :=
LinearEquiv.trans (LinearEquiv.arrowCongr v₁.equivFun v₂.equivFun) LinearMap.toMatrix'
#align linear_map.to_matrix LinearMap.toMatrix
theorem LinearMap.toMatrix_eq_toMatrix' :
LinearMap.toMatrix (Pi.basisFun R n) (Pi.basisFun R n) = LinearMap.toMatrix' :=
rfl
#align linear_map.to_matrix_eq_to_matrix' LinearMap.toMatrix_eq_toMatrix'
def Matrix.toLin : Matrix m n R ≃ₗ[R] M₁ →ₗ[R] M₂ :=
(LinearMap.toMatrix v₁ v₂).symm
#align matrix.to_lin Matrix.toLin
theorem Matrix.toLin_eq_toLin' : Matrix.toLin (Pi.basisFun R n) (Pi.basisFun R m) = Matrix.toLin' :=
rfl
#align matrix.to_lin_eq_to_lin' Matrix.toLin_eq_toLin'
@[simp]
theorem LinearMap.toMatrix_symm : (LinearMap.toMatrix v₁ v₂).symm = Matrix.toLin v₁ v₂ :=
rfl
#align linear_map.to_matrix_symm LinearMap.toMatrix_symm
@[simp]
theorem Matrix.toLin_symm : (Matrix.toLin v₁ v₂).symm = LinearMap.toMatrix v₁ v₂ :=
rfl
#align matrix.to_lin_symm Matrix.toLin_symm
@[simp]
theorem Matrix.toLin_toMatrix (f : M₁ →ₗ[R] M₂) :
Matrix.toLin v₁ v₂ (LinearMap.toMatrix v₁ v₂ f) = f := by
rw [← Matrix.toLin_symm, LinearEquiv.apply_symm_apply]
#align matrix.to_lin_to_matrix Matrix.toLin_toMatrix
@[simp]
theorem LinearMap.toMatrix_toLin (M : Matrix m n R) :
LinearMap.toMatrix v₁ v₂ (Matrix.toLin v₁ v₂ M) = M := by
rw [← Matrix.toLin_symm, LinearEquiv.symm_apply_apply]
#align linear_map.to_matrix_to_lin LinearMap.toMatrix_toLin
theorem LinearMap.toMatrix_apply (f : M₁ →ₗ[R] M₂) (i : m) (j : n) :
LinearMap.toMatrix v₁ v₂ f i j = v₂.repr (f (v₁ j)) i := by
rw [LinearMap.toMatrix, LinearEquiv.trans_apply, LinearMap.toMatrix'_apply,
LinearEquiv.arrowCongr_apply, Basis.equivFun_symm_apply, Finset.sum_eq_single j, if_pos rfl,
one_smul, Basis.equivFun_apply]
· intro j' _ hj'
rw [if_neg hj', zero_smul]
· intro hj
have := Finset.mem_univ j
contradiction
#align linear_map.to_matrix_apply LinearMap.toMatrix_apply
theorem LinearMap.toMatrix_transpose_apply (f : M₁ →ₗ[R] M₂) (j : n) :
(LinearMap.toMatrix v₁ v₂ f)ᵀ j = v₂.repr (f (v₁ j)) :=
funext fun i ↦ f.toMatrix_apply _ _ i j
#align linear_map.to_matrix_transpose_apply LinearMap.toMatrix_transpose_apply
theorem LinearMap.toMatrix_apply' (f : M₁ →ₗ[R] M₂) (i : m) (j : n) :
LinearMap.toMatrix v₁ v₂ f i j = v₂.repr (f (v₁ j)) i :=
LinearMap.toMatrix_apply v₁ v₂ f i j
#align linear_map.to_matrix_apply' LinearMap.toMatrix_apply'
theorem LinearMap.toMatrix_transpose_apply' (f : M₁ →ₗ[R] M₂) (j : n) :
(LinearMap.toMatrix v₁ v₂ f)ᵀ j = v₂.repr (f (v₁ j)) :=
LinearMap.toMatrix_transpose_apply v₁ v₂ f j
#align linear_map.to_matrix_transpose_apply' LinearMap.toMatrix_transpose_apply'
theorem LinearMap.toMatrix_id : LinearMap.toMatrix v₁ v₁ id = 1 := by
ext i j
simp [LinearMap.toMatrix_apply, Matrix.one_apply, Finsupp.single_apply, eq_comm]
#align linear_map.to_matrix_id LinearMap.toMatrix_id
@[simp]
theorem LinearMap.toMatrix_one : LinearMap.toMatrix v₁ v₁ 1 = 1 :=
LinearMap.toMatrix_id v₁
#align linear_map.to_matrix_one LinearMap.toMatrix_one
@[simp]
theorem Matrix.toLin_one : Matrix.toLin v₁ v₁ 1 = LinearMap.id := by
rw [← LinearMap.toMatrix_id v₁, Matrix.toLin_toMatrix]
#align matrix.to_lin_one Matrix.toLin_one
| Mathlib/LinearAlgebra/Matrix/ToLin.lean | 636 | 640 | theorem LinearMap.toMatrix_reindexRange [DecidableEq M₁] (f : M₁ →ₗ[R] M₂) (k : m) (i : n) :
LinearMap.toMatrix v₁.reindexRange v₂.reindexRange f ⟨v₂ k, Set.mem_range_self k⟩
⟨v₁ i, Set.mem_range_self i⟩ =
LinearMap.toMatrix v₁ v₂ f k i := by |
simp_rw [LinearMap.toMatrix_apply, Basis.reindexRange_self, Basis.reindexRange_repr]
|
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Regular.Pow
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Data.Finsupp.Antidiagonal
import Mathlib.Order.SymmDiff
import Mathlib.RingTheory.Adjoin.Basic
#align_import data.mv_polynomial.basic from "leanprover-community/mathlib"@"c8734e8953e4b439147bd6f75c2163f6d27cdce6"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
open scoped Pointwise
universe u v w x
variable {R : Type u} {S₁ : Type v} {S₂ : Type w} {S₃ : Type x}
def MvPolynomial (σ : Type*) (R : Type*) [CommSemiring R] :=
AddMonoidAlgebra R (σ →₀ ℕ)
#align mv_polynomial MvPolynomial
namespace MvPolynomial
-- Porting note: because of `MvPolynomial.C` and `MvPolynomial.X` this linter throws
-- tons of warnings in this file, and it's easier to just disable them globally in the file
set_option linter.uppercaseLean3 false
variable {σ : Type*} {a a' a₁ a₂ : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] [CommSemiring S₁] {p q : MvPolynomial σ R}
def monomial (s : σ →₀ ℕ) : R →ₗ[R] MvPolynomial σ R :=
lsingle s
#align mv_polynomial.monomial MvPolynomial.monomial
theorem single_eq_monomial (s : σ →₀ ℕ) (a : R) : Finsupp.single s a = monomial s a :=
rfl
#align mv_polynomial.single_eq_monomial MvPolynomial.single_eq_monomial
theorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b) :=
AddMonoidAlgebra.mul_def
#align mv_polynomial.mul_def MvPolynomial.mul_def
def C : R →+* MvPolynomial σ R :=
{ singleZeroRingHom with toFun := monomial 0 }
#align mv_polynomial.C MvPolynomial.C
variable (R σ)
@[simp]
theorem algebraMap_eq : algebraMap R (MvPolynomial σ R) = C :=
rfl
#align mv_polynomial.algebra_map_eq MvPolynomial.algebraMap_eq
variable {R σ}
def X (n : σ) : MvPolynomial σ R :=
monomial (Finsupp.single n 1) 1
#align mv_polynomial.X MvPolynomial.X
theorem monomial_left_injective {r : R} (hr : r ≠ 0) :
Function.Injective fun s : σ →₀ ℕ => monomial s r :=
Finsupp.single_left_injective hr
#align mv_polynomial.monomial_left_injective MvPolynomial.monomial_left_injective
@[simp]
theorem monomial_left_inj {s t : σ →₀ ℕ} {r : R} (hr : r ≠ 0) :
monomial s r = monomial t r ↔ s = t :=
Finsupp.single_left_inj hr
#align mv_polynomial.monomial_left_inj MvPolynomial.monomial_left_inj
theorem C_apply : (C a : MvPolynomial σ R) = monomial 0 a :=
rfl
#align mv_polynomial.C_apply MvPolynomial.C_apply
-- Porting note (#10618): `simp` can prove this
theorem C_0 : C 0 = (0 : MvPolynomial σ R) := map_zero _
#align mv_polynomial.C_0 MvPolynomial.C_0
-- Porting note (#10618): `simp` can prove this
theorem C_1 : C 1 = (1 : MvPolynomial σ R) :=
rfl
#align mv_polynomial.C_1 MvPolynomial.C_1
theorem C_mul_monomial : C a * monomial s a' = monomial s (a * a') := by
-- Porting note: this `show` feels like defeq abuse, but I can't find the appropriate lemmas
show AddMonoidAlgebra.single _ _ * AddMonoidAlgebra.single _ _ = AddMonoidAlgebra.single _ _
simp [C_apply, single_mul_single]
#align mv_polynomial.C_mul_monomial MvPolynomial.C_mul_monomial
-- Porting note (#10618): `simp` can prove this
theorem C_add : (C (a + a') : MvPolynomial σ R) = C a + C a' :=
Finsupp.single_add _ _ _
#align mv_polynomial.C_add MvPolynomial.C_add
-- Porting note (#10618): `simp` can prove this
theorem C_mul : (C (a * a') : MvPolynomial σ R) = C a * C a' :=
C_mul_monomial.symm
#align mv_polynomial.C_mul MvPolynomial.C_mul
-- Porting note (#10618): `simp` can prove this
theorem C_pow (a : R) (n : ℕ) : (C (a ^ n) : MvPolynomial σ R) = C a ^ n :=
map_pow _ _ _
#align mv_polynomial.C_pow MvPolynomial.C_pow
theorem C_injective (σ : Type*) (R : Type*) [CommSemiring R] :
Function.Injective (C : R → MvPolynomial σ R) :=
Finsupp.single_injective _
#align mv_polynomial.C_injective MvPolynomial.C_injective
theorem C_surjective {R : Type*} [CommSemiring R] (σ : Type*) [IsEmpty σ] :
Function.Surjective (C : R → MvPolynomial σ R) := by
refine fun p => ⟨p.toFun 0, Finsupp.ext fun a => ?_⟩
simp only [C_apply, ← single_eq_monomial, (Finsupp.ext isEmptyElim (α := σ) : a = 0),
single_eq_same]
rfl
#align mv_polynomial.C_surjective MvPolynomial.C_surjective
@[simp]
theorem C_inj {σ : Type*} (R : Type*) [CommSemiring R] (r s : R) :
(C r : MvPolynomial σ R) = C s ↔ r = s :=
(C_injective σ R).eq_iff
#align mv_polynomial.C_inj MvPolynomial.C_inj
instance nontrivial_of_nontrivial (σ : Type*) (R : Type*) [CommSemiring R] [Nontrivial R] :
Nontrivial (MvPolynomial σ R) :=
inferInstanceAs (Nontrivial <| AddMonoidAlgebra R (σ →₀ ℕ))
instance infinite_of_infinite (σ : Type*) (R : Type*) [CommSemiring R] [Infinite R] :
Infinite (MvPolynomial σ R) :=
Infinite.of_injective C (C_injective _ _)
#align mv_polynomial.infinite_of_infinite MvPolynomial.infinite_of_infinite
instance infinite_of_nonempty (σ : Type*) (R : Type*) [Nonempty σ] [CommSemiring R]
[Nontrivial R] : Infinite (MvPolynomial σ R) :=
Infinite.of_injective ((fun s : σ →₀ ℕ => monomial s 1) ∘ Finsupp.single (Classical.arbitrary σ))
<| (monomial_left_injective one_ne_zero).comp (Finsupp.single_injective _)
#align mv_polynomial.infinite_of_nonempty MvPolynomial.infinite_of_nonempty
theorem C_eq_coe_nat (n : ℕ) : (C ↑n : MvPolynomial σ R) = n := by
induction n <;> simp [Nat.succ_eq_add_one, *]
#align mv_polynomial.C_eq_coe_nat MvPolynomial.C_eq_coe_nat
theorem C_mul' : MvPolynomial.C a * p = a • p :=
(Algebra.smul_def a p).symm
#align mv_polynomial.C_mul' MvPolynomial.C_mul'
theorem smul_eq_C_mul (p : MvPolynomial σ R) (a : R) : a • p = C a * p :=
C_mul'.symm
#align mv_polynomial.smul_eq_C_mul MvPolynomial.smul_eq_C_mul
theorem C_eq_smul_one : (C a : MvPolynomial σ R) = a • (1 : MvPolynomial σ R) := by
rw [← C_mul', mul_one]
#align mv_polynomial.C_eq_smul_one MvPolynomial.C_eq_smul_one
theorem smul_monomial {S₁ : Type*} [SMulZeroClass S₁ R] (r : S₁) :
r • monomial s a = monomial s (r • a) :=
Finsupp.smul_single _ _ _
#align mv_polynomial.smul_monomial MvPolynomial.smul_monomial
theorem X_injective [Nontrivial R] : Function.Injective (X : σ → MvPolynomial σ R) :=
(monomial_left_injective one_ne_zero).comp (Finsupp.single_left_injective one_ne_zero)
#align mv_polynomial.X_injective MvPolynomial.X_injective
@[simp]
theorem X_inj [Nontrivial R] (m n : σ) : X m = (X n : MvPolynomial σ R) ↔ m = n :=
X_injective.eq_iff
#align mv_polynomial.X_inj MvPolynomial.X_inj
theorem monomial_pow : monomial s a ^ e = monomial (e • s) (a ^ e) :=
AddMonoidAlgebra.single_pow e
#align mv_polynomial.monomial_pow MvPolynomial.monomial_pow
@[simp]
theorem monomial_mul {s s' : σ →₀ ℕ} {a b : R} :
monomial s a * monomial s' b = monomial (s + s') (a * b) :=
AddMonoidAlgebra.single_mul_single
#align mv_polynomial.monomial_mul MvPolynomial.monomial_mul
variable (σ R)
def monomialOneHom : Multiplicative (σ →₀ ℕ) →* MvPolynomial σ R :=
AddMonoidAlgebra.of _ _
#align mv_polynomial.monomial_one_hom MvPolynomial.monomialOneHom
variable {σ R}
@[simp]
theorem monomialOneHom_apply : monomialOneHom R σ s = (monomial s 1 : MvPolynomial σ R) :=
rfl
#align mv_polynomial.monomial_one_hom_apply MvPolynomial.monomialOneHom_apply
theorem X_pow_eq_monomial : X n ^ e = monomial (Finsupp.single n e) (1 : R) := by
simp [X, monomial_pow]
#align mv_polynomial.X_pow_eq_monomial MvPolynomial.X_pow_eq_monomial
theorem monomial_add_single : monomial (s + Finsupp.single n e) a = monomial s a * X n ^ e := by
rw [X_pow_eq_monomial, monomial_mul, mul_one]
#align mv_polynomial.monomial_add_single MvPolynomial.monomial_add_single
theorem monomial_single_add : monomial (Finsupp.single n e + s) a = X n ^ e * monomial s a := by
rw [X_pow_eq_monomial, monomial_mul, one_mul]
#align mv_polynomial.monomial_single_add MvPolynomial.monomial_single_add
theorem C_mul_X_pow_eq_monomial {s : σ} {a : R} {n : ℕ} :
C a * X s ^ n = monomial (Finsupp.single s n) a := by
rw [← zero_add (Finsupp.single s n), monomial_add_single, C_apply]
#align mv_polynomial.C_mul_X_pow_eq_monomial MvPolynomial.C_mul_X_pow_eq_monomial
theorem C_mul_X_eq_monomial {s : σ} {a : R} : C a * X s = monomial (Finsupp.single s 1) a := by
rw [← C_mul_X_pow_eq_monomial, pow_one]
#align mv_polynomial.C_mul_X_eq_monomial MvPolynomial.C_mul_X_eq_monomial
-- Porting note (#10618): `simp` can prove this
theorem monomial_zero {s : σ →₀ ℕ} : monomial s (0 : R) = 0 :=
Finsupp.single_zero _
#align mv_polynomial.monomial_zero MvPolynomial.monomial_zero
@[simp]
theorem monomial_zero' : (monomial (0 : σ →₀ ℕ) : R → MvPolynomial σ R) = C :=
rfl
#align mv_polynomial.monomial_zero' MvPolynomial.monomial_zero'
@[simp]
theorem monomial_eq_zero {s : σ →₀ ℕ} {b : R} : monomial s b = 0 ↔ b = 0 :=
Finsupp.single_eq_zero
#align mv_polynomial.monomial_eq_zero MvPolynomial.monomial_eq_zero
@[simp]
theorem sum_monomial_eq {A : Type*} [AddCommMonoid A] {u : σ →₀ ℕ} {r : R} {b : (σ →₀ ℕ) → R → A}
(w : b u 0 = 0) : sum (monomial u r) b = b u r :=
Finsupp.sum_single_index w
#align mv_polynomial.sum_monomial_eq MvPolynomial.sum_monomial_eq
@[simp]
theorem sum_C {A : Type*} [AddCommMonoid A] {b : (σ →₀ ℕ) → R → A} (w : b 0 0 = 0) :
sum (C a) b = b 0 a :=
sum_monomial_eq w
#align mv_polynomial.sum_C MvPolynomial.sum_C
theorem monomial_sum_one {α : Type*} (s : Finset α) (f : α → σ →₀ ℕ) :
(monomial (∑ i ∈ s, f i) 1 : MvPolynomial σ R) = ∏ i ∈ s, monomial (f i) 1 :=
map_prod (monomialOneHom R σ) (fun i => Multiplicative.ofAdd (f i)) s
#align mv_polynomial.monomial_sum_one MvPolynomial.monomial_sum_one
theorem monomial_sum_index {α : Type*} (s : Finset α) (f : α → σ →₀ ℕ) (a : R) :
monomial (∑ i ∈ s, f i) a = C a * ∏ i ∈ s, monomial (f i) 1 := by
rw [← monomial_sum_one, C_mul', ← (monomial _).map_smul, smul_eq_mul, mul_one]
#align mv_polynomial.monomial_sum_index MvPolynomial.monomial_sum_index
theorem monomial_finsupp_sum_index {α β : Type*} [Zero β] (f : α →₀ β) (g : α → β → σ →₀ ℕ)
(a : R) : monomial (f.sum g) a = C a * f.prod fun a b => monomial (g a b) 1 :=
monomial_sum_index _ _ _
#align mv_polynomial.monomial_finsupp_sum_index MvPolynomial.monomial_finsupp_sum_index
theorem monomial_eq_monomial_iff {α : Type*} (a₁ a₂ : α →₀ ℕ) (b₁ b₂ : R) :
monomial a₁ b₁ = monomial a₂ b₂ ↔ a₁ = a₂ ∧ b₁ = b₂ ∨ b₁ = 0 ∧ b₂ = 0 :=
Finsupp.single_eq_single_iff _ _ _ _
#align mv_polynomial.monomial_eq_monomial_iff MvPolynomial.monomial_eq_monomial_iff
theorem monomial_eq : monomial s a = C a * (s.prod fun n e => X n ^ e : MvPolynomial σ R) := by
simp only [X_pow_eq_monomial, ← monomial_finsupp_sum_index, Finsupp.sum_single]
#align mv_polynomial.monomial_eq MvPolynomial.monomial_eq
@[simp]
lemma prod_X_pow_eq_monomial : ∏ x ∈ s.support, X x ^ s x = monomial s (1 : R) := by
simp only [monomial_eq, map_one, one_mul, Finsupp.prod]
theorem induction_on_monomial {M : MvPolynomial σ R → Prop} (h_C : ∀ a, M (C a))
(h_X : ∀ p n, M p → M (p * X n)) : ∀ s a, M (monomial s a) := by
intro s a
apply @Finsupp.induction σ ℕ _ _ s
· show M (monomial 0 a)
exact h_C a
· intro n e p _hpn _he ih
have : ∀ e : ℕ, M (monomial p a * X n ^ e) := by
intro e
induction e with
| zero => simp [ih]
| succ e e_ih => simp [ih, pow_succ, (mul_assoc _ _ _).symm, h_X, e_ih]
simp [add_comm, monomial_add_single, this]
#align mv_polynomial.induction_on_monomial MvPolynomial.induction_on_monomial
@[elab_as_elim]
theorem induction_on' {P : MvPolynomial σ R → Prop} (p : MvPolynomial σ R)
(h1 : ∀ (u : σ →₀ ℕ) (a : R), P (monomial u a))
(h2 : ∀ p q : MvPolynomial σ R, P p → P q → P (p + q)) : P p :=
Finsupp.induction p
(suffices P (monomial 0 0) by rwa [monomial_zero] at this
show P (monomial 0 0) from h1 0 0)
fun a b f _ha _hb hPf => h2 _ _ (h1 _ _) hPf
#align mv_polynomial.induction_on' MvPolynomial.induction_on'
theorem induction_on''' {M : MvPolynomial σ R → Prop} (p : MvPolynomial σ R) (h_C : ∀ a, M (C a))
(h_add_weak :
∀ (a : σ →₀ ℕ) (b : R) (f : (σ →₀ ℕ) →₀ R),
a ∉ f.support → b ≠ 0 → M f → M ((show (σ →₀ ℕ) →₀ R from monomial a b) + f)) :
M p :=
-- Porting note: I had to add the `show ... from ...` above, a type ascription was insufficient.
Finsupp.induction p (C_0.rec <| h_C 0) h_add_weak
#align mv_polynomial.induction_on''' MvPolynomial.induction_on'''
theorem induction_on'' {M : MvPolynomial σ R → Prop} (p : MvPolynomial σ R) (h_C : ∀ a, M (C a))
(h_add_weak :
∀ (a : σ →₀ ℕ) (b : R) (f : (σ →₀ ℕ) →₀ R),
a ∉ f.support → b ≠ 0 → M f → M (monomial a b) →
M ((show (σ →₀ ℕ) →₀ R from monomial a b) + f))
(h_X : ∀ (p : MvPolynomial σ R) (n : σ), M p → M (p * MvPolynomial.X n)) : M p :=
-- Porting note: I had to add the `show ... from ...` above, a type ascription was insufficient.
induction_on''' p h_C fun a b f ha hb hf =>
h_add_weak a b f ha hb hf <| induction_on_monomial h_C h_X a b
#align mv_polynomial.induction_on'' MvPolynomial.induction_on''
@[recursor 5]
theorem induction_on {M : MvPolynomial σ R → Prop} (p : MvPolynomial σ R) (h_C : ∀ a, M (C a))
(h_add : ∀ p q, M p → M q → M (p + q)) (h_X : ∀ p n, M p → M (p * X n)) : M p :=
induction_on'' p h_C (fun a b f _ha _hb hf hm => h_add (monomial a b) f hm hf) h_X
#align mv_polynomial.induction_on MvPolynomial.induction_on
theorem ringHom_ext {A : Type*} [Semiring A] {f g : MvPolynomial σ R →+* A}
(hC : ∀ r, f (C r) = g (C r)) (hX : ∀ i, f (X i) = g (X i)) : f = g := by
refine AddMonoidAlgebra.ringHom_ext' ?_ ?_
-- Porting note: this has high priority, but Lean still chooses `RingHom.ext`, why?
-- probably because of the type synonym
· ext x
exact hC _
· apply Finsupp.mulHom_ext'; intros x
-- Porting note: `Finsupp.mulHom_ext'` needs to have increased priority
apply MonoidHom.ext_mnat
exact hX _
#align mv_polynomial.ring_hom_ext MvPolynomial.ringHom_ext
@[ext 1100]
theorem ringHom_ext' {A : Type*} [Semiring A] {f g : MvPolynomial σ R →+* A}
(hC : f.comp C = g.comp C) (hX : ∀ i, f (X i) = g (X i)) : f = g :=
ringHom_ext (RingHom.ext_iff.1 hC) hX
#align mv_polynomial.ring_hom_ext' MvPolynomial.ringHom_ext'
theorem hom_eq_hom [Semiring S₂] (f g : MvPolynomial σ R →+* S₂) (hC : f.comp C = g.comp C)
(hX : ∀ n : σ, f (X n) = g (X n)) (p : MvPolynomial σ R) : f p = g p :=
RingHom.congr_fun (ringHom_ext' hC hX) p
#align mv_polynomial.hom_eq_hom MvPolynomial.hom_eq_hom
theorem is_id (f : MvPolynomial σ R →+* MvPolynomial σ R) (hC : f.comp C = C)
(hX : ∀ n : σ, f (X n) = X n) (p : MvPolynomial σ R) : f p = p :=
hom_eq_hom f (RingHom.id _) hC hX p
#align mv_polynomial.is_id MvPolynomial.is_id
@[ext 1100]
theorem algHom_ext' {A B : Type*} [CommSemiring A] [CommSemiring B] [Algebra R A] [Algebra R B]
{f g : MvPolynomial σ A →ₐ[R] B}
(h₁ :
f.comp (IsScalarTower.toAlgHom R A (MvPolynomial σ A)) =
g.comp (IsScalarTower.toAlgHom R A (MvPolynomial σ A)))
(h₂ : ∀ i, f (X i) = g (X i)) : f = g :=
AlgHom.coe_ringHom_injective (MvPolynomial.ringHom_ext' (congr_arg AlgHom.toRingHom h₁) h₂)
#align mv_polynomial.alg_hom_ext' MvPolynomial.algHom_ext'
@[ext 1200]
theorem algHom_ext {A : Type*} [Semiring A] [Algebra R A] {f g : MvPolynomial σ R →ₐ[R] A}
(hf : ∀ i : σ, f (X i) = g (X i)) : f = g :=
AddMonoidAlgebra.algHom_ext' (mulHom_ext' fun X : σ => MonoidHom.ext_mnat (hf X))
#align mv_polynomial.alg_hom_ext MvPolynomial.algHom_ext
@[simp]
theorem algHom_C {τ : Type*} (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (r : R) :
f (C r) = C r :=
f.commutes r
#align mv_polynomial.alg_hom_C MvPolynomial.algHom_C
@[simp]
theorem adjoin_range_X : Algebra.adjoin R (range (X : σ → MvPolynomial σ R)) = ⊤ := by
set S := Algebra.adjoin R (range (X : σ → MvPolynomial σ R))
refine top_unique fun p hp => ?_; clear hp
induction p using MvPolynomial.induction_on with
| h_C => exact S.algebraMap_mem _
| h_add p q hp hq => exact S.add_mem hp hq
| h_X p i hp => exact S.mul_mem hp (Algebra.subset_adjoin <| mem_range_self _)
#align mv_polynomial.adjoin_range_X MvPolynomial.adjoin_range_X
@[ext]
theorem linearMap_ext {M : Type*} [AddCommMonoid M] [Module R M] {f g : MvPolynomial σ R →ₗ[R] M}
(h : ∀ s, f ∘ₗ monomial s = g ∘ₗ monomial s) : f = g :=
Finsupp.lhom_ext' h
#align mv_polynomial.linear_map_ext MvPolynomial.linearMap_ext
section Support
def support (p : MvPolynomial σ R) : Finset (σ →₀ ℕ) :=
Finsupp.support p
#align mv_polynomial.support MvPolynomial.support
theorem finsupp_support_eq_support (p : MvPolynomial σ R) : Finsupp.support p = p.support :=
rfl
#align mv_polynomial.finsupp_support_eq_support MvPolynomial.finsupp_support_eq_support
| Mathlib/Algebra/MvPolynomial/Basic.lean | 539 | 542 | theorem support_monomial [h : Decidable (a = 0)] :
(monomial s a).support = if a = 0 then ∅ else {s} := by |
rw [← Subsingleton.elim (Classical.decEq R a 0) h]
rfl
|
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {α β G M : Type*}
@[to_additive]
instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩
#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
attribute [local simp] mul_assoc sub_eq_add_neg
section DivisionCommMonoid
variable [DivisionCommMonoid α] (a b c d : α)
attribute [local simp] mul_assoc mul_comm mul_left_comm div_eq_mul_inv
@[to_additive neg_add]
theorem mul_inv : (a * b)⁻¹ = a⁻¹ * b⁻¹ := by simp
#align mul_inv mul_inv
#align neg_add neg_add
@[to_additive]
theorem inv_div' : (a / b)⁻¹ = a⁻¹ / b⁻¹ := by simp
#align inv_div' inv_div'
#align neg_sub' neg_sub'
@[to_additive]
theorem div_eq_inv_mul : a / b = b⁻¹ * a := by simp
#align div_eq_inv_mul div_eq_inv_mul
#align sub_eq_neg_add sub_eq_neg_add
@[to_additive]
theorem inv_mul_eq_div : a⁻¹ * b = b / a := by simp
#align inv_mul_eq_div inv_mul_eq_div
#align neg_add_eq_sub neg_add_eq_sub
@[to_additive]
theorem inv_mul' : (a * b)⁻¹ = a⁻¹ / b := by simp
#align inv_mul' inv_mul'
#align neg_add' neg_add'
@[to_additive]
theorem inv_div_inv : a⁻¹ / b⁻¹ = b / a := by simp
#align inv_div_inv inv_div_inv
#align neg_sub_neg neg_sub_neg
@[to_additive]
theorem inv_inv_div_inv : (a⁻¹ / b⁻¹)⁻¹ = a / b := by simp
#align inv_inv_div_inv inv_inv_div_inv
#align neg_neg_sub_neg neg_neg_sub_neg
@[to_additive]
theorem one_div_mul_one_div : 1 / a * (1 / b) = 1 / (a * b) := by simp
#align one_div_mul_one_div one_div_mul_one_div
#align zero_sub_add_zero_sub zero_sub_add_zero_sub
@[to_additive]
theorem div_right_comm : a / b / c = a / c / b := by simp
#align div_right_comm div_right_comm
#align sub_right_comm sub_right_comm
@[to_additive, field_simps]
theorem div_div : a / b / c = a / (b * c) := by simp
#align div_div div_div
#align sub_sub sub_sub
@[to_additive]
theorem div_mul : a / b * c = a / (b / c) := by simp
#align div_mul div_mul
#align sub_add sub_add
@[to_additive]
theorem mul_div_left_comm : a * (b / c) = b * (a / c) := by simp
#align mul_div_left_comm mul_div_left_comm
#align add_sub_left_comm add_sub_left_comm
@[to_additive]
theorem mul_div_right_comm : a * b / c = a / c * b := by simp
#align mul_div_right_comm mul_div_right_comm
#align add_sub_right_comm add_sub_right_comm
@[to_additive]
theorem div_mul_eq_div_div : a / (b * c) = a / b / c := by simp
#align div_mul_eq_div_div div_mul_eq_div_div
#align sub_add_eq_sub_sub sub_add_eq_sub_sub
@[to_additive, field_simps]
| Mathlib/Algebra/Group/Basic.lean | 796 | 796 | theorem div_mul_eq_mul_div : a / b * c = a * c / b := by | simp
|
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Int
import Mathlib.Algebra.GroupWithZero.Semiconj
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47"
namespace Nat
def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ
| 0, _, _, r', s', t' => (r', s', t')
| succ k, s, t, r', s', t' =>
let q := r' / succ k
xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t
termination_by k => k
decreasing_by exact mod_lt _ <| (succ_pos _).gt
#align nat.xgcd_aux Nat.xgcdAux
@[simp]
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux]
#align nat.xgcd_zero_left Nat.xgcd_zero_left
theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) :
xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne'
simp [xgcdAux]
#align nat.xgcd_aux_rec Nat.xgcdAux_rec
def xgcd (x y : ℕ) : ℤ × ℤ :=
(xgcdAux x 1 0 y 0 1).2
#align nat.xgcd Nat.xgcd
def gcdA (x y : ℕ) : ℤ :=
(xgcd x y).1
#align nat.gcd_a Nat.gcdA
def gcdB (x y : ℕ) : ℤ :=
(xgcd x y).2
#align nat.gcd_b Nat.gcdB
@[simp]
theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by
unfold gcdA
rw [xgcd, xgcd_zero_left]
#align nat.gcd_a_zero_left Nat.gcdA_zero_left
@[simp]
| Mathlib/Data/Int/GCD.lean | 80 | 82 | theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by |
unfold gcdB
rw [xgcd, xgcd_zero_left]
|
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "ℤ[i]" => GaussianInt
namespace GaussianInt
instance : Repr ℤ[i] :=
⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩
instance instCommRing : CommRing ℤ[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : ℤ[i] →+* ℂ :=
Zsqrtd.lift ⟨I, by simp⟩
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe ℤ[i] ℂ :=
⟨toComplex⟩
theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
@[simp]
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by
rw [toComplex_def₂, toComplex_def₂]
exact congr_arg₂ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
cases x; cases y; simp [toComplex_def₂]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun ⦃_ _⦄ ↦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
rw [← toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by
rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_real_norm := intCast_real_norm
@[simp]
theorem intCast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = Complex.normSq (x : ℂ) := by
cases x; rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_complex_norm GaussianInt.intCast_complex_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_complex_norm := intCast_complex_norm
theorem norm_nonneg (x : ℤ[i]) : 0 ≤ norm x :=
Zsqrtd.norm_nonneg (by norm_num) _
#align gaussian_int.norm_nonneg GaussianInt.norm_nonneg
@[simp]
theorem norm_eq_zero {x : ℤ[i]} : norm x = 0 ↔ x = 0 := by rw [← @Int.cast_inj ℝ _ _ _]; simp
#align gaussian_int.norm_eq_zero GaussianInt.norm_eq_zero
theorem norm_pos {x : ℤ[i]} : 0 < norm x ↔ x ≠ 0 := by
rw [lt_iff_le_and_ne, Ne, eq_comm, norm_eq_zero]; simp [norm_nonneg]
#align gaussian_int.norm_pos GaussianInt.norm_pos
theorem abs_natCast_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
Int.natAbs_of_nonneg (norm_nonneg _)
#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_natCast_norm
-- 2024-04-05
@[deprecated] alias abs_coe_nat_norm := abs_natCast_norm
@[simp]
theorem natCast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
rw [← Int.cast_natCast, abs_natCast_norm]
#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.natCast_natAbs_norm
@[deprecated (since := "2024-04-17")]
alias nat_cast_natAbs_norm := natCast_natAbs_norm
theorem natAbs_norm_eq (x : ℤ[i]) :
x.norm.natAbs = x.re.natAbs * x.re.natAbs + x.im.natAbs * x.im.natAbs :=
Int.ofNat.inj <| by simp; simp [Zsqrtd.norm]
#align gaussian_int.nat_abs_norm_eq GaussianInt.natAbs_norm_eq
instance : Div ℤ[i] :=
⟨fun x y =>
let n := (norm y : ℚ)⁻¹
let c := star y
⟨round ((x * c).re * n : ℚ), round ((x * c).im * n : ℚ)⟩⟩
theorem div_def (x y : ℤ[i]) :
x / y = ⟨round ((x * star y).re / norm y : ℚ), round ((x * star y).im / norm y : ℚ)⟩ :=
show Zsqrtd.mk _ _ = _ by simp [div_eq_mul_inv]
#align gaussian_int.div_def GaussianInt.div_def
theorem toComplex_div_re (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).re = round (x / y : ℂ).re := by
rw [div_def, ← @Rat.round_cast ℝ _ _]
simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
#align gaussian_int.to_complex_div_re GaussianInt.toComplex_div_re
theorem toComplex_div_im (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).im = round (x / y : ℂ).im := by
rw [div_def, ← @Rat.round_cast ℝ _ _, ← @Rat.round_cast ℝ _ _]
simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
#align gaussian_int.to_complex_div_im GaussianInt.toComplex_div_im
theorem normSq_le_normSq_of_re_le_of_im_le {x y : ℂ} (hre : |x.re| ≤ |y.re|)
(him : |x.im| ≤ |y.im|) : Complex.normSq x ≤ Complex.normSq y := by
rw [normSq_apply, normSq_apply, ← _root_.abs_mul_self, _root_.abs_mul, ←
_root_.abs_mul_self y.re, _root_.abs_mul y.re, ← _root_.abs_mul_self x.im,
_root_.abs_mul x.im, ← _root_.abs_mul_self y.im, _root_.abs_mul y.im]
exact
add_le_add (mul_self_le_mul_self (abs_nonneg _) hre) (mul_self_le_mul_self (abs_nonneg _) him)
#align gaussian_int.norm_sq_le_norm_sq_of_re_le_of_im_le GaussianInt.normSq_le_normSq_of_re_le_of_im_le
theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) :
Complex.normSq ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ)) < 1 :=
calc
Complex.normSq ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ))
_ = Complex.normSq
((x / y : ℂ).re - ((x / y : ℤ[i]) : ℂ).re + ((x / y : ℂ).im - ((x / y : ℤ[i]) : ℂ).im) *
I : ℂ) :=
congr_arg _ <| by apply Complex.ext <;> simp
_ ≤ Complex.normSq (1 / 2 + 1 / 2 * I) := by
have : |(2⁻¹ : ℝ)| = 2⁻¹ := abs_of_nonneg (by norm_num)
exact normSq_le_normSq_of_re_le_of_im_le
(by rw [toComplex_div_re]; simp [normSq, this]; simpa using abs_sub_round (x / y : ℂ).re)
(by rw [toComplex_div_im]; simp [normSq, this]; simpa using abs_sub_round (x / y : ℂ).im)
_ < 1 := by simp [normSq]; norm_num
#align gaussian_int.norm_sq_div_sub_div_lt_one GaussianInt.normSq_div_sub_div_lt_one
instance : Mod ℤ[i] :=
⟨fun x y => x - y * (x / y)⟩
theorem mod_def (x y : ℤ[i]) : x % y = x - y * (x / y) :=
rfl
#align gaussian_int.mod_def GaussianInt.mod_def
theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.norm :=
have : (y : ℂ) ≠ 0 := by rwa [Ne, ← toComplex_zero, toComplex_inj]
(@Int.cast_lt ℝ _ _ _ _).1 <|
calc
↑(Zsqrtd.norm (x % y)) = Complex.normSq (x - y * (x / y : ℤ[i]) : ℂ) := by simp [mod_def]
_ = Complex.normSq (y : ℂ) * Complex.normSq (x / y - (x / y : ℤ[i]) : ℂ) := by
rw [← normSq_mul, mul_sub, mul_div_cancel₀ _ this]
_ < Complex.normSq (y : ℂ) * 1 :=
(mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
_ = Zsqrtd.norm y := by simp
#align gaussian_int.norm_mod_lt GaussianInt.norm_mod_lt
theorem natAbs_norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
(x % y).norm.natAbs < y.norm.natAbs :=
Int.ofNat_lt.1 (by simp [-Int.ofNat_lt, norm_mod_lt x hy])
#align gaussian_int.nat_abs_norm_mod_lt GaussianInt.natAbs_norm_mod_lt
theorem norm_le_norm_mul_left (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
(norm x).natAbs ≤ (norm (x * y)).natAbs := by
rw [Zsqrtd.norm_mul, Int.natAbs_mul]
exact le_mul_of_one_le_right (Nat.zero_le _) (Int.ofNat_le.1 (by
rw [abs_natCast_norm]
exact Int.add_one_le_of_lt (norm_pos.2 hy)))
#align gaussian_int.norm_le_norm_mul_left GaussianInt.norm_le_norm_mul_left
instance instNontrivial : Nontrivial ℤ[i] :=
⟨⟨0, 1, by decide⟩⟩
#align gaussian_int.nontrivial GaussianInt.instNontrivial
instance : EuclideanDomain ℤ[i] :=
{ GaussianInt.instCommRing,
GaussianInt.instNontrivial with
quotient := (· / ·)
remainder := (· % ·)
quotient_zero := by simp [div_def]; rfl
quotient_mul_add_remainder_eq := fun _ _ => by simp [mod_def]
r := _
r_wellFounded := (measure (Int.natAbs ∘ norm)).wf
remainder_lt := natAbs_norm_mod_lt
mul_left_not_lt := fun a b hb0 => not_lt_of_ge <| norm_le_norm_mul_left a hb0 }
open PrincipalIdealRing
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 297 | 312 | theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
(hpi : ¬Irreducible (p : ℤ[i])) : ∃ a b, a ^ 2 + b ^ 2 = p :=
have hpu : ¬IsUnit (p : ℤ[i]) :=
mt norm_eq_one_iff.2 <| by
rw [norm_natCast, Int.natAbs_mul, mul_eq_one]
exact fun h => (ne_of_lt hp.1.one_lt).symm h.1
have hab : ∃ a b, (p : ℤ[i]) = a * b ∧ ¬IsUnit a ∧ ¬IsUnit b := by |
-- Porting note: was
-- simpa [irreducible_iff, hpu, not_forall, not_or] using hpi
simpa only [true_and, not_false_iff, exists_prop, irreducible_iff, hpu, not_forall, not_or]
using hpi
let ⟨a, b, hpab, hau, hbu⟩ := hab
have hnap : (norm a).natAbs = p :=
((hp.1.mul_eq_prime_sq_iff (mt norm_eq_one_iff.1 hau) (mt norm_eq_one_iff.1 hbu)).1 <| by
rw [← Int.natCast_inj, Int.natCast_pow, sq, ← @norm_natCast (-1), hpab]; simp).1
⟨a.re.natAbs, a.im.natAbs, by simpa [natAbs_norm_eq, sq] using hnap⟩
|
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Algebra.Group.Basic
#align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u
open Nat
namespace Int
variable {R : Type u} [AddGroupWithOne R]
@[simp, norm_cast squash]
theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) :=
AddGroupWithOne.intCast_negSucc n
#align int.cast_neg_succ_of_nat Int.cast_negSuccₓ
-- expected `n` to be implicit, and `HasLiftT`
@[simp, norm_cast]
theorem cast_zero : ((0 : ℤ) : R) = 0 :=
(AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero
#align int.cast_zero Int.cast_zeroₓ
-- type had `HasLiftT`
-- This lemma competes with `Int.ofNat_eq_natCast` to come later
@[simp high, nolint simpNF, norm_cast]
theorem cast_natCast (n : ℕ) : ((n : ℤ) : R) = n :=
AddGroupWithOne.intCast_ofNat _
#align int.cast_coe_nat Int.cast_natCastₓ
-- expected `n` to be implicit, and `HasLiftT`
#align int.cast_of_nat Int.cast_natCastₓ
-- See note [no_index around OfNat.ofNat]
@[simp, norm_cast]
theorem cast_ofNat (n : ℕ) [n.AtLeastTwo] :
((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
@[simp, norm_cast]
theorem cast_one : ((1 : ℤ) : R) = 1 := by
erw [cast_natCast, Nat.cast_one]
#align int.cast_one Int.cast_oneₓ
-- type had `HasLiftT`
@[simp, norm_cast]
theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n
| (0 : ℕ) => by erw [cast_zero, neg_zero]
| (n + 1 : ℕ) => by erw [cast_natCast, cast_negSucc]
| -[n+1] => by erw [cast_natCast, cast_negSucc, neg_neg]
#align int.cast_neg Int.cast_negₓ
-- type had `HasLiftT`
@[simp, norm_cast]
theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
unfold subNatNat
cases e : n - m
· simp only [ofNat_eq_coe]
simp [e, Nat.le_of_sub_eq_zero e]
· rw [cast_negSucc, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub]
#align int.cast_sub_nat_nat Int.cast_subNatNatₓ
-- type had `HasLiftT`
#align int.neg_of_nat_eq Int.negOfNat_eq
@[simp]
theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq]
#align int.cast_neg_of_nat Int.cast_negOfNat
@[simp, norm_cast]
theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n
| (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add]
| (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_natCast, cast_negSucc, sub_eq_add_neg]
| -[m+1], (n : ℕ) => by
erw [cast_subNatNat, cast_natCast, cast_negSucc, sub_eq_iff_eq_add, add_assoc,
eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm]
| -[m+1], -[n+1] =>
show (-[m + n + 1+1] : R) = _ by
rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add,
Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
#align int.cast_add Int.cast_addₓ
-- type had `HasLiftT`
@[simp, norm_cast]
theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by
simp [Int.sub_eq_add_neg, sub_eq_add_neg, Int.cast_neg, Int.cast_add]
#align int.cast_sub Int.cast_subₓ
-- type had `HasLiftT`
section deprecated
set_option linter.deprecated false
@[norm_cast, deprecated]
theorem cast_bit0 (n : ℤ) : ((bit0 n : ℤ) : R) = bit0 (n : R) :=
Int.cast_add _ _
#align int.cast_bit0 Int.cast_bit0
@[norm_cast, deprecated]
| Mathlib/Data/Int/Cast/Basic.lean | 137 | 138 | theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) := by |
rw [bit1, Int.cast_add, Int.cast_one, cast_bit0]; rfl
|
import Mathlib.Algebra.Polynomial.Roots
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
#align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Finset Asymptotics
open Asymptotics Polynomial Topology
namespace Polynomial
variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X])
theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x :=
atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite
#align polynomial.eventually_no_roots Polynomial.eventually_no_roots
variable [OrderTopology 𝕜]
section PolynomialDivAtTop
theorem isEquivalent_atTop_div :
(fun x => eval x P / eval x Q) ~[atTop] fun x =>
P.leadingCoeff / Q.leadingCoeff * x ^ (P.natDegree - Q.natDegree : ℤ) := by
by_cases hP : P = 0
· simp [hP, IsEquivalent.refl]
by_cases hQ : Q = 0
· simp [hQ, IsEquivalent.refl]
refine
(P.isEquivalent_atTop_lead.symm.div Q.isEquivalent_atTop_lead.symm).symm.trans
(EventuallyEq.isEquivalent ((eventually_gt_atTop 0).mono fun x hx => ?_))
simp [← div_mul_div_comm, hP, hQ, zpow_sub₀ hx.ne.symm]
#align polynomial.is_equivalent_at_top_div Polynomial.isEquivalent_atTop_div
theorem div_tendsto_zero_of_degree_lt (hdeg : P.degree < Q.degree) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 0) := by
by_cases hP : P = 0
· simp [hP, tendsto_const_nhds]
rw [← natDegree_lt_natDegree_iff hP] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_nhds ?_
rw [← mul_zero]
refine (tendsto_zpow_atTop_zero ?_).const_mul _
omega
#align polynomial.div_tendsto_zero_of_degree_lt Polynomial.div_tendsto_zero_of_degree_lt
theorem div_tendsto_zero_iff_degree_lt (hQ : Q ≠ 0) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 0) ↔ P.degree < Q.degree := by
refine ⟨fun h => ?_, div_tendsto_zero_of_degree_lt P Q⟩
by_cases hPQ : P.leadingCoeff / Q.leadingCoeff = 0
· simp only [div_eq_mul_inv, inv_eq_zero, mul_eq_zero] at hPQ
cases' hPQ with hP0 hQ0
· rw [leadingCoeff_eq_zero.1 hP0, degree_zero]
exact bot_lt_iff_ne_bot.2 fun hQ' => hQ (degree_eq_bot.1 hQ')
· exact absurd (leadingCoeff_eq_zero.1 hQ0) hQ
· have := (isEquivalent_atTop_div P Q).tendsto_nhds h
rw [tendsto_const_mul_zpow_atTop_nhds_iff hPQ] at this
cases' this with h h
· exact absurd h.2 hPQ
· rw [sub_lt_iff_lt_add, zero_add, Int.ofNat_lt] at h
exact degree_lt_degree h.1
#align polynomial.div_tendsto_zero_iff_degree_lt Polynomial.div_tendsto_zero_iff_degree_lt
theorem div_tendsto_leadingCoeff_div_of_degree_eq (hdeg : P.degree = Q.degree) :
Tendsto (fun x => eval x P / eval x Q) atTop (𝓝 <| P.leadingCoeff / Q.leadingCoeff) := by
refine (isEquivalent_atTop_div P Q).symm.tendsto_nhds ?_
rw [show (P.natDegree : ℤ) = Q.natDegree by simp [hdeg, natDegree]]
simp [tendsto_const_nhds]
#align polynomial.div_tendsto_leading_coeff_div_of_degree_eq Polynomial.div_tendsto_leadingCoeff_div_of_degree_eq
theorem div_tendsto_atTop_of_degree_gt' (hdeg : Q.degree < P.degree)
(hpos : 0 < P.leadingCoeff / Q.leadingCoeff) :
Tendsto (fun x => eval x P / eval x Q) atTop atTop := by
have hQ : Q ≠ 0 := fun h => by
simp only [h, div_zero, leadingCoeff_zero] at hpos
exact hpos.false
rw [← natDegree_lt_natDegree_iff hQ] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_atTop ?_
apply Tendsto.const_mul_atTop hpos
apply tendsto_zpow_atTop_atTop
omega
#align polynomial.div_tendsto_at_top_of_degree_gt' Polynomial.div_tendsto_atTop_of_degree_gt'
theorem div_tendsto_atTop_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0)
(hnng : 0 ≤ P.leadingCoeff / Q.leadingCoeff) :
Tendsto (fun x => eval x P / eval x Q) atTop atTop :=
have ratio_pos : 0 < P.leadingCoeff / Q.leadingCoeff :=
lt_of_le_of_ne hnng
(div_ne_zero (fun h => ne_zero_of_degree_gt hdeg <| leadingCoeff_eq_zero.mp h) fun h =>
hQ <| leadingCoeff_eq_zero.mp h).symm
div_tendsto_atTop_of_degree_gt' P Q hdeg ratio_pos
#align polynomial.div_tendsto_at_top_of_degree_gt Polynomial.div_tendsto_atTop_of_degree_gt
theorem div_tendsto_atBot_of_degree_gt' (hdeg : Q.degree < P.degree)
(hneg : P.leadingCoeff / Q.leadingCoeff < 0) :
Tendsto (fun x => eval x P / eval x Q) atTop atBot := by
have hQ : Q ≠ 0 := fun h => by
simp only [h, div_zero, leadingCoeff_zero] at hneg
exact hneg.false
rw [← natDegree_lt_natDegree_iff hQ] at hdeg
refine (isEquivalent_atTop_div P Q).symm.tendsto_atBot ?_
apply Tendsto.const_mul_atTop_of_neg hneg
apply tendsto_zpow_atTop_atTop
omega
#align polynomial.div_tendsto_at_bot_of_degree_gt' Polynomial.div_tendsto_atBot_of_degree_gt'
theorem div_tendsto_atBot_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0)
(hnps : P.leadingCoeff / Q.leadingCoeff ≤ 0) :
Tendsto (fun x => eval x P / eval x Q) atTop atBot :=
have ratio_neg : P.leadingCoeff / Q.leadingCoeff < 0 :=
lt_of_le_of_ne hnps
(div_ne_zero (fun h => ne_zero_of_degree_gt hdeg <| leadingCoeff_eq_zero.mp h) fun h =>
hQ <| leadingCoeff_eq_zero.mp h)
div_tendsto_atBot_of_degree_gt' P Q hdeg ratio_neg
#align polynomial.div_tendsto_at_bot_of_degree_gt Polynomial.div_tendsto_atBot_of_degree_gt
| Mathlib/Analysis/SpecialFunctions/Polynomials.lean | 218 | 223 | theorem abs_div_tendsto_atTop_of_degree_gt (hdeg : Q.degree < P.degree) (hQ : Q ≠ 0) :
Tendsto (fun x => |eval x P / eval x Q|) atTop atTop := by |
by_cases h : 0 ≤ P.leadingCoeff / Q.leadingCoeff
· exact tendsto_abs_atTop_atTop.comp (P.div_tendsto_atTop_of_degree_gt Q hdeg hQ h)
· push_neg at h
exact tendsto_abs_atBot_atTop.comp (P.div_tendsto_atBot_of_degree_gt Q hdeg hQ h.le)
|
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.Hom.CompleteLattice
#align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
set_option autoImplicit true
open Filter Set Function
variable {α β γ ι ι' : Type*}
namespace Filter
theorem isCobounded_le_of_bot [Preorder α] [OrderBot α] {f : Filter α} : f.IsCobounded (· ≤ ·) :=
⟨⊥, fun _ _ => bot_le⟩
#align filter.is_cobounded_le_of_bot Filter.isCobounded_le_of_bot
theorem isCobounded_ge_of_top [Preorder α] [OrderTop α] {f : Filter α} : f.IsCobounded (· ≥ ·) :=
⟨⊤, fun _ _ => le_top⟩
#align filter.is_cobounded_ge_of_top Filter.isCobounded_ge_of_top
theorem isBounded_le_of_top [Preorder α] [OrderTop α] {f : Filter α} : f.IsBounded (· ≤ ·) :=
⟨⊤, eventually_of_forall fun _ => le_top⟩
#align filter.is_bounded_le_of_top Filter.isBounded_le_of_top
theorem isBounded_ge_of_bot [Preorder α] [OrderBot α] {f : Filter α} : f.IsBounded (· ≥ ·) :=
⟨⊥, eventually_of_forall fun _ => bot_le⟩
#align filter.is_bounded_ge_of_bot Filter.isBounded_ge_of_bot
@[simp]
theorem _root_.OrderIso.isBoundedUnder_le_comp [Preorder α] [Preorder β] (e : α ≃o β) {l : Filter γ}
{u : γ → α} : (IsBoundedUnder (· ≤ ·) l fun x => e (u x)) ↔ IsBoundedUnder (· ≤ ·) l u :=
(Function.Surjective.exists e.surjective).trans <|
exists_congr fun a => by simp only [eventually_map, e.le_iff_le]
#align order_iso.is_bounded_under_le_comp OrderIso.isBoundedUnder_le_comp
@[simp]
theorem _root_.OrderIso.isBoundedUnder_ge_comp [Preorder α] [Preorder β] (e : α ≃o β) {l : Filter γ}
{u : γ → α} : (IsBoundedUnder (· ≥ ·) l fun x => e (u x)) ↔ IsBoundedUnder (· ≥ ·) l u :=
OrderIso.isBoundedUnder_le_comp e.dual
#align order_iso.is_bounded_under_ge_comp OrderIso.isBoundedUnder_ge_comp
@[to_additive (attr := simp)]
theorem isBoundedUnder_le_inv [OrderedCommGroup α] {l : Filter β} {u : β → α} :
(IsBoundedUnder (· ≤ ·) l fun x => (u x)⁻¹) ↔ IsBoundedUnder (· ≥ ·) l u :=
(OrderIso.inv α).isBoundedUnder_ge_comp
#align filter.is_bounded_under_le_inv Filter.isBoundedUnder_le_inv
#align filter.is_bounded_under_le_neg Filter.isBoundedUnder_le_neg
@[to_additive (attr := simp)]
theorem isBoundedUnder_ge_inv [OrderedCommGroup α] {l : Filter β} {u : β → α} :
(IsBoundedUnder (· ≥ ·) l fun x => (u x)⁻¹) ↔ IsBoundedUnder (· ≤ ·) l u :=
(OrderIso.inv α).isBoundedUnder_le_comp
#align filter.is_bounded_under_ge_inv Filter.isBoundedUnder_ge_inv
#align filter.is_bounded_under_ge_neg Filter.isBoundedUnder_ge_neg
theorem IsBoundedUnder.sup [SemilatticeSup α] {f : Filter β} {u v : β → α} :
f.IsBoundedUnder (· ≤ ·) u →
f.IsBoundedUnder (· ≤ ·) v → f.IsBoundedUnder (· ≤ ·) fun a => u a ⊔ v a
| ⟨bu, (hu : ∀ᶠ x in f, u x ≤ bu)⟩, ⟨bv, (hv : ∀ᶠ x in f, v x ≤ bv)⟩ =>
⟨bu ⊔ bv, show ∀ᶠ x in f, u x ⊔ v x ≤ bu ⊔ bv
by filter_upwards [hu, hv] with _ using sup_le_sup⟩
#align filter.is_bounded_under.sup Filter.IsBoundedUnder.sup
@[simp]
theorem isBoundedUnder_le_sup [SemilatticeSup α] {f : Filter β} {u v : β → α} :
(f.IsBoundedUnder (· ≤ ·) fun a => u a ⊔ v a) ↔
f.IsBoundedUnder (· ≤ ·) u ∧ f.IsBoundedUnder (· ≤ ·) v :=
⟨fun h =>
⟨h.mono_le <| eventually_of_forall fun _ => le_sup_left,
h.mono_le <| eventually_of_forall fun _ => le_sup_right⟩,
fun h => h.1.sup h.2⟩
#align filter.is_bounded_under_le_sup Filter.isBoundedUnder_le_sup
theorem IsBoundedUnder.inf [SemilatticeInf α] {f : Filter β} {u v : β → α} :
f.IsBoundedUnder (· ≥ ·) u →
f.IsBoundedUnder (· ≥ ·) v → f.IsBoundedUnder (· ≥ ·) fun a => u a ⊓ v a :=
IsBoundedUnder.sup (α := αᵒᵈ)
#align filter.is_bounded_under.inf Filter.IsBoundedUnder.inf
@[simp]
theorem isBoundedUnder_ge_inf [SemilatticeInf α] {f : Filter β} {u v : β → α} :
(f.IsBoundedUnder (· ≥ ·) fun a => u a ⊓ v a) ↔
f.IsBoundedUnder (· ≥ ·) u ∧ f.IsBoundedUnder (· ≥ ·) v :=
isBoundedUnder_le_sup (α := αᵒᵈ)
#align filter.is_bounded_under_ge_inf Filter.isBoundedUnder_ge_inf
theorem isBoundedUnder_le_abs [LinearOrderedAddCommGroup α] {f : Filter β} {u : β → α} :
(f.IsBoundedUnder (· ≤ ·) fun a => |u a|) ↔
f.IsBoundedUnder (· ≤ ·) u ∧ f.IsBoundedUnder (· ≥ ·) u :=
isBoundedUnder_le_sup.trans <| and_congr Iff.rfl isBoundedUnder_le_neg
#align filter.is_bounded_under_le_abs Filter.isBoundedUnder_le_abs
macro "isBoundedDefault" : tactic =>
`(tactic| first
| apply isCobounded_le_of_bot
| apply isCobounded_ge_of_top
| apply isBounded_le_of_top
| apply isBounded_ge_of_bot)
-- Porting note: The above is a lean 4 reconstruction of (note that applyc is not available (yet?)):
-- unsafe def is_bounded_default : tactic Unit :=
-- tactic.applyc `` is_cobounded_le_of_bot <|>
-- tactic.applyc `` is_cobounded_ge_of_top <|>
-- tactic.applyc `` is_bounded_le_of_top <|> tactic.applyc `` is_bounded_ge_of_bot
-- #align filter.is_bounded_default filter.IsBounded_default
section CompleteLattice
variable [CompleteLattice α]
@[simp]
theorem limsSup_bot : limsSup (⊥ : Filter α) = ⊥ :=
bot_unique <| sInf_le <| by simp
set_option linter.uppercaseLean3 false in
#align filter.Limsup_bot Filter.limsSup_bot
@[simp] theorem limsup_bot (f : β → α) : limsup f ⊥ = ⊥ := by simp [limsup]
@[simp]
theorem limsInf_bot : limsInf (⊥ : Filter α) = ⊤ :=
top_unique <| le_sSup <| by simp
set_option linter.uppercaseLean3 false in
#align filter.Liminf_bot Filter.limsInf_bot
@[simp] theorem liminf_bot (f : β → α) : liminf f ⊥ = ⊤ := by simp [liminf]
@[simp]
theorem limsSup_top : limsSup (⊤ : Filter α) = ⊤ :=
top_unique <| le_sInf <| by simp [eq_univ_iff_forall]; exact fun b hb => top_unique <| hb _
set_option linter.uppercaseLean3 false in
#align filter.Limsup_top Filter.limsSup_top
@[simp]
theorem limsInf_top : limsInf (⊤ : Filter α) = ⊥ :=
bot_unique <| sSup_le <| by simp [eq_univ_iff_forall]; exact fun b hb => bot_unique <| hb _
set_option linter.uppercaseLean3 false in
#align filter.Liminf_top Filter.limsInf_top
@[simp]
theorem blimsup_false {f : Filter β} {u : β → α} : (blimsup u f fun _ => False) = ⊥ := by
simp [blimsup_eq]
#align filter.blimsup_false Filter.blimsup_false
@[simp]
theorem bliminf_false {f : Filter β} {u : β → α} : (bliminf u f fun _ => False) = ⊤ := by
simp [bliminf_eq]
#align filter.bliminf_false Filter.bliminf_false
@[simp]
theorem limsup_const_bot {f : Filter β} : limsup (fun _ : β => (⊥ : α)) f = (⊥ : α) := by
rw [limsup_eq, eq_bot_iff]
exact sInf_le (eventually_of_forall fun _ => le_rfl)
#align filter.limsup_const_bot Filter.limsup_const_bot
@[simp]
theorem liminf_const_top {f : Filter β} : liminf (fun _ : β => (⊤ : α)) f = (⊤ : α) :=
limsup_const_bot (α := αᵒᵈ)
#align filter.liminf_const_top Filter.liminf_const_top
theorem HasBasis.limsSup_eq_iInf_sSup {ι} {p : ι → Prop} {s} {f : Filter α} (h : f.HasBasis p s) :
limsSup f = ⨅ (i) (_ : p i), sSup (s i) :=
le_antisymm (le_iInf₂ fun i hi => sInf_le <| h.eventually_iff.2 ⟨i, hi, fun _ => le_sSup⟩)
(le_sInf fun _ ha =>
let ⟨_, hi, ha⟩ := h.eventually_iff.1 ha
iInf₂_le_of_le _ hi <| sSup_le ha)
set_option linter.uppercaseLean3 false in
#align filter.has_basis.Limsup_eq_infi_Sup Filter.HasBasis.limsSup_eq_iInf_sSup
theorem HasBasis.limsInf_eq_iSup_sInf {p : ι → Prop} {s : ι → Set α} {f : Filter α}
(h : f.HasBasis p s) : limsInf f = ⨆ (i) (_ : p i), sInf (s i) :=
HasBasis.limsSup_eq_iInf_sSup (α := αᵒᵈ) h
set_option linter.uppercaseLean3 false in
#align filter.has_basis.Liminf_eq_supr_Inf Filter.HasBasis.limsInf_eq_iSup_sInf
theorem limsSup_eq_iInf_sSup {f : Filter α} : limsSup f = ⨅ s ∈ f, sSup s :=
f.basis_sets.limsSup_eq_iInf_sSup
set_option linter.uppercaseLean3 false in
#align filter.Limsup_eq_infi_Sup Filter.limsSup_eq_iInf_sSup
theorem limsInf_eq_iSup_sInf {f : Filter α} : limsInf f = ⨆ s ∈ f, sInf s :=
limsSup_eq_iInf_sSup (α := αᵒᵈ)
set_option linter.uppercaseLean3 false in
#align filter.Liminf_eq_supr_Inf Filter.limsInf_eq_iSup_sInf
theorem limsup_le_iSup {f : Filter β} {u : β → α} : limsup u f ≤ ⨆ n, u n :=
limsup_le_of_le (by isBoundedDefault) (eventually_of_forall (le_iSup u))
#align filter.limsup_le_supr Filter.limsup_le_iSup
theorem iInf_le_liminf {f : Filter β} {u : β → α} : ⨅ n, u n ≤ liminf u f :=
le_liminf_of_le (by isBoundedDefault) (eventually_of_forall (iInf_le u))
#align filter.infi_le_liminf Filter.iInf_le_liminf
theorem limsup_eq_iInf_iSup {f : Filter β} {u : β → α} : limsup u f = ⨅ s ∈ f, ⨆ a ∈ s, u a :=
(f.basis_sets.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, id]
#align filter.limsup_eq_infi_supr Filter.limsup_eq_iInf_iSup
theorem limsup_eq_iInf_iSup_of_nat {u : ℕ → α} : limsup u atTop = ⨅ n : ℕ, ⨆ i ≥ n, u i :=
(atTop_basis.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, iInf_const]; rfl
#align filter.limsup_eq_infi_supr_of_nat Filter.limsup_eq_iInf_iSup_of_nat
theorem limsup_eq_iInf_iSup_of_nat' {u : ℕ → α} : limsup u atTop = ⨅ n : ℕ, ⨆ i : ℕ, u (i + n) := by
simp only [limsup_eq_iInf_iSup_of_nat, iSup_ge_eq_iSup_nat_add]
#align filter.limsup_eq_infi_supr_of_nat' Filter.limsup_eq_iInf_iSup_of_nat'
theorem HasBasis.limsup_eq_iInf_iSup {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(h : f.HasBasis p s) : limsup u f = ⨅ (i) (_ : p i), ⨆ a ∈ s i, u a :=
(h.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, id]
#align filter.has_basis.limsup_eq_infi_supr Filter.HasBasis.limsup_eq_iInf_iSup
theorem blimsup_congr' {f : Filter β} {p q : β → Prop} {u : β → α}
(h : ∀ᶠ x in f, u x ≠ ⊥ → (p x ↔ q x)) : blimsup u f p = blimsup u f q := by
simp only [blimsup_eq]
congr with a
refine eventually_congr (h.mono fun b hb => ?_)
rcases eq_or_ne (u b) ⊥ with hu | hu; · simp [hu]
rw [hb hu]
#align filter.blimsup_congr' Filter.blimsup_congr'
theorem bliminf_congr' {f : Filter β} {p q : β → Prop} {u : β → α}
(h : ∀ᶠ x in f, u x ≠ ⊤ → (p x ↔ q x)) : bliminf u f p = bliminf u f q :=
blimsup_congr' (α := αᵒᵈ) h
#align filter.bliminf_congr' Filter.bliminf_congr'
lemma HasBasis.blimsup_eq_iInf_iSup {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(hf : f.HasBasis p s) {q : β → Prop} :
blimsup u f q = ⨅ (i) (_ : p i), ⨆ a ∈ s i, ⨆ (_ : q a), u a := by
simp only [blimsup_eq_limsup, (hf.inf_principal _).limsup_eq_iInf_iSup, mem_inter_iff, iSup_and,
mem_setOf_eq]
theorem blimsup_eq_iInf_biSup {f : Filter β} {p : β → Prop} {u : β → α} :
blimsup u f p = ⨅ s ∈ f, ⨆ (b) (_ : p b ∧ b ∈ s), u b := by
simp only [f.basis_sets.blimsup_eq_iInf_iSup, iSup_and', id, and_comm]
#align filter.blimsup_eq_infi_bsupr Filter.blimsup_eq_iInf_biSup
theorem blimsup_eq_iInf_biSup_of_nat {p : ℕ → Prop} {u : ℕ → α} :
blimsup u atTop p = ⨅ i, ⨆ (j) (_ : p j ∧ i ≤ j), u j := by
simp only [atTop_basis.blimsup_eq_iInf_iSup, @and_comm (p _), iSup_and, mem_Ici, iInf_true]
#align filter.blimsup_eq_infi_bsupr_of_nat Filter.blimsup_eq_iInf_biSup_of_nat
theorem liminf_eq_iSup_iInf {f : Filter β} {u : β → α} : liminf u f = ⨆ s ∈ f, ⨅ a ∈ s, u a :=
limsup_eq_iInf_iSup (α := αᵒᵈ)
#align filter.liminf_eq_supr_infi Filter.liminf_eq_iSup_iInf
theorem liminf_eq_iSup_iInf_of_nat {u : ℕ → α} : liminf u atTop = ⨆ n : ℕ, ⨅ i ≥ n, u i :=
@limsup_eq_iInf_iSup_of_nat αᵒᵈ _ u
#align filter.liminf_eq_supr_infi_of_nat Filter.liminf_eq_iSup_iInf_of_nat
theorem liminf_eq_iSup_iInf_of_nat' {u : ℕ → α} : liminf u atTop = ⨆ n : ℕ, ⨅ i : ℕ, u (i + n) :=
@limsup_eq_iInf_iSup_of_nat' αᵒᵈ _ _
#align filter.liminf_eq_supr_infi_of_nat' Filter.liminf_eq_iSup_iInf_of_nat'
theorem HasBasis.liminf_eq_iSup_iInf {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(h : f.HasBasis p s) : liminf u f = ⨆ (i) (_ : p i), ⨅ a ∈ s i, u a :=
HasBasis.limsup_eq_iInf_iSup (α := αᵒᵈ) h
#align filter.has_basis.liminf_eq_supr_infi Filter.HasBasis.liminf_eq_iSup_iInf
theorem bliminf_eq_iSup_biInf {f : Filter β} {p : β → Prop} {u : β → α} :
bliminf u f p = ⨆ s ∈ f, ⨅ (b) (_ : p b ∧ b ∈ s), u b :=
@blimsup_eq_iInf_biSup αᵒᵈ β _ f p u
#align filter.bliminf_eq_supr_binfi Filter.bliminf_eq_iSup_biInf
theorem bliminf_eq_iSup_biInf_of_nat {p : ℕ → Prop} {u : ℕ → α} :
bliminf u atTop p = ⨆ i, ⨅ (j) (_ : p j ∧ i ≤ j), u j :=
@blimsup_eq_iInf_biSup_of_nat αᵒᵈ _ p u
#align filter.bliminf_eq_supr_binfi_of_nat Filter.bliminf_eq_iSup_biInf_of_nat
theorem limsup_eq_sInf_sSup {ι R : Type*} (F : Filter ι) [CompleteLattice R] (a : ι → R) :
limsup a F = sInf ((fun I => sSup (a '' I)) '' F.sets) := by
apply le_antisymm
· rw [limsup_eq]
refine sInf_le_sInf fun x hx => ?_
rcases (mem_image _ F.sets x).mp hx with ⟨I, ⟨I_mem_F, hI⟩⟩
filter_upwards [I_mem_F] with i hi
exact hI ▸ le_sSup (mem_image_of_mem _ hi)
· refine le_sInf fun b hb => sInf_le_of_le (mem_image_of_mem _ hb) <| sSup_le ?_
rintro _ ⟨_, h, rfl⟩
exact h
set_option linter.uppercaseLean3 false in
#align filter.limsup_eq_Inf_Sup Filter.limsup_eq_sInf_sSup
theorem liminf_eq_sSup_sInf {ι R : Type*} (F : Filter ι) [CompleteLattice R] (a : ι → R) :
liminf a F = sSup ((fun I => sInf (a '' I)) '' F.sets) :=
@Filter.limsup_eq_sInf_sSup ι (OrderDual R) _ _ a
set_option linter.uppercaseLean3 false in
#align filter.liminf_eq_Sup_Inf Filter.liminf_eq_sSup_sInf
theorem liminf_le_of_frequently_le' {α β} [CompleteLattice β] {f : Filter α} {u : α → β} {x : β}
(h : ∃ᶠ a in f, u a ≤ x) : liminf u f ≤ x := by
rw [liminf_eq]
refine sSup_le fun b hb => ?_
have hbx : ∃ᶠ _ in f, b ≤ x := by
revert h
rw [← not_imp_not, not_frequently, not_frequently]
exact fun h => hb.mp (h.mono fun a hbx hba hax => hbx (hba.trans hax))
exact hbx.exists.choose_spec
#align filter.liminf_le_of_frequently_le' Filter.liminf_le_of_frequently_le'
theorem le_limsup_of_frequently_le' {α β} [CompleteLattice β] {f : Filter α} {u : α → β} {x : β}
(h : ∃ᶠ a in f, x ≤ u a) : x ≤ limsup u f :=
liminf_le_of_frequently_le' (β := βᵒᵈ) h
#align filter.le_limsup_of_frequently_le' Filter.le_limsup_of_frequently_le'
@[simp]
| Mathlib/Order/LiminfLimsup.lean | 953 | 962 | theorem CompleteLatticeHom.apply_limsup_iterate (f : CompleteLatticeHom α α) (a : α) :
f (limsup (fun n => f^[n] a) atTop) = limsup (fun n => f^[n] a) atTop := by |
rw [limsup_eq_iInf_iSup_of_nat', map_iInf]
simp_rw [_root_.map_iSup, ← Function.comp_apply (f := f), ← Function.iterate_succ' f,
← Nat.add_succ]
conv_rhs => rw [iInf_split _ (0 < ·)]
simp only [not_lt, Nat.le_zero, iInf_iInf_eq_left, add_zero, iInf_nat_gt_zero_eq, left_eq_inf]
refine (iInf_le (fun i => ⨆ j, f^[j + (i + 1)] a) 0).trans ?_
simp only [zero_add, Function.comp_apply, iSup_le_iff]
exact fun i => le_iSup (fun i => f^[i] a) (i + 1)
|
import Mathlib.Geometry.Euclidean.Inversion.Basic
import Mathlib.Geometry.Euclidean.PerpBisector
open Metric Function AffineMap Set AffineSubspace
open scoped Topology
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P] {c x y : P} {R : ℝ}
namespace EuclideanGeometry
theorem inversion_mem_perpBisector_inversion_iff (hR : R ≠ 0) (hx : x ≠ c) (hy : y ≠ c) :
inversion c R x ∈ perpBisector c (inversion c R y) ↔ dist x y = dist y c := by
rw [mem_perpBisector_iff_dist_eq, dist_inversion_inversion hx hy, dist_inversion_center]
have hx' := dist_ne_zero.2 hx
have hy' := dist_ne_zero.2 hy
field_simp [mul_assoc, mul_comm, hx, hx.symm, eq_comm]
theorem inversion_mem_perpBisector_inversion_iff' (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R x ∈ perpBisector c (inversion c R y) ↔ dist x y = dist y c ∧ x ≠ c := by
rcases eq_or_ne x c with rfl | hx
· simp [*]
· simp [inversion_mem_perpBisector_inversion_iff hR hx hy, hx]
theorem preimage_inversion_perpBisector_inversion (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R ⁻¹' perpBisector c (inversion c R y) = sphere y (dist y c) \ {c} :=
Set.ext fun _ ↦ inversion_mem_perpBisector_inversion_iff' hR hy
theorem preimage_inversion_perpBisector (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R ⁻¹' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by
rw [← dist_inversion_center, ← preimage_inversion_perpBisector_inversion hR,
inversion_inversion] <;> simp [*]
theorem image_inversion_perpBisector (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R '' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by
rw [image_eq_preimage_of_inverse (inversion_involutive _ hR) (inversion_involutive _ hR),
preimage_inversion_perpBisector hR hy]
theorem preimage_inversion_sphere_dist_center (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R ⁻¹' sphere y (dist y c) =
insert c (perpBisector c (inversion c R y) : Set P) := by
ext x
rcases eq_or_ne x c with rfl | hx; · simp [dist_comm]
rw [mem_preimage, mem_sphere, ← inversion_mem_perpBisector_inversion_iff hR] <;> simp [*]
| Mathlib/Geometry/Euclidean/Inversion/ImageHyperplane.lean | 73 | 76 | theorem image_inversion_sphere_dist_center (hR : R ≠ 0) (hy : y ≠ c) :
inversion c R '' sphere y (dist y c) = insert c (perpBisector c (inversion c R y) : Set P) := by |
rw [image_eq_preimage_of_inverse (inversion_involutive _ hR) (inversion_involutive _ hR),
preimage_inversion_sphere_dist_center hR hy]
|
import Mathlib.Order.Filter.Lift
import Mathlib.Topology.Defs.Filter
#align_import topology.basic from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40"
noncomputable section
open Set Filter
universe u v w x
def TopologicalSpace.ofClosed {X : Type u} (T : Set (Set X)) (empty_mem : ∅ ∈ T)
(sInter_mem : ∀ A, A ⊆ T → ⋂₀ A ∈ T)
(union_mem : ∀ A, A ∈ T → ∀ B, B ∈ T → A ∪ B ∈ T) : TopologicalSpace X where
IsOpen X := Xᶜ ∈ T
isOpen_univ := by simp [empty_mem]
isOpen_inter s t hs ht := by simpa only [compl_inter] using union_mem sᶜ hs tᶜ ht
isOpen_sUnion s hs := by
simp only [Set.compl_sUnion]
exact sInter_mem (compl '' s) fun z ⟨y, hy, hz⟩ => hz ▸ hs y hy
#align topological_space.of_closed TopologicalSpace.ofClosed
section TopologicalSpace
variable {X : Type u} {Y : Type v} {ι : Sort w} {α β : Type*}
{x : X} {s s₁ s₂ t : Set X} {p p₁ p₂ : X → Prop}
open Topology
lemma isOpen_mk {p h₁ h₂ h₃} : IsOpen[⟨p, h₁, h₂, h₃⟩] s ↔ p s := Iff.rfl
#align is_open_mk isOpen_mk
@[ext]
protected theorem TopologicalSpace.ext :
∀ {f g : TopologicalSpace X}, IsOpen[f] = IsOpen[g] → f = g
| ⟨_, _, _, _⟩, ⟨_, _, _, _⟩, rfl => rfl
#align topological_space_eq TopologicalSpace.ext
section
variable [TopologicalSpace X]
end
protected theorem TopologicalSpace.ext_iff {t t' : TopologicalSpace X} :
t = t' ↔ ∀ s, IsOpen[t] s ↔ IsOpen[t'] s :=
⟨fun h s => h ▸ Iff.rfl, fun h => by ext; exact h _⟩
#align topological_space_eq_iff TopologicalSpace.ext_iff
theorem isOpen_fold {t : TopologicalSpace X} : t.IsOpen s = IsOpen[t] s :=
rfl
#align is_open_fold isOpen_fold
variable [TopologicalSpace X]
theorem isOpen_iUnion {f : ι → Set X} (h : ∀ i, IsOpen (f i)) : IsOpen (⋃ i, f i) :=
isOpen_sUnion (forall_mem_range.2 h)
#align is_open_Union isOpen_iUnion
theorem isOpen_biUnion {s : Set α} {f : α → Set X} (h : ∀ i ∈ s, IsOpen (f i)) :
IsOpen (⋃ i ∈ s, f i) :=
isOpen_iUnion fun i => isOpen_iUnion fun hi => h i hi
#align is_open_bUnion isOpen_biUnion
theorem IsOpen.union (h₁ : IsOpen s₁) (h₂ : IsOpen s₂) : IsOpen (s₁ ∪ s₂) := by
rw [union_eq_iUnion]; exact isOpen_iUnion (Bool.forall_bool.2 ⟨h₂, h₁⟩)
#align is_open.union IsOpen.union
lemma isOpen_iff_of_cover {f : α → Set X} (ho : ∀ i, IsOpen (f i)) (hU : (⋃ i, f i) = univ) :
IsOpen s ↔ ∀ i, IsOpen (f i ∩ s) := by
refine ⟨fun h i ↦ (ho i).inter h, fun h ↦ ?_⟩
rw [← s.inter_univ, inter_comm, ← hU, iUnion_inter]
exact isOpen_iUnion fun i ↦ h i
@[simp] theorem isOpen_empty : IsOpen (∅ : Set X) := by
rw [← sUnion_empty]; exact isOpen_sUnion fun a => False.elim
#align is_open_empty isOpen_empty
theorem Set.Finite.isOpen_sInter {s : Set (Set X)} (hs : s.Finite) :
(∀ t ∈ s, IsOpen t) → IsOpen (⋂₀ s) :=
Finite.induction_on hs (fun _ => by rw [sInter_empty]; exact isOpen_univ) fun _ _ ih h => by
simp only [sInter_insert, forall_mem_insert] at h ⊢
exact h.1.inter (ih h.2)
#align is_open_sInter Set.Finite.isOpen_sInter
theorem Set.Finite.isOpen_biInter {s : Set α} {f : α → Set X} (hs : s.Finite)
(h : ∀ i ∈ s, IsOpen (f i)) :
IsOpen (⋂ i ∈ s, f i) :=
sInter_image f s ▸ (hs.image _).isOpen_sInter (forall_mem_image.2 h)
#align is_open_bInter Set.Finite.isOpen_biInter
theorem isOpen_iInter_of_finite [Finite ι] {s : ι → Set X} (h : ∀ i, IsOpen (s i)) :
IsOpen (⋂ i, s i) :=
(finite_range _).isOpen_sInter (forall_mem_range.2 h)
#align is_open_Inter isOpen_iInter_of_finite
theorem isOpen_biInter_finset {s : Finset α} {f : α → Set X} (h : ∀ i ∈ s, IsOpen (f i)) :
IsOpen (⋂ i ∈ s, f i) :=
s.finite_toSet.isOpen_biInter h
#align is_open_bInter_finset isOpen_biInter_finset
@[simp] -- Porting note: added `simp`
theorem isOpen_const {p : Prop} : IsOpen { _x : X | p } := by by_cases p <;> simp [*]
#align is_open_const isOpen_const
theorem IsOpen.and : IsOpen { x | p₁ x } → IsOpen { x | p₂ x } → IsOpen { x | p₁ x ∧ p₂ x } :=
IsOpen.inter
#align is_open.and IsOpen.and
@[simp] theorem isOpen_compl_iff : IsOpen sᶜ ↔ IsClosed s :=
⟨fun h => ⟨h⟩, fun h => h.isOpen_compl⟩
#align is_open_compl_iff isOpen_compl_iff
| Mathlib/Topology/Basic.lean | 164 | 167 | theorem TopologicalSpace.ext_iff_isClosed {t₁ t₂ : TopologicalSpace X} :
t₁ = t₂ ↔ ∀ s, IsClosed[t₁] s ↔ IsClosed[t₂] s := by |
rw [TopologicalSpace.ext_iff, compl_surjective.forall]
simp only [@isOpen_compl_iff _ _ t₁, @isOpen_compl_iff _ _ t₂]
|
import Mathlib.LinearAlgebra.Prod
#align_import linear_algebra.linear_pmap from "leanprover-community/mathlib"@"8b981918a93bc45a8600de608cde7944a80d92b9"
universe u v w
structure LinearPMap (R : Type u) [Ring R] (E : Type v) [AddCommGroup E] [Module R E] (F : Type w)
[AddCommGroup F] [Module R F] where
domain : Submodule R E
toFun : domain →ₗ[R] F
#align linear_pmap LinearPMap
@[inherit_doc] notation:25 E " →ₗ.[" R:25 "] " F:0 => LinearPMap R E F
variable {R : Type*} [Ring R] {E : Type*} [AddCommGroup E] [Module R E] {F : Type*}
[AddCommGroup F] [Module R F] {G : Type*} [AddCommGroup G] [Module R G]
namespace LinearPMap
open Submodule
-- Porting note: A new definition underlying a coercion `↑`.
@[coe]
def toFun' (f : E →ₗ.[R] F) : f.domain → F := f.toFun
instance : CoeFun (E →ₗ.[R] F) fun f : E →ₗ.[R] F => f.domain → F :=
⟨toFun'⟩
@[simp]
theorem toFun_eq_coe (f : E →ₗ.[R] F) (x : f.domain) : f.toFun x = f x :=
rfl
#align linear_pmap.to_fun_eq_coe LinearPMap.toFun_eq_coe
@[ext]
theorem ext {f g : E →ₗ.[R] F} (h : f.domain = g.domain)
(h' : ∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y) : f = g := by
rcases f with ⟨f_dom, f⟩
rcases g with ⟨g_dom, g⟩
obtain rfl : f_dom = g_dom := h
obtain rfl : f = g := LinearMap.ext fun x => h' rfl
rfl
#align linear_pmap.ext LinearPMap.ext
@[simp]
theorem map_zero (f : E →ₗ.[R] F) : f 0 = 0 :=
f.toFun.map_zero
#align linear_pmap.map_zero LinearPMap.map_zero
theorem ext_iff {f g : E →ₗ.[R] F} :
f = g ↔
∃ _domain_eq : f.domain = g.domain,
∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y :=
⟨fun EQ =>
EQ ▸
⟨rfl, fun x y h => by
congr
exact mod_cast h⟩,
fun ⟨deq, feq⟩ => ext deq feq⟩
#align linear_pmap.ext_iff LinearPMap.ext_iff
theorem ext' {s : Submodule R E} {f g : s →ₗ[R] F} (h : f = g) : mk s f = mk s g :=
h ▸ rfl
#align linear_pmap.ext' LinearPMap.ext'
theorem map_add (f : E →ₗ.[R] F) (x y : f.domain) : f (x + y) = f x + f y :=
f.toFun.map_add x y
#align linear_pmap.map_add LinearPMap.map_add
theorem map_neg (f : E →ₗ.[R] F) (x : f.domain) : f (-x) = -f x :=
f.toFun.map_neg x
#align linear_pmap.map_neg LinearPMap.map_neg
theorem map_sub (f : E →ₗ.[R] F) (x y : f.domain) : f (x - y) = f x - f y :=
f.toFun.map_sub x y
#align linear_pmap.map_sub LinearPMap.map_sub
theorem map_smul (f : E →ₗ.[R] F) (c : R) (x : f.domain) : f (c • x) = c • f x :=
f.toFun.map_smul c x
#align linear_pmap.map_smul LinearPMap.map_smul
@[simp]
theorem mk_apply (p : Submodule R E) (f : p →ₗ[R] F) (x : p) : mk p f x = f x :=
rfl
#align linear_pmap.mk_apply LinearPMap.mk_apply
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
E →ₗ.[R] F where
domain := R ∙ x
toFun :=
have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
intro c₁ c₂ h
rw [← sub_eq_zero, ← sub_smul] at h ⊢
exact H _ h
{ toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
-- Porting note(#12129): additional beta reduction needed
-- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
map_add' := fun y z => by
beta_reduce
rw [← add_smul]
apply H
simp only [add_smul, sub_smul,
fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
apply coe_add
map_smul' := fun c z => by
beta_reduce
rw [smul_smul]
apply H
simp only [mul_smul,
fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
apply coe_smul }
#align linear_pmap.mk_span_singleton' LinearPMap.mkSpanSingleton'
@[simp]
theorem domain_mkSpanSingleton (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
(mkSpanSingleton' x y H).domain = R ∙ x :=
rfl
#align linear_pmap.domain_mk_span_singleton LinearPMap.domain_mkSpanSingleton
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by
dsimp [mkSpanSingleton']
rw [← sub_eq_zero, ← sub_smul]
apply H
simp only [sub_smul, one_smul, sub_eq_zero]
apply Classical.choose_spec (mem_span_singleton.1 h)
#align linear_pmap.mk_span_singleton'_apply LinearPMap.mkSpanSingleton'_apply
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
mkSpanSingleton' x y H ⟨x, h⟩ = y := by
-- Porting note: A placeholder should be specified before `convert`.
have := by refine mkSpanSingleton'_apply x y H 1 ?_; rwa [one_smul]
convert this <;> rw [one_smul]
#align linear_pmap.mk_span_singleton'_apply_self LinearPMap.mkSpanSingleton'_apply_self
noncomputable abbrev mkSpanSingleton {K E F : Type*} [DivisionRing K] [AddCommGroup E] [Module K E]
[AddCommGroup F] [Module K F] (x : E) (y : F) (hx : x ≠ 0) : E →ₗ.[K] F :=
mkSpanSingleton' x y fun c hc =>
(smul_eq_zero.1 hc).elim (fun hc => by rw [hc, zero_smul]) fun hx' => absurd hx' hx
#align linear_pmap.mk_span_singleton LinearPMap.mkSpanSingleton
theorem mkSpanSingleton_apply (K : Type*) {E F : Type*} [DivisionRing K] [AddCommGroup E]
[Module K E] [AddCommGroup F] [Module K F] {x : E} (hx : x ≠ 0) (y : F) :
mkSpanSingleton x y hx ⟨x, (Submodule.mem_span_singleton_self x : x ∈ Submodule.span K {x})⟩ =
y :=
LinearPMap.mkSpanSingleton'_apply_self _ _ _ _
#align linear_pmap.mk_span_singleton_apply LinearPMap.mkSpanSingleton_apply
protected def fst (p : Submodule R E) (p' : Submodule R F) : E × F →ₗ.[R] E where
domain := p.prod p'
toFun := (LinearMap.fst R E F).comp (p.prod p').subtype
#align linear_pmap.fst LinearPMap.fst
@[simp]
theorem fst_apply (p : Submodule R E) (p' : Submodule R F) (x : p.prod p') :
LinearPMap.fst p p' x = (x : E × F).1 :=
rfl
#align linear_pmap.fst_apply LinearPMap.fst_apply
protected def snd (p : Submodule R E) (p' : Submodule R F) : E × F →ₗ.[R] F where
domain := p.prod p'
toFun := (LinearMap.snd R E F).comp (p.prod p').subtype
#align linear_pmap.snd LinearPMap.snd
@[simp]
theorem snd_apply (p : Submodule R E) (p' : Submodule R F) (x : p.prod p') :
LinearPMap.snd p p' x = (x : E × F).2 :=
rfl
#align linear_pmap.snd_apply LinearPMap.snd_apply
instance le : LE (E →ₗ.[R] F) :=
⟨fun f g => f.domain ≤ g.domain ∧ ∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y⟩
#align linear_pmap.has_le LinearPMap.le
theorem apply_comp_inclusion {T S : E →ₗ.[R] F} (h : T ≤ S) (x : T.domain) :
T x = S (Submodule.inclusion h.1 x) :=
h.2 rfl
#align linear_pmap.apply_comp_of_le LinearPMap.apply_comp_inclusion
theorem exists_of_le {T S : E →ₗ.[R] F} (h : T ≤ S) (x : T.domain) :
∃ y : S.domain, (x : E) = y ∧ T x = S y :=
⟨⟨x.1, h.1 x.2⟩, ⟨rfl, h.2 rfl⟩⟩
#align linear_pmap.exists_of_le LinearPMap.exists_of_le
theorem eq_of_le_of_domain_eq {f g : E →ₗ.[R] F} (hle : f ≤ g) (heq : f.domain = g.domain) :
f = g :=
ext heq hle.2
#align linear_pmap.eq_of_le_of_domain_eq LinearPMap.eq_of_le_of_domain_eq
def eqLocus (f g : E →ₗ.[R] F) : Submodule R E where
carrier := { x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), f ⟨x, hf⟩ = g ⟨x, hg⟩ }
zero_mem' := ⟨zero_mem _, zero_mem _, f.map_zero.trans g.map_zero.symm⟩
add_mem' := fun {x y} ⟨hfx, hgx, hx⟩ ⟨hfy, hgy, hy⟩ =>
⟨add_mem hfx hfy, add_mem hgx hgy, by
erw [f.map_add ⟨x, hfx⟩ ⟨y, hfy⟩, g.map_add ⟨x, hgx⟩ ⟨y, hgy⟩, hx, hy]⟩
-- Porting note: `by rintro` is required, or error of a free variable happens.
smul_mem' := by
rintro c x ⟨hfx, hgx, hx⟩
exact
⟨smul_mem _ c hfx, smul_mem _ c hgx,
by erw [f.map_smul c ⟨x, hfx⟩, g.map_smul c ⟨x, hgx⟩, hx]⟩
#align linear_pmap.eq_locus LinearPMap.eqLocus
instance inf : Inf (E →ₗ.[R] F) :=
⟨fun f g => ⟨f.eqLocus g, f.toFun.comp <| inclusion fun _x hx => hx.fst⟩⟩
#align linear_pmap.has_inf LinearPMap.inf
instance bot : Bot (E →ₗ.[R] F) :=
⟨⟨⊥, 0⟩⟩
#align linear_pmap.has_bot LinearPMap.bot
instance inhabited : Inhabited (E →ₗ.[R] F) :=
⟨⊥⟩
#align linear_pmap.inhabited LinearPMap.inhabited
instance semilatticeInf : SemilatticeInf (E →ₗ.[R] F) where
le := (· ≤ ·)
le_refl f := ⟨le_refl f.domain, fun x y h => Subtype.eq h ▸ rfl⟩
le_trans := fun f g h ⟨fg_le, fg_eq⟩ ⟨gh_le, gh_eq⟩ =>
⟨le_trans fg_le gh_le, fun x z hxz =>
have hxy : (x : E) = inclusion fg_le x := rfl
(fg_eq hxy).trans (gh_eq <| hxy.symm.trans hxz)⟩
le_antisymm f g fg gf := eq_of_le_of_domain_eq fg (le_antisymm fg.1 gf.1)
inf := (· ⊓ ·)
-- Porting note: `by rintro` is required, or error of a metavariable happens.
le_inf := by
rintro f g h ⟨fg_le, fg_eq⟩ ⟨fh_le, fh_eq⟩
exact ⟨fun x hx =>
⟨fg_le hx, fh_le hx, by
-- Porting note: `[exact ⟨x, hx⟩, rfl, rfl]` → `[skip, exact ⟨x, hx⟩, skip] <;> rfl`
convert (fg_eq _).symm.trans (fh_eq _) <;> [skip; exact ⟨x, hx⟩; skip] <;> rfl⟩,
fun x ⟨y, yg, hy⟩ h => by
apply fg_eq
exact h⟩
inf_le_left f g := ⟨fun x hx => hx.fst, fun x y h => congr_arg f <| Subtype.eq <| h⟩
inf_le_right f g :=
⟨fun x hx => hx.snd.fst, fun ⟨x, xf, xg, hx⟩ y h => hx.trans <| congr_arg g <| Subtype.eq <| h⟩
#align linear_pmap.semilattice_inf LinearPMap.semilatticeInf
instance orderBot : OrderBot (E →ₗ.[R] F) where
bot := ⊥
bot_le f :=
⟨bot_le, fun x y h => by
have hx : x = 0 := Subtype.eq ((mem_bot R).1 x.2)
have hy : y = 0 := Subtype.eq (h.symm.trans (congr_arg _ hx))
rw [hx, hy, map_zero, map_zero]⟩
#align linear_pmap.order_bot LinearPMap.orderBot
theorem le_of_eqLocus_ge {f g : E →ₗ.[R] F} (H : f.domain ≤ f.eqLocus g) : f ≤ g :=
suffices f ≤ f ⊓ g from le_trans this inf_le_right
⟨H, fun _x _y hxy => ((inf_le_left : f ⊓ g ≤ f).2 hxy.symm).symm⟩
#align linear_pmap.le_of_eq_locus_ge LinearPMap.le_of_eqLocus_ge
theorem domain_mono : StrictMono (@domain R _ E _ _ F _ _) := fun _f _g hlt =>
lt_of_le_of_ne hlt.1.1 fun heq => ne_of_lt hlt <| eq_of_le_of_domain_eq (le_of_lt hlt) heq
#align linear_pmap.domain_mono LinearPMap.domain_mono
private theorem sup_aux (f g : E →ₗ.[R] F)
(h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) :
∃ fg : ↥(f.domain ⊔ g.domain) →ₗ[R] F,
∀ (x : f.domain) (y : g.domain) (z : ↥(f.domain ⊔ g.domain)),
(x : E) + y = ↑z → fg z = f x + g y := by
choose x hx y hy hxy using fun z : ↥(f.domain ⊔ g.domain) => mem_sup.1 z.prop
set fg := fun z => f ⟨x z, hx z⟩ + g ⟨y z, hy z⟩
have fg_eq : ∀ (x' : f.domain) (y' : g.domain) (z' : ↥(f.domain ⊔ g.domain))
(_H : (x' : E) + y' = z'), fg z' = f x' + g y' := by
intro x' y' z' H
dsimp [fg]
rw [add_comm, ← sub_eq_sub_iff_add_eq_add, eq_comm, ← map_sub, ← map_sub]
apply h
simp only [← eq_sub_iff_add_eq] at hxy
simp only [AddSubgroupClass.coe_sub, coe_mk, coe_mk, hxy, ← sub_add, ← sub_sub, sub_self,
zero_sub, ← H]
apply neg_add_eq_sub
use { toFun := fg, map_add' := ?_, map_smul' := ?_ }, fg_eq
· rintro ⟨z₁, hz₁⟩ ⟨z₂, hz₂⟩
rw [← add_assoc, add_right_comm (f _), ← map_add, add_assoc, ← map_add]
apply fg_eq
simp only [coe_add, coe_mk, ← add_assoc]
rw [add_right_comm (x _), hxy, add_assoc, hxy, coe_mk, coe_mk]
· intro c z
rw [smul_add, ← map_smul, ← map_smul]
apply fg_eq
simp only [coe_smul, coe_mk, ← smul_add, hxy, RingHom.id_apply]
protected noncomputable def sup (f g : E →ₗ.[R] F)
(h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) : E →ₗ.[R] F :=
⟨_, Classical.choose (sup_aux f g h)⟩
#align linear_pmap.sup LinearPMap.sup
@[simp]
theorem domain_sup (f g : E →ₗ.[R] F)
(h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) :
(f.sup g h).domain = f.domain ⊔ g.domain :=
rfl
#align linear_pmap.domain_sup LinearPMap.domain_sup
theorem sup_apply {f g : E →ₗ.[R] F} (H : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y)
(x : f.domain) (y : g.domain) (z : ↥(f.domain ⊔ g.domain)) (hz : (↑x : E) + ↑y = ↑z) :
f.sup g H z = f x + g y :=
Classical.choose_spec (sup_aux f g H) x y z hz
#align linear_pmap.sup_apply LinearPMap.sup_apply
protected theorem left_le_sup (f g : E →ₗ.[R] F)
(h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) : f ≤ f.sup g h := by
refine ⟨le_sup_left, fun z₁ z₂ hz => ?_⟩
rw [← add_zero (f _), ← g.map_zero]
refine (sup_apply h _ _ _ ?_).symm
simpa
#align linear_pmap.left_le_sup LinearPMap.left_le_sup
protected theorem right_le_sup (f g : E →ₗ.[R] F)
(h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) : g ≤ f.sup g h := by
refine ⟨le_sup_right, fun z₁ z₂ hz => ?_⟩
rw [← zero_add (g _), ← f.map_zero]
refine (sup_apply h _ _ _ ?_).symm
simpa
#align linear_pmap.right_le_sup LinearPMap.right_le_sup
protected theorem sup_le {f g h : E →ₗ.[R] F}
(H : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) (fh : f ≤ h) (gh : g ≤ h) :
f.sup g H ≤ h :=
have Hf : f ≤ f.sup g H ⊓ h := le_inf (f.left_le_sup g H) fh
have Hg : g ≤ f.sup g H ⊓ h := le_inf (f.right_le_sup g H) gh
le_of_eqLocus_ge <| sup_le Hf.1 Hg.1
#align linear_pmap.sup_le LinearPMap.sup_le
theorem sup_h_of_disjoint (f g : E →ₗ.[R] F) (h : Disjoint f.domain g.domain) (x : f.domain)
(y : g.domain) (hxy : (x : E) = y) : f x = g y := by
rw [disjoint_def] at h
have hy : y = 0 := Subtype.eq (h y (hxy ▸ x.2) y.2)
have hx : x = 0 := Subtype.eq (hxy.trans <| congr_arg _ hy)
simp [*]
#align linear_pmap.sup_h_of_disjoint LinearPMap.sup_h_of_disjoint
instance instNeg : Neg (E →ₗ.[R] F) :=
⟨fun f => ⟨f.domain, -f.toFun⟩⟩
#align linear_pmap.has_neg LinearPMap.instNeg
@[simp]
theorem neg_domain (f : E →ₗ.[R] F) : (-f).domain = f.domain := rfl
@[simp]
theorem neg_apply (f : E →ₗ.[R] F) (x) : (-f) x = -f x :=
rfl
#align linear_pmap.neg_apply LinearPMap.neg_apply
instance instInvolutiveNeg : InvolutiveNeg (E →ₗ.[R] F) :=
⟨fun f => by
ext x y hxy
· rfl
· simp only [neg_apply, neg_neg]
cases x
congr⟩
namespace LinearPMap
def codRestrict (f : E →ₗ.[R] F) (p : Submodule R F) (H : ∀ x, f x ∈ p) : E →ₗ.[R] p where
domain := f.domain
toFun := f.toFun.codRestrict p H
#align linear_pmap.cod_restrict LinearPMap.codRestrict
def comp (g : F →ₗ.[R] G) (f : E →ₗ.[R] F) (H : ∀ x : f.domain, f x ∈ g.domain) : E →ₗ.[R] G :=
g.toFun.compPMap <| f.codRestrict _ H
#align linear_pmap.comp LinearPMap.comp
def coprod (f : E →ₗ.[R] G) (g : F →ₗ.[R] G) : E × F →ₗ.[R] G where
domain := f.domain.prod g.domain
toFun :=
-- Porting note: This is just
-- `(f.comp (LinearPMap.fst f.domain g.domain) fun x => x.2.1).toFun +`
-- ` (g.comp (LinearPMap.snd f.domain g.domain) fun x => x.2.2).toFun`,
HAdd.hAdd
(α := f.domain.prod g.domain →ₗ[R] G)
(β := f.domain.prod g.domain →ₗ[R] G)
(f.comp (LinearPMap.fst f.domain g.domain) fun x => x.2.1).toFun
(g.comp (LinearPMap.snd f.domain g.domain) fun x => x.2.2).toFun
#align linear_pmap.coprod LinearPMap.coprod
@[simp]
theorem coprod_apply (f : E →ₗ.[R] G) (g : F →ₗ.[R] G) (x) :
f.coprod g x = f ⟨(x : E × F).1, x.2.1⟩ + g ⟨(x : E × F).2, x.2.2⟩ :=
rfl
#align linear_pmap.coprod_apply LinearPMap.coprod_apply
def domRestrict (f : E →ₗ.[R] F) (S : Submodule R E) : E →ₗ.[R] F :=
⟨S ⊓ f.domain, f.toFun.comp (Submodule.inclusion (by simp))⟩
#align linear_pmap.dom_restrict LinearPMap.domRestrict
@[simp]
theorem domRestrict_domain (f : E →ₗ.[R] F) {S : Submodule R E} :
(f.domRestrict S).domain = S ⊓ f.domain :=
rfl
#align linear_pmap.dom_restrict_domain LinearPMap.domRestrict_domain
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
(h : (x : E) = y) : f.domRestrict S x = f y := by
have : Submodule.inclusion (by simp) x = y := by
ext
simp [h]
rw [← this]
exact LinearPMap.mk_apply _ _ _
#align linear_pmap.dom_restrict_apply LinearPMap.domRestrict_apply
theorem domRestrict_le {f : E →ₗ.[R] F} {S : Submodule R E} : f.domRestrict S ≤ f :=
⟨by simp, fun x y hxy => domRestrict_apply hxy⟩
#align linear_pmap.dom_restrict_le LinearPMap.domRestrict_le
namespace Submodule
namespace LinearPMap
section inverse
noncomputable def inverse (f : E →ₗ.[R] F) : F →ₗ.[R] E :=
(f.graph.map (LinearEquiv.prodComm R E F)).toLinearPMap
variable {f : E →ₗ.[R] F}
| Mathlib/LinearAlgebra/LinearPMap.lean | 1,081 | 1,084 | theorem inverse_domain : (inverse f).domain = LinearMap.range f.toFun := by |
rw [inverse, Submodule.toLinearPMap_domain, ← graph_map_snd_eq_range,
← LinearEquiv.fst_comp_prodComm, Submodule.map_comp]
rfl
|
import Mathlib.Combinatorics.SimpleGraph.Clique
import Mathlib.Data.ENat.Lattice
import Mathlib.Data.Nat.Lattice
import Mathlib.Data.Setoid.Partition
import Mathlib.Order.Antichain
#align_import combinatorics.simple_graph.coloring from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Fintype Function
universe u v
namespace SimpleGraph
variable {V : Type u} (G : SimpleGraph V) {n : ℕ}
abbrev Coloring (α : Type v) := G →g (⊤ : SimpleGraph α)
#align simple_graph.coloring SimpleGraph.Coloring
variable {G} {α β : Type*} (C : G.Coloring α)
theorem Coloring.valid {v w : V} (h : G.Adj v w) : C v ≠ C w :=
C.map_rel h
#align simple_graph.coloring.valid SimpleGraph.Coloring.valid
@[match_pattern]
def Coloring.mk (color : V → α) (valid : ∀ {v w : V}, G.Adj v w → color v ≠ color w) :
G.Coloring α :=
⟨color, @valid⟩
#align simple_graph.coloring.mk SimpleGraph.Coloring.mk
def Coloring.colorClass (c : α) : Set V := { v : V | C v = c }
#align simple_graph.coloring.color_class SimpleGraph.Coloring.colorClass
def Coloring.colorClasses : Set (Set V) := (Setoid.ker C).classes
#align simple_graph.coloring.color_classes SimpleGraph.Coloring.colorClasses
theorem Coloring.mem_colorClass (v : V) : v ∈ C.colorClass (C v) := rfl
#align simple_graph.coloring.mem_color_class SimpleGraph.Coloring.mem_colorClass
theorem Coloring.colorClasses_isPartition : Setoid.IsPartition C.colorClasses :=
Setoid.isPartition_classes (Setoid.ker C)
#align simple_graph.coloring.color_classes_is_partition SimpleGraph.Coloring.colorClasses_isPartition
theorem Coloring.mem_colorClasses {v : V} : C.colorClass (C v) ∈ C.colorClasses :=
⟨v, rfl⟩
#align simple_graph.coloring.mem_color_classes SimpleGraph.Coloring.mem_colorClasses
theorem Coloring.colorClasses_finite [Finite α] : C.colorClasses.Finite :=
Setoid.finite_classes_ker _
#align simple_graph.coloring.color_classes_finite SimpleGraph.Coloring.colorClasses_finite
theorem Coloring.card_colorClasses_le [Fintype α] [Fintype C.colorClasses] :
Fintype.card C.colorClasses ≤ Fintype.card α := by
simp [colorClasses]
-- Porting note: brute force instance declaration `[Fintype (Setoid.classes (Setoid.ker C))]`
haveI : Fintype (Setoid.classes (Setoid.ker C)) := by assumption
convert Setoid.card_classes_ker_le C
#align simple_graph.coloring.card_color_classes_le SimpleGraph.Coloring.card_colorClasses_le
theorem Coloring.not_adj_of_mem_colorClass {c : α} {v w : V} (hv : v ∈ C.colorClass c)
(hw : w ∈ C.colorClass c) : ¬G.Adj v w := fun h => C.valid h (Eq.trans hv (Eq.symm hw))
#align simple_graph.coloring.not_adj_of_mem_color_class SimpleGraph.Coloring.not_adj_of_mem_colorClass
theorem Coloring.color_classes_independent (c : α) : IsAntichain G.Adj (C.colorClass c) :=
fun _ hv _ hw _ => C.not_adj_of_mem_colorClass hv hw
#align simple_graph.coloring.color_classes_independent SimpleGraph.Coloring.color_classes_independent
-- TODO make this computable
noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) := by
classical
change Fintype (RelHom G.Adj (⊤ : SimpleGraph α).Adj)
apply Fintype.ofInjective _ RelHom.coe_fn_injective
variable (G)
def Colorable (n : ℕ) : Prop := Nonempty (G.Coloring (Fin n))
#align simple_graph.colorable SimpleGraph.Colorable
def coloringOfIsEmpty [IsEmpty V] : G.Coloring α :=
Coloring.mk isEmptyElim fun {v} => isEmptyElim v
#align simple_graph.coloring_of_is_empty SimpleGraph.coloringOfIsEmpty
theorem colorable_of_isEmpty [IsEmpty V] (n : ℕ) : G.Colorable n :=
⟨G.coloringOfIsEmpty⟩
#align simple_graph.colorable_of_is_empty SimpleGraph.colorable_of_isEmpty
theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
constructor
intro v
obtain ⟨i, hi⟩ := h.some v
exact Nat.not_lt_zero _ hi
#align simple_graph.is_empty_of_colorable_zero SimpleGraph.isEmpty_of_colorable_zero
def selfColoring : G.Coloring V := Coloring.mk id fun {_ _} => G.ne_of_adj
#align simple_graph.self_coloring SimpleGraph.selfColoring
noncomputable def chromaticNumber : ℕ∞ := ⨅ n ∈ setOf G.Colorable, (n : ℕ∞)
#align simple_graph.chromatic_number SimpleGraph.chromaticNumber
lemma chromaticNumber_eq_biInf {G : SimpleGraph V} :
G.chromaticNumber = ⨅ n ∈ setOf G.Colorable, (n : ℕ∞) := rfl
lemma chromaticNumber_eq_iInf {G : SimpleGraph V} :
G.chromaticNumber = ⨅ n : {m | G.Colorable m}, (n : ℕ∞) := by
rw [chromaticNumber, iInf_subtype]
lemma Colorable.chromaticNumber_eq_sInf {G : SimpleGraph V} {n} (h : G.Colorable n) :
G.chromaticNumber = sInf {n' : ℕ | G.Colorable n'} := by
rw [ENat.coe_sInf, chromaticNumber]
exact ⟨_, h⟩
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
toFun C := (Embedding.completeGraph f).toHom.comp C
inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
intro C C' h
dsimp only at h
ext v
apply (Embedding.completeGraph f).inj'
change ((Embedding.completeGraph f).toHom.comp C) v = _
rw [h]
rfl
#align simple_graph.recolor_of_embedding SimpleGraph.recolorOfEmbedding
@[simp] lemma coe_recolorOfEmbedding (f : α ↪ β) :
⇑(G.recolorOfEmbedding f) = (Embedding.completeGraph f).toHom.comp := rfl
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β where
toFun := G.recolorOfEmbedding f.toEmbedding
invFun := G.recolorOfEmbedding f.symm.toEmbedding
left_inv C := by
ext v
apply Equiv.symm_apply_apply
right_inv C := by
ext v
apply Equiv.apply_symm_apply
#align simple_graph.recolor_of_equiv SimpleGraph.recolorOfEquiv
@[simp] lemma coe_recolorOfEquiv (f : α ≃ β) :
⇑(G.recolorOfEquiv f) = (Embedding.completeGraph f).toHom.comp := rfl
noncomputable def recolorOfCardLE {α β : Type*} [Fintype α] [Fintype β]
(hn : Fintype.card α ≤ Fintype.card β) : G.Coloring α ↪ G.Coloring β :=
G.recolorOfEmbedding <| (Function.Embedding.nonempty_of_card_le hn).some
#align simple_graph.recolor_of_card_le SimpleGraph.recolorOfCardLE
@[simp] lemma coe_recolorOfCardLE [Fintype α] [Fintype β] (hαβ : card α ≤ card β) :
⇑(G.recolorOfCardLE hαβ) =
(Embedding.completeGraph (Embedding.nonempty_of_card_le hαβ).some).toHom.comp := rfl
variable {G}
theorem Colorable.mono {n m : ℕ} (h : n ≤ m) (hc : G.Colorable n) : G.Colorable m :=
⟨G.recolorOfCardLE (by simp [h]) hc.some⟩
#align simple_graph.colorable.mono SimpleGraph.Colorable.mono
theorem Coloring.colorable [Fintype α] (C : G.Coloring α) : G.Colorable (Fintype.card α) :=
⟨G.recolorOfCardLE (by simp) C⟩
#align simple_graph.coloring.to_colorable SimpleGraph.Coloring.colorable
theorem colorable_of_fintype (G : SimpleGraph V) [Fintype V] : G.Colorable (Fintype.card V) :=
G.selfColoring.colorable
#align simple_graph.colorable_of_fintype SimpleGraph.colorable_of_fintype
noncomputable def Colorable.toColoring [Fintype α] {n : ℕ} (hc : G.Colorable n)
(hn : n ≤ Fintype.card α) : G.Coloring α := by
rw [← Fintype.card_fin n] at hn
exact G.recolorOfCardLE hn hc.some
#align simple_graph.colorable.to_coloring SimpleGraph.Colorable.toColoring
theorem Colorable.of_embedding {V' : Type*} {G' : SimpleGraph V'} (f : G ↪g G') {n : ℕ}
(h : G'.Colorable n) : G.Colorable n :=
⟨(h.toColoring (by simp)).comp f⟩
#align simple_graph.colorable.of_embedding SimpleGraph.Colorable.of_embedding
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
constructor
· rintro hc
have C : G.Coloring (Fin n) := hc.toColoring (by simp)
let f := Embedding.completeGraph (@Fin.valEmbedding n)
use f.toHom.comp C
intro v
cases' C with color valid
exact Fin.is_lt (color v)
· rintro ⟨C, Cf⟩
refine ⟨Coloring.mk ?_ ?_⟩
· exact fun v => ⟨C v, Cf v⟩
· rintro v w hvw
simp only [Fin.mk_eq_mk, Ne]
exact C.valid hvw
#align simple_graph.colorable_iff_exists_bdd_nat_coloring SimpleGraph.colorable_iff_exists_bdd_nat_coloring
theorem colorable_set_nonempty_of_colorable {n : ℕ} (hc : G.Colorable n) :
{ n : ℕ | G.Colorable n }.Nonempty :=
⟨n, hc⟩
#align simple_graph.colorable_set_nonempty_of_colorable SimpleGraph.colorable_set_nonempty_of_colorable
theorem chromaticNumber_bddBelow : BddBelow { n : ℕ | G.Colorable n } :=
⟨0, fun _ _ => zero_le _⟩
#align simple_graph.chromatic_number_bdd_below SimpleGraph.chromaticNumber_bddBelow
theorem Colorable.chromaticNumber_le {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n := by
rw [hc.chromaticNumber_eq_sInf]
norm_cast
apply csInf_le chromaticNumber_bddBelow
exact hc
#align simple_graph.chromatic_number_le_of_colorable SimpleGraph.Colorable.chromaticNumber_le
theorem chromaticNumber_ne_top_iff_exists : G.chromaticNumber ≠ ⊤ ↔ ∃ n, G.Colorable n := by
rw [chromaticNumber]
convert_to ⨅ n : {m | G.Colorable m}, (n : ℕ∞) ≠ ⊤ ↔ _
· rw [iInf_subtype]
rw [← lt_top_iff_ne_top, ENat.iInf_coe_lt_top]
simp
theorem chromaticNumber_le_iff_colorable {n : ℕ} : G.chromaticNumber ≤ n ↔ G.Colorable n := by
refine ⟨fun h ↦ ?_, Colorable.chromaticNumber_le⟩
have : G.chromaticNumber ≠ ⊤ := (trans h (WithTop.coe_lt_top n)).ne
rw [chromaticNumber_ne_top_iff_exists] at this
obtain ⟨m, hm⟩ := this
rw [hm.chromaticNumber_eq_sInf, Nat.cast_le] at h
have := Nat.sInf_mem (⟨m, hm⟩ : {n' | G.Colorable n'}.Nonempty)
rw [Set.mem_setOf_eq] at this
exact this.mono h
@[deprecated Colorable.chromaticNumber_le (since := "2024-03-21")]
theorem chromaticNumber_le_card [Fintype α] (C : G.Coloring α) :
G.chromaticNumber ≤ Fintype.card α := C.colorable.chromaticNumber_le
#align simple_graph.chromatic_number_le_card SimpleGraph.chromaticNumber_le_card
| Mathlib/Combinatorics/SimpleGraph/Coloring.lean | 305 | 310 | theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) :
G.Colorable (ENat.toNat G.chromaticNumber) := by |
classical
rw [hc.chromaticNumber_eq_sInf, Nat.sInf_def]
· apply Nat.find_spec
· exact colorable_set_nonempty_of_colorable hc
|
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.MeasureTheory.Function.Egorov
import Mathlib.MeasureTheory.Function.LpSpace
#align_import measure_theory.function.convergence_in_measure from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory Topology
namespace MeasureTheory
variable {α ι E : Type*} {m : MeasurableSpace α} {μ : Measure α}
def TendstoInMeasure [Dist E] {_ : MeasurableSpace α} (μ : Measure α) (f : ι → α → E) (l : Filter ι)
(g : α → E) : Prop :=
∀ ε, 0 < ε → Tendsto (fun i => μ { x | ε ≤ dist (f i x) (g x) }) l (𝓝 0)
#align measure_theory.tendsto_in_measure MeasureTheory.TendstoInMeasure
theorem tendstoInMeasure_iff_norm [SeminormedAddCommGroup E] {l : Filter ι} {f : ι → α → E}
{g : α → E} :
TendstoInMeasure μ f l g ↔
∀ ε, 0 < ε → Tendsto (fun i => μ { x | ε ≤ ‖f i x - g x‖ }) l (𝓝 0) := by
simp_rw [TendstoInMeasure, dist_eq_norm]
#align measure_theory.tendsto_in_measure_iff_norm MeasureTheory.tendstoInMeasure_iff_norm
section ExistsSeqTendstoAe
variable [MetricSpace E]
variable {f : ℕ → α → E} {g : α → E}
theorem tendstoInMeasure_of_tendsto_ae_of_stronglyMeasurable [IsFiniteMeasure μ]
(hf : ∀ n, StronglyMeasurable (f n)) (hg : StronglyMeasurable g)
(hfg : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x))) : TendstoInMeasure μ f atTop g := by
refine fun ε hε => ENNReal.tendsto_atTop_zero.mpr fun δ hδ => ?_
by_cases hδi : δ = ∞
· simp only [hδi, imp_true_iff, le_top, exists_const]
lift δ to ℝ≥0 using hδi
rw [gt_iff_lt, ENNReal.coe_pos, ← NNReal.coe_pos] at hδ
obtain ⟨t, _, ht, hunif⟩ := tendstoUniformlyOn_of_ae_tendsto' hf hg hfg hδ
rw [ENNReal.ofReal_coe_nnreal] at ht
rw [Metric.tendstoUniformlyOn_iff] at hunif
obtain ⟨N, hN⟩ := eventually_atTop.1 (hunif ε hε)
refine ⟨N, fun n hn => ?_⟩
suffices { x : α | ε ≤ dist (f n x) (g x) } ⊆ t from (measure_mono this).trans ht
rw [← Set.compl_subset_compl]
intro x hx
rw [Set.mem_compl_iff, Set.nmem_setOf_iff, dist_comm, not_le]
exact hN n hn x hx
#align measure_theory.tendsto_in_measure_of_tendsto_ae_of_strongly_measurable MeasureTheory.tendstoInMeasure_of_tendsto_ae_of_stronglyMeasurable
theorem tendstoInMeasure_of_tendsto_ae [IsFiniteMeasure μ] (hf : ∀ n, AEStronglyMeasurable (f n) μ)
(hfg : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x))) : TendstoInMeasure μ f atTop g := by
have hg : AEStronglyMeasurable g μ := aestronglyMeasurable_of_tendsto_ae _ hf hfg
refine TendstoInMeasure.congr (fun i => (hf i).ae_eq_mk.symm) hg.ae_eq_mk.symm ?_
refine tendstoInMeasure_of_tendsto_ae_of_stronglyMeasurable
(fun i => (hf i).stronglyMeasurable_mk) hg.stronglyMeasurable_mk ?_
have hf_eq_ae : ∀ᵐ x ∂μ, ∀ n, (hf n).mk (f n) x = f n x :=
ae_all_iff.mpr fun n => (hf n).ae_eq_mk.symm
filter_upwards [hf_eq_ae, hg.ae_eq_mk, hfg] with x hxf hxg hxfg
rw [← hxg, funext fun n => hxf n]
exact hxfg
#align measure_theory.tendsto_in_measure_of_tendsto_ae MeasureTheory.tendstoInMeasure_of_tendsto_ae
namespace ExistsSeqTendstoAe
theorem exists_nat_measure_lt_two_inv (hfg : TendstoInMeasure μ f atTop g) (n : ℕ) :
∃ N, ∀ m ≥ N, μ { x | (2 : ℝ)⁻¹ ^ n ≤ dist (f m x) (g x) } ≤ (2⁻¹ : ℝ≥0∞) ^ n := by
specialize hfg ((2⁻¹ : ℝ) ^ n) (by simp only [Real.rpow_natCast, inv_pos, zero_lt_two, pow_pos])
rw [ENNReal.tendsto_atTop_zero] at hfg
exact hfg ((2 : ℝ≥0∞)⁻¹ ^ n) (pos_iff_ne_zero.mpr fun h_zero => by simpa using pow_eq_zero h_zero)
#align measure_theory.exists_seq_tendsto_ae.exists_nat_measure_lt_two_inv MeasureTheory.ExistsSeqTendstoAe.exists_nat_measure_lt_two_inv
noncomputable def seqTendstoAeSeqAux (hfg : TendstoInMeasure μ f atTop g) (n : ℕ) :=
Classical.choose (exists_nat_measure_lt_two_inv hfg n)
#align measure_theory.exists_seq_tendsto_ae.seq_tendsto_ae_seq_aux MeasureTheory.ExistsSeqTendstoAe.seqTendstoAeSeqAux
noncomputable def seqTendstoAeSeq (hfg : TendstoInMeasure μ f atTop g) : ℕ → ℕ
| 0 => seqTendstoAeSeqAux hfg 0
| n + 1 => max (seqTendstoAeSeqAux hfg (n + 1)) (seqTendstoAeSeq hfg n + 1)
#align measure_theory.exists_seq_tendsto_ae.seq_tendsto_ae_seq MeasureTheory.ExistsSeqTendstoAe.seqTendstoAeSeq
theorem seqTendstoAeSeq_succ (hfg : TendstoInMeasure μ f atTop g) {n : ℕ} :
seqTendstoAeSeq hfg (n + 1) =
max (seqTendstoAeSeqAux hfg (n + 1)) (seqTendstoAeSeq hfg n + 1) := by
rw [seqTendstoAeSeq]
#align measure_theory.exists_seq_tendsto_ae.seq_tendsto_ae_seq_succ MeasureTheory.ExistsSeqTendstoAe.seqTendstoAeSeq_succ
theorem seqTendstoAeSeq_spec (hfg : TendstoInMeasure μ f atTop g) (n k : ℕ)
(hn : seqTendstoAeSeq hfg n ≤ k) :
μ { x | (2 : ℝ)⁻¹ ^ n ≤ dist (f k x) (g x) } ≤ (2 : ℝ≥0∞)⁻¹ ^ n := by
cases n
· exact Classical.choose_spec (exists_nat_measure_lt_two_inv hfg 0) k hn
· exact Classical.choose_spec
(exists_nat_measure_lt_two_inv hfg _) _ (le_trans (le_max_left _ _) hn)
#align measure_theory.exists_seq_tendsto_ae.seq_tendsto_ae_seq_spec MeasureTheory.ExistsSeqTendstoAe.seqTendstoAeSeq_spec
| Mathlib/MeasureTheory/Function/ConvergenceInMeasure.lean | 178 | 182 | theorem seqTendstoAeSeq_strictMono (hfg : TendstoInMeasure μ f atTop g) :
StrictMono (seqTendstoAeSeq hfg) := by |
refine strictMono_nat_of_lt_succ fun n => ?_
rw [seqTendstoAeSeq_succ]
exact lt_of_lt_of_le (lt_add_one <| seqTendstoAeSeq hfg n) (le_max_right _ _)
|
import Mathlib.Init.Data.Ordering.Basic
import Mathlib.Order.Synonym
#align_import order.compare from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable {α β : Type*}
def cmpLE {α} [LE α] [@DecidableRel α (· ≤ ·)] (x y : α) : Ordering :=
if x ≤ y then if y ≤ x then Ordering.eq else Ordering.lt else Ordering.gt
#align cmp_le cmpLE
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
(cmpLE x y).swap = cmpLE y x := by
by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, *, Ordering.swap]
cases not_or_of_not xy yx (total_of _ _ _)
#align cmp_le_swap cmpLE_swap
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
[@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
cases not_or_of_not xy yx (total_of _ _ _)
#align cmp_le_eq_cmp cmpLE_eq_cmp
open Ordering OrderDual
@[simp]
theorem toDual_compares_toDual [LT α] {a b : α} {o : Ordering} :
Compares o (toDual a) (toDual b) ↔ Compares o b a := by
cases o
exacts [Iff.rfl, eq_comm, Iff.rfl]
#align to_dual_compares_to_dual toDual_compares_toDual
@[simp]
theorem ofDual_compares_ofDual [LT α] {a b : αᵒᵈ} {o : Ordering} :
Compares o (ofDual a) (ofDual b) ↔ Compares o b a := by
cases o
exacts [Iff.rfl, eq_comm, Iff.rfl]
#align of_dual_compares_of_dual ofDual_compares_ofDual
| Mathlib/Order/Compare.lean | 167 | 168 | theorem cmp_compares [LinearOrder α] (a b : α) : (cmp a b).Compares a b := by |
obtain h | h | h := lt_trichotomy a b <;> simp [cmp, cmpUsing, h, h.not_lt]
|
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Ring.Opposite
import Mathlib.Tactic.Abel
#align_import algebra.geom_sum from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
-- Porting note: corrected type in the description of `geom_sum₂_Ico` (in the doc string only).
universe u
variable {α : Type u}
open Finset MulOpposite
@[simp]
theorem neg_one_geom_sum [Ring α] {n : ℕ} :
∑ i ∈ range n, (-1 : α) ^ i = if Even n then 0 else 1 := by
induction' n with k hk
· simp
· simp only [geom_sum_succ', Nat.even_add_one, hk]
split_ifs with h
· rw [h.neg_one_pow, add_zero]
· rw [(Nat.odd_iff_not_even.2 h).neg_one_pow, neg_add_self]
#align neg_one_geom_sum neg_one_geom_sum
theorem geom_sum₂_self {α : Type*} [CommRing α] (x : α) (n : ℕ) :
∑ i ∈ range n, x ^ i * x ^ (n - 1 - i) = n * x ^ (n - 1) :=
calc
∑ i ∈ Finset.range n, x ^ i * x ^ (n - 1 - i) =
∑ i ∈ Finset.range n, x ^ (i + (n - 1 - i)) := by
simp_rw [← pow_add]
_ = ∑ _i ∈ Finset.range n, x ^ (n - 1) :=
Finset.sum_congr rfl fun i hi =>
congr_arg _ <| add_tsub_cancel_of_le <| Nat.le_sub_one_of_lt <| Finset.mem_range.1 hi
_ = (Finset.range n).card • x ^ (n - 1) := Finset.sum_const _
_ = n * x ^ (n - 1) := by rw [Finset.card_range, nsmul_eq_mul]
#align geom_sum₂_self geom_sum₂_self
theorem geom_sum₂_mul_add [CommSemiring α] (x y : α) (n : ℕ) :
(∑ i ∈ range n, (x + y) ^ i * y ^ (n - 1 - i)) * x + y ^ n = (x + y) ^ n :=
(Commute.all x y).geom_sum₂_mul_add n
#align geom_sum₂_mul_add geom_sum₂_mul_add
theorem geom_sum_mul_add [Semiring α] (x : α) (n : ℕ) :
(∑ i ∈ range n, (x + 1) ^ i) * x + 1 = (x + 1) ^ n := by
have := (Commute.one_right x).geom_sum₂_mul_add n
rw [one_pow, geom_sum₂_with_one] at this
exact this
#align geom_sum_mul_add geom_sum_mul_add
protected theorem Commute.geom_sum₂_mul [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
(∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ n := by
have := (h.sub_left (Commute.refl y)).geom_sum₂_mul_add n
rw [sub_add_cancel] at this
rw [← this, add_sub_cancel_right]
#align commute.geom_sum₂_mul Commute.geom_sum₂_mul
| Mathlib/Algebra/GeomSum.lean | 175 | 179 | theorem Commute.mul_neg_geom_sum₂ [Ring α] {x y : α} (h : Commute x y) (n : ℕ) :
((y - x) * ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) = y ^ n - x ^ n := by |
apply op_injective
simp only [op_mul, op_sub, op_geom_sum₂, op_pow]
simp [(Commute.op h.symm).geom_sum₂_mul n]
|
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04"
namespace Set
variable {α β : Type*} {s t : Set α}
noncomputable def encard (s : Set α) : ℕ∞ := PartENat.withTopEquiv (PartENat.card s)
@[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s := by
rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)]
theorem encard_univ (α : Type*) :
encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) := by
rw [encard, PartENat.card_congr (Equiv.Set.univ α)]
theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by
have := h.fintype
rw [encard, PartENat.card_eq_coe_fintype_card,
PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card]
theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card := by
have h := toFinite s
rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset]
theorem encard_coe_eq_coe_finsetCard (s : Finset α) : encard (s : Set α) = s.card := by
rw [Finite.encard_eq_coe_toFinset_card (Finset.finite_toSet s)]; simp
theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ := by
have := h.to_subtype
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.withTopEquiv_symm_top, PartENat.card_eq_top_of_infinite]
@[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ := by
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.withTopEquiv_symm_zero, PartENat.card_eq_zero_iff_empty, isEmpty_subtype,
eq_empty_iff_forall_not_mem]
@[simp] theorem encard_empty : (∅ : Set α).encard = 0 := by
rw [encard_eq_zero]
theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty := by
rwa [nonempty_iff_ne_empty, Ne, ← encard_eq_zero]
theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty := by
rw [ne_eq, encard_eq_zero, nonempty_iff_ne_empty]
@[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty := by
rw [pos_iff_ne_zero, encard_ne_zero]
@[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 := by
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.card_eq_coe_fintype_card, Fintype.card_ofSubsingleton, Nat.cast_one]; rfl
theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard := by
classical
have e := (Equiv.Set.union (by rwa [subset_empty_iff, ← disjoint_iff_inter_eq_empty])).symm
simp [encard, ← PartENat.card_congr e, PartENat.card_sum, PartENat.withTopEquiv]
| Mathlib/Data/Set/Card.lean | 116 | 117 | theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 := by |
rw [← union_singleton, encard_union_eq (by simpa), encard_singleton]
|
import Mathlib.Algebra.Module.Submodule.EqLocus
import Mathlib.Algebra.Module.Submodule.RestrictScalars
import Mathlib.Algebra.Ring.Idempotents
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.LinearAlgebra.Basic
import Mathlib.Order.CompactlyGenerated.Basic
import Mathlib.Order.OmegaCompletePartialOrder
#align_import linear_algebra.span from "leanprover-community/mathlib"@"10878f6bf1dab863445907ab23fbfcefcb5845d0"
variable {R R₂ K M M₂ V S : Type*}
namespace Submodule
open Function Set
open Pointwise
section AddCommMonoid
variable [Semiring R] [AddCommMonoid M] [Module R M]
variable {x : M} (p p' : Submodule R M)
variable [Semiring R₂] {σ₁₂ : R →+* R₂}
variable [AddCommMonoid M₂] [Module R₂ M₂]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F σ₁₂ M M₂]
section
variable (R)
def span (s : Set M) : Submodule R M :=
sInf { p | s ⊆ p }
#align submodule.span Submodule.span
variable {R}
-- Porting note: renamed field to `principal'` and added `principal` to fix explicit argument
@[mk_iff]
class IsPrincipal (S : Submodule R M) : Prop where
principal' : ∃ a, S = span R {a}
#align submodule.is_principal Submodule.IsPrincipal
theorem IsPrincipal.principal (S : Submodule R M) [S.IsPrincipal] :
∃ a, S = span R {a} :=
Submodule.IsPrincipal.principal'
#align submodule.is_principal.principal Submodule.IsPrincipal.principal
end
variable {s t : Set M}
theorem mem_span : x ∈ span R s ↔ ∀ p : Submodule R M, s ⊆ p → x ∈ p :=
mem_iInter₂
#align submodule.mem_span Submodule.mem_span
@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_span : s ⊆ span R s := fun _ h => mem_span.2 fun _ hp => hp h
#align submodule.subset_span Submodule.subset_span
theorem span_le {p} : span R s ≤ p ↔ s ⊆ p :=
⟨Subset.trans subset_span, fun ss _ h => mem_span.1 h _ ss⟩
#align submodule.span_le Submodule.span_le
theorem span_mono (h : s ⊆ t) : span R s ≤ span R t :=
span_le.2 <| Subset.trans h subset_span
#align submodule.span_mono Submodule.span_mono
theorem span_monotone : Monotone (span R : Set M → Submodule R M) := fun _ _ => span_mono
#align submodule.span_monotone Submodule.span_monotone
theorem span_eq_of_le (h₁ : s ⊆ p) (h₂ : p ≤ span R s) : span R s = p :=
le_antisymm (span_le.2 h₁) h₂
#align submodule.span_eq_of_le Submodule.span_eq_of_le
theorem span_eq : span R (p : Set M) = p :=
span_eq_of_le _ (Subset.refl _) subset_span
#align submodule.span_eq Submodule.span_eq
theorem span_eq_span (hs : s ⊆ span R t) (ht : t ⊆ span R s) : span R s = span R t :=
le_antisymm (span_le.2 hs) (span_le.2 ht)
#align submodule.span_eq_span Submodule.span_eq_span
lemma coe_span_eq_self [SetLike S M] [AddSubmonoidClass S M] [SMulMemClass S R M] (s : S) :
(span R (s : Set M) : Set M) = s := by
refine le_antisymm ?_ subset_span
let s' : Submodule R M :=
{ carrier := s
add_mem' := add_mem
zero_mem' := zero_mem _
smul_mem' := SMulMemClass.smul_mem }
exact span_le (p := s') |>.mpr le_rfl
@[simp]
theorem span_coe_eq_restrictScalars [Semiring S] [SMul S R] [Module S M] [IsScalarTower S R M] :
span S (p : Set M) = p.restrictScalars S :=
span_eq (p.restrictScalars S)
#align submodule.span_coe_eq_restrict_scalars Submodule.span_coe_eq_restrictScalars
theorem image_span_subset (f : F) (s : Set M) (N : Submodule R₂ M₂) :
f '' span R s ⊆ N ↔ ∀ m ∈ s, f m ∈ N := image_subset_iff.trans <| span_le (p := N.comap f)
theorem image_span_subset_span (f : F) (s : Set M) : f '' span R s ⊆ span R₂ (f '' s) :=
(image_span_subset f s _).2 fun x hx ↦ subset_span ⟨x, hx, rfl⟩
theorem map_span [RingHomSurjective σ₁₂] (f : F) (s : Set M) :
(span R s).map f = span R₂ (f '' s) :=
Eq.symm <| span_eq_of_le _ (Set.image_subset f subset_span) (image_span_subset_span f s)
#align submodule.map_span Submodule.map_span
alias _root_.LinearMap.map_span := Submodule.map_span
#align linear_map.map_span LinearMap.map_span
theorem map_span_le [RingHomSurjective σ₁₂] (f : F) (s : Set M) (N : Submodule R₂ M₂) :
map f (span R s) ≤ N ↔ ∀ m ∈ s, f m ∈ N := image_span_subset f s N
#align submodule.map_span_le Submodule.map_span_le
alias _root_.LinearMap.map_span_le := Submodule.map_span_le
#align linear_map.map_span_le LinearMap.map_span_le
@[simp]
theorem span_insert_zero : span R (insert (0 : M) s) = span R s := by
refine le_antisymm ?_ (Submodule.span_mono (Set.subset_insert 0 s))
rw [span_le, Set.insert_subset_iff]
exact ⟨by simp only [SetLike.mem_coe, Submodule.zero_mem], Submodule.subset_span⟩
#align submodule.span_insert_zero Submodule.span_insert_zero
-- See also `span_preimage_eq` below.
theorem span_preimage_le (f : F) (s : Set M₂) :
span R (f ⁻¹' s) ≤ (span R₂ s).comap f := by
rw [span_le, comap_coe]
exact preimage_mono subset_span
#align submodule.span_preimage_le Submodule.span_preimage_le
alias _root_.LinearMap.span_preimage_le := Submodule.span_preimage_le
#align linear_map.span_preimage_le LinearMap.span_preimage_le
theorem closure_subset_span {s : Set M} : (AddSubmonoid.closure s : Set M) ⊆ span R s :=
(@AddSubmonoid.closure_le _ _ _ (span R s).toAddSubmonoid).mpr subset_span
#align submodule.closure_subset_span Submodule.closure_subset_span
theorem closure_le_toAddSubmonoid_span {s : Set M} :
AddSubmonoid.closure s ≤ (span R s).toAddSubmonoid :=
closure_subset_span
#align submodule.closure_le_to_add_submonoid_span Submodule.closure_le_toAddSubmonoid_span
@[simp]
theorem span_closure {s : Set M} : span R (AddSubmonoid.closure s : Set M) = span R s :=
le_antisymm (span_le.mpr closure_subset_span) (span_mono AddSubmonoid.subset_closure)
#align submodule.span_closure Submodule.span_closure
@[elab_as_elim]
theorem span_induction {p : M → Prop} (h : x ∈ span R s) (mem : ∀ x ∈ s, p x) (zero : p 0)
(add : ∀ x y, p x → p y → p (x + y)) (smul : ∀ (a : R) (x), p x → p (a • x)) : p x :=
((@span_le (p := ⟨⟨⟨p, by intros x y; exact add x y⟩, zero⟩, smul⟩)) s).2 mem h
#align submodule.span_induction Submodule.span_induction
theorem span_induction₂ {p : M → M → Prop} {a b : M} (ha : a ∈ Submodule.span R s)
(hb : b ∈ Submodule.span R s) (mem_mem : ∀ x ∈ s, ∀ y ∈ s, p x y)
(zero_left : ∀ y, p 0 y) (zero_right : ∀ x, p x 0)
(add_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ + x₂) y)
(add_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ + y₂))
(smul_left : ∀ (r : R) x y, p x y → p (r • x) y)
(smul_right : ∀ (r : R) x y, p x y → p x (r • y)) : p a b :=
Submodule.span_induction ha
(fun x hx => Submodule.span_induction hb (mem_mem x hx) (zero_right x) (add_right x) fun r =>
smul_right r x)
(zero_left b) (fun x₁ x₂ => add_left x₁ x₂ b) fun r x => smul_left r x b
@[elab_as_elim]
theorem span_induction' {p : ∀ x, x ∈ span R s → Prop}
(mem : ∀ (x) (h : x ∈ s), p x (subset_span h))
(zero : p 0 (Submodule.zero_mem _))
(add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (Submodule.add_mem _ ‹_› ‹_›))
(smul : ∀ (a : R) (x hx), p x hx → p (a • x) (Submodule.smul_mem _ _ ‹_›)) {x}
(hx : x ∈ span R s) : p x hx := by
refine Exists.elim ?_ fun (hx : x ∈ span R s) (hc : p x hx) => hc
refine
span_induction hx (fun m hm => ⟨subset_span hm, mem m hm⟩) ⟨zero_mem _, zero⟩
(fun x y hx hy =>
Exists.elim hx fun hx' hx =>
Exists.elim hy fun hy' hy => ⟨add_mem hx' hy', add _ _ _ _ hx hy⟩)
fun r x hx => Exists.elim hx fun hx' hx => ⟨smul_mem _ _ hx', smul r _ _ hx⟩
#align submodule.span_induction' Submodule.span_induction'
open AddSubmonoid in
theorem span_eq_closure {s : Set M} : (span R s).toAddSubmonoid = closure (@univ R • s) := by
refine le_antisymm
(fun x hx ↦ span_induction hx (fun x hx ↦ subset_closure ⟨1, trivial, x, hx, one_smul R x⟩)
(zero_mem _) (fun _ _ ↦ add_mem) fun r m hm ↦ closure_induction hm ?_ ?_ fun _ _ h h' ↦ ?_)
(closure_le.2 ?_)
· rintro _ ⟨r, -, m, hm, rfl⟩; exact smul_mem _ _ (subset_span hm)
· rintro _ ⟨r', -, m, hm, rfl⟩; exact subset_closure ⟨r * r', trivial, m, hm, mul_smul r r' m⟩
· rw [smul_zero]; apply zero_mem
· rw [smul_add]; exact add_mem h h'
@[elab_as_elim]
theorem closure_induction {p : M → Prop} (h : x ∈ span R s) (zero : p 0)
(add : ∀ x y, p x → p y → p (x + y)) (smul_mem : ∀ r : R, ∀ x ∈ s, p (r • x)) : p x := by
rw [← mem_toAddSubmonoid, span_eq_closure] at h
refine AddSubmonoid.closure_induction h ?_ zero add
rintro _ ⟨r, -, m, hm, rfl⟩
exact smul_mem r m hm
@[elab_as_elim]
theorem closure_induction' {p : ∀ x, x ∈ span R s → Prop}
(zero : p 0 (Submodule.zero_mem _))
(add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (Submodule.add_mem _ ‹_› ‹_›))
(smul_mem : ∀ (r x) (h : x ∈ s), p (r • x) (Submodule.smul_mem _ _ <| subset_span h)) {x}
(hx : x ∈ span R s) : p x hx := by
refine Exists.elim ?_ fun (hx : x ∈ span R s) (hc : p x hx) ↦ hc
refine closure_induction hx ⟨zero_mem _, zero⟩
(fun x y hx hy ↦ Exists.elim hx fun hx' hx ↦
Exists.elim hy fun hy' hy ↦ ⟨add_mem hx' hy', add _ _ _ _ hx hy⟩)
fun r x hx ↦ ⟨Submodule.smul_mem _ _ (subset_span hx), smul_mem r x hx⟩
@[simp]
theorem span_span_coe_preimage : span R (((↑) : span R s → M) ⁻¹' s) = ⊤ :=
eq_top_iff.2 fun x ↦ Subtype.recOn x fun x hx _ ↦ by
refine span_induction' (p := fun x hx ↦ (⟨x, hx⟩ : span R s) ∈ span R (Subtype.val ⁻¹' s))
(fun x' hx' ↦ subset_span hx') ?_ (fun x _ y _ ↦ ?_) (fun r x _ ↦ ?_) hx
· exact zero_mem _
· exact add_mem
· exact smul_mem _ _
#align submodule.span_span_coe_preimage Submodule.span_span_coe_preimage
@[simp]
lemma span_setOf_mem_eq_top :
span R {x : span R s | (x : M) ∈ s} = ⊤ :=
span_span_coe_preimage
theorem span_nat_eq_addSubmonoid_closure (s : Set M) :
(span ℕ s).toAddSubmonoid = AddSubmonoid.closure s := by
refine Eq.symm (AddSubmonoid.closure_eq_of_le subset_span ?_)
apply (OrderIso.to_galoisConnection (AddSubmonoid.toNatSubmodule (M := M)).symm).l_le
(a := span ℕ s) (b := AddSubmonoid.closure s)
rw [span_le]
exact AddSubmonoid.subset_closure
#align submodule.span_nat_eq_add_submonoid_closure Submodule.span_nat_eq_addSubmonoid_closure
@[simp]
theorem span_nat_eq (s : AddSubmonoid M) : (span ℕ (s : Set M)).toAddSubmonoid = s := by
rw [span_nat_eq_addSubmonoid_closure, s.closure_eq]
#align submodule.span_nat_eq Submodule.span_nat_eq
theorem span_int_eq_addSubgroup_closure {M : Type*} [AddCommGroup M] (s : Set M) :
(span ℤ s).toAddSubgroup = AddSubgroup.closure s :=
Eq.symm <|
AddSubgroup.closure_eq_of_le _ subset_span fun x hx =>
span_induction hx (fun x hx => AddSubgroup.subset_closure hx) (AddSubgroup.zero_mem _)
(fun _ _ => AddSubgroup.add_mem _) fun _ _ _ => AddSubgroup.zsmul_mem _ ‹_› _
#align submodule.span_int_eq_add_subgroup_closure Submodule.span_int_eq_addSubgroup_closure
@[simp]
theorem span_int_eq {M : Type*} [AddCommGroup M] (s : AddSubgroup M) :
(span ℤ (s : Set M)).toAddSubgroup = s := by rw [span_int_eq_addSubgroup_closure, s.closure_eq]
#align submodule.span_int_eq Submodule.span_int_eq
section
variable (R M)
protected def gi : GaloisInsertion (@span R M _ _ _) (↑) where
choice s _ := span R s
gc _ _ := span_le
le_l_u _ := subset_span
choice_eq _ _ := rfl
#align submodule.gi Submodule.gi
end
@[simp]
theorem span_empty : span R (∅ : Set M) = ⊥ :=
(Submodule.gi R M).gc.l_bot
#align submodule.span_empty Submodule.span_empty
@[simp]
theorem span_univ : span R (univ : Set M) = ⊤ :=
eq_top_iff.2 <| SetLike.le_def.2 <| subset_span
#align submodule.span_univ Submodule.span_univ
theorem span_union (s t : Set M) : span R (s ∪ t) = span R s ⊔ span R t :=
(Submodule.gi R M).gc.l_sup
#align submodule.span_union Submodule.span_union
theorem span_iUnion {ι} (s : ι → Set M) : span R (⋃ i, s i) = ⨆ i, span R (s i) :=
(Submodule.gi R M).gc.l_iSup
#align submodule.span_Union Submodule.span_iUnion
theorem span_iUnion₂ {ι} {κ : ι → Sort*} (s : ∀ i, κ i → Set M) :
span R (⋃ (i) (j), s i j) = ⨆ (i) (j), span R (s i j) :=
(Submodule.gi R M).gc.l_iSup₂
#align submodule.span_Union₂ Submodule.span_iUnion₂
theorem span_attach_biUnion [DecidableEq M] {α : Type*} (s : Finset α) (f : s → Finset M) :
span R (s.attach.biUnion f : Set M) = ⨆ x, span R (f x) := by simp [span_iUnion]
#align submodule.span_attach_bUnion Submodule.span_attach_biUnion
theorem sup_span : p ⊔ span R s = span R (p ∪ s) := by rw [Submodule.span_union, p.span_eq]
#align submodule.sup_span Submodule.sup_span
theorem span_sup : span R s ⊔ p = span R (s ∪ p) := by rw [Submodule.span_union, p.span_eq]
#align submodule.span_sup Submodule.span_sup
notation:1000
R " ∙ " x => span R (singleton x)
| Mathlib/LinearAlgebra/Span.lean | 347 | 348 | theorem span_eq_iSup_of_singleton_spans (s : Set M) : span R s = ⨆ x ∈ s, R ∙ x := by |
simp only [← span_iUnion, Set.biUnion_of_singleton s]
|
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Logic.Pairwise
#align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
variable {α : Type*}
namespace Set
section PairwiseDisjoint
section OrderedCommGroup
variable [OrderedCommGroup α] (a b : α)
@[to_additive]
theorem pairwise_disjoint_Ioc_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioc (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_le hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_le hx.2.2
have i2 := hx.2.1.trans_le hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
#align set.pairwise_disjoint_Ioc_mul_zpow Set.pairwise_disjoint_Ioc_mul_zpow
#align set.pairwise_disjoint_Ioc_add_zsmul Set.pairwise_disjoint_Ioc_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ico_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ico (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_lt hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_lt hx.2.2
have i2 := hx.2.1.trans_lt hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
#align set.pairwise_disjoint_Ico_mul_zpow Set.pairwise_disjoint_Ico_mul_zpow
#align set.pairwise_disjoint_Ico_add_zsmul Set.pairwise_disjoint_Ico_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ioo_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioo (a * b ^ n) (a * b ^ (n + 1))) := fun _ _ hmn =>
(pairwise_disjoint_Ioc_mul_zpow a b hmn).mono Ioo_subset_Ioc_self Ioo_subset_Ioc_self
#align set.pairwise_disjoint_Ioo_mul_zpow Set.pairwise_disjoint_Ioo_mul_zpow
#align set.pairwise_disjoint_Ioo_add_zsmul Set.pairwise_disjoint_Ioo_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ioc_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioc (b ^ n) (b ^ (n + 1))) := by
simpa only [one_mul] using pairwise_disjoint_Ioc_mul_zpow 1 b
#align set.pairwise_disjoint_Ioc_zpow Set.pairwise_disjoint_Ioc_zpow
#align set.pairwise_disjoint_Ioc_zsmul Set.pairwise_disjoint_Ioc_zsmul
@[to_additive]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 219 | 221 | theorem pairwise_disjoint_Ico_zpow :
Pairwise (Disjoint on fun n : ℤ => Ico (b ^ n) (b ^ (n + 1))) := by |
simpa only [one_mul] using pairwise_disjoint_Ico_mul_zpow 1 b
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.