Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | goals listlengths 0 224 | goals_before listlengths 0 221 |
|---|---|---|---|---|---|---|---|
import Mathlib.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Adjunction.Evaluation
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Adhesive
import Mathlib.CategoryTheory.Sites.ConcreteSheafification
#align_import category_theory.sites.subsheaf from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe w v u
open Opposite CategoryTheory
namespace CategoryTheory.GrothendieckTopology
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
@[ext]
structure Subpresheaf (F : Cᵒᵖ ⥤ Type w) where
obj : ∀ U, Set (F.obj U)
map : ∀ {U V : Cᵒᵖ} (i : U ⟶ V), obj U ⊆ F.map i ⁻¹' obj V
#align category_theory.grothendieck_topology.subpresheaf CategoryTheory.GrothendieckTopology.Subpresheaf
variable {F F' F'' : Cᵒᵖ ⥤ Type w} (G G' : Subpresheaf F)
instance : PartialOrder (Subpresheaf F) :=
PartialOrder.lift Subpresheaf.obj Subpresheaf.ext
instance : Top (Subpresheaf F) :=
⟨⟨fun U => ⊤, @fun U V _ x _ => by aesop_cat⟩⟩
instance : Nonempty (Subpresheaf F) :=
inferInstance
@[simps!]
def Subpresheaf.toPresheaf : Cᵒᵖ ⥤ Type w where
obj U := G.obj U
map := @fun U V i x => ⟨F.map i x, G.map i x.prop⟩
map_id X := by
ext ⟨x, _⟩
dsimp
simp only [FunctorToTypes.map_id_apply]
map_comp := @fun X Y Z i j => by
ext ⟨x, _⟩
dsimp
simp only [FunctorToTypes.map_comp_apply]
#align category_theory.grothendieck_topology.subpresheaf.to_presheaf CategoryTheory.GrothendieckTopology.Subpresheaf.toPresheaf
instance {U} : CoeHead (G.toPresheaf.obj U) (F.obj U) where
coe := Subtype.val
@[simps]
def Subpresheaf.ι : G.toPresheaf ⟶ F where app U x := x
#align category_theory.grothendieck_topology.subpresheaf.ι CategoryTheory.GrothendieckTopology.Subpresheaf.ι
instance : Mono G.ι :=
⟨@fun _ f₁ f₂ e =>
NatTrans.ext f₁ f₂ <|
funext fun U => funext fun x => Subtype.ext <| congr_fun (congr_app e U) x⟩
@[simps]
def Subpresheaf.homOfLe {G G' : Subpresheaf F} (h : G ≤ G') : G.toPresheaf ⟶ G'.toPresheaf where
app U x := ⟨x, h U x.prop⟩
#align category_theory.grothendieck_topology.subpresheaf.hom_of_le CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe
instance {G G' : Subpresheaf F} (h : G ≤ G') : Mono (Subpresheaf.homOfLe h) :=
⟨fun f₁ f₂ e =>
NatTrans.ext f₁ f₂ <|
funext fun U =>
funext fun x =>
Subtype.ext <| (congr_arg Subtype.val <| (congr_fun (congr_app e U) x : _) : _)⟩
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Sites/Subsheaf.lean | 110 | 113 | theorem Subpresheaf.homOfLe_ι {G G' : Subpresheaf F} (h : G ≤ G') :
Subpresheaf.homOfLe h ≫ G'.ι = G.ι := by |
ext
rfl
| [
" x ∈ F.map x✝¹ ⁻¹' (fun U => ⊤) V",
" { obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.map (𝟙 X) =\n 𝟙 ({ obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.obj X)",
" ↑({ obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.map (𝟙 X) ⟨x, property✝⟩) =... | [
" x ∈ F.map x✝¹ ⁻¹' (fun U => ⊤) V",
" { obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.map (𝟙 X) =\n 𝟙 ({ obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.obj X)",
" ↑({ obj := fun U => ↑(G.obj U), map := fun U V i x => ⟨F.map i ↑x, ⋯⟩ }.map (𝟙 X) ⟨x, property✝⟩) =... |
import Mathlib.Topology.Category.LightProfinite.Basic
import Mathlib.Topology.Category.Profinite.Limits
namespace LightProfinite
universe u w
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
open CategoryTheory Limits
section Pullbacks
variable {X Y B : LightProfinite.{u}} (f : X ⟶ B) (g : Y ⟶ B)
def pullback : LightProfinite.{u} :=
letI set := { xy : X × Y | f xy.fst = g xy.snd }
haveI : CompactSpace set := isCompact_iff_compactSpace.mp
(isClosed_eq (f.continuous.comp continuous_fst) (g.continuous.comp continuous_snd)).isCompact
LightProfinite.of set
def pullback.fst : pullback f g ⟶ X where
toFun := fun ⟨⟨x, _⟩, _⟩ ↦ x
continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val
def pullback.snd : pullback f g ⟶ Y where
toFun := fun ⟨⟨_, y⟩, _⟩ ↦ y
continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val
@[reassoc]
lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by
ext ⟨_, h⟩
exact h
def pullback.lift {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
Z ⟶ pullback f g where
toFun := fun z ↦ ⟨⟨a z, b z⟩, by apply_fun (· z) at w; exact w⟩
continuous_toFun := by
apply Continuous.subtype_mk
rw [continuous_prod_mk]
exact ⟨a.continuous, b.continuous⟩
@[reassoc (attr := simp)]
lemma pullback.lift_fst {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.fst f g = a := rfl
@[reassoc (attr := simp)]
lemma pullback.lift_snd {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.snd f g = b := rfl
lemma pullback.hom_ext {Z : LightProfinite.{u}} (a b : Z ⟶ pullback f g)
(hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g)
(hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by
ext z
apply_fun (· z) at hfst hsnd
apply Subtype.ext
apply Prod.ext
· exact hfst
· exact hsnd
@[simps! pt π]
def pullback.cone : Limits.PullbackCone f g :=
Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g)
@[simps! lift]
def pullback.isLimit : Limits.IsLimit (pullback.cone f g) :=
Limits.PullbackCone.isLimitAux _
(fun s ↦ pullback.lift f g s.fst s.snd s.condition)
(fun _ ↦ pullback.lift_fst _ _ _ _ _)
(fun _ ↦ pullback.lift_snd _ _ _ _ _)
(fun _ _ hm ↦ pullback.hom_ext _ _ _ _ (hm .left) (hm .right))
section FiniteCoproducts
variable {α : Type w} [Finite α] (X : α → LightProfinite.{max u w})
def finiteCoproduct : LightProfinite := LightProfinite.of <| Σ (a : α), X a
def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X where
toFun := (⟨a, ·⟩)
continuous_toFun := continuous_sigmaMk (σ := fun a ↦ X a)
def finiteCoproduct.desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) :
finiteCoproduct X ⟶ B where
toFun := fun ⟨a, x⟩ ↦ e a x
continuous_toFun := by
apply continuous_sigma
intro a
exact (e a).continuous
@[reassoc (attr := simp)]
lemma finiteCoproduct.ι_desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) (a : α) :
finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl
lemma finiteCoproduct.hom_ext {B : LightProfinite.{max u w}} (f g : finiteCoproduct X ⟶ B)
(h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by
ext ⟨a, x⟩
specialize h a
apply_fun (· x) at h
exact h
abbrev finiteCoproduct.cofan : Limits.Cofan X :=
Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X)
def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) :=
mkCofanColimit _
(fun s ↦ desc _ fun a ↦ s.inj a)
(fun s a ↦ ι_desc _ _ _)
fun s m hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦
(by ext t; exact congrFun (congrArg DFunLike.coe (hm a)) t)
instance (n : ℕ) (F : Discrete (Fin n) ⥤ LightProfinite) :
HasColimit (Discrete.functor (F.obj ∘ Discrete.mk) : Discrete (Fin n) ⥤ LightProfinite) where
exists_colimit := ⟨⟨finiteCoproduct.cofan _, finiteCoproduct.isColimit _⟩⟩
instance : HasFiniteCoproducts LightProfinite where
out _ := { has_colimit := fun _ ↦ hasColimitOfIso Discrete.natIsoFunctor }
section Iso
noncomputable
def coproductIsoCoproduct : finiteCoproduct X ≅ ∐ X :=
Limits.IsColimit.coconePointUniqueUpToIso (finiteCoproduct.isColimit X) (Limits.colimit.isColimit _)
| Mathlib/Topology/Category/LightProfinite/Limits.lean | 202 | 204 | theorem Sigma.ι_comp_toFiniteCoproduct (a : α) :
(Limits.Sigma.ι X a) ≫ (coproductIsoCoproduct X).inv = finiteCoproduct.ι X a := by |
simp [coproductIsoCoproduct]
| [
" fst f g ≫ f = snd f g ≫ g",
" (fst f g ≫ f) ⟨val✝, h⟩ = (snd f g ≫ g) ⟨val✝, h⟩",
" (a z, b z) ∈ {xy | f xy.1 = g xy.2}",
" Continuous fun z => ⟨(a z, b z), ⋯⟩",
" Continuous fun x => (a x, b x)",
" (Continuous fun x => a x) ∧ Continuous fun x => b x",
" a = b",
" a z = b z",
" ↑(a z) = ↑(b z)",
... | [
" fst f g ≫ f = snd f g ≫ g",
" (fst f g ≫ f) ⟨val✝, h⟩ = (snd f g ≫ g) ⟨val✝, h⟩",
" (a z, b z) ∈ {xy | f xy.1 = g xy.2}",
" Continuous fun z => ⟨(a z, b z), ⋯⟩",
" Continuous fun x => (a x, b x)",
" (Continuous fun x => a x) ∧ Continuous fun x => b x",
" a = b",
" a z = b z",
" ↑(a z) = ↑(b z)",
... |
import Mathlib.RingTheory.FiniteType
import Mathlib.RingTheory.Localization.AtPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.RingTheory.RingHomProperties
import Mathlib.Data.Set.Subsingleton
#align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
open scoped Pointwise Classical
universe u
variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R)
variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S)
variable [Algebra R R'] [Algebra S S']
section Properties
section Ideal
open scoped nonZeroDivisors
| Mathlib/RingTheory/LocalProperties.lean | 236 | 255 | theorem Ideal.le_of_localization_maximal {I J : Ideal R}
(h : ∀ (P : Ideal R) (hP : P.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤
Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
I ≤ J := by |
intro x hx
suffices J.colon (Ideal.span {x}) = ⊤ by
simpa using Submodule.mem_colon.mp
(show (1 : R) ∈ J.colon (Ideal.span {x}) from this.symm ▸ Submodule.mem_top) x
(Ideal.mem_span_singleton_self x)
refine Not.imp_symm (J.colon (Ideal.span {x})).exists_le_maximal ?_
push_neg
intro P hP le
obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ :=
(IsLocalization.mem_map_algebraMap_iff P.primeCompl _).mp (h P hP (Ideal.mem_map_of_mem _ hx))
rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq
obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.primeCompl _ _).mp eq
refine hs ((hP.isPrime.mem_or_mem (le (Ideal.mem_colon_singleton.mpr ?_))).resolve_right hm)
simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq
simpa only [mul_assoc, eq] using J.mul_mem_left m ha
| [
" I ≤ J",
" x ∈ J",
" Submodule.colon J (span {x}) = ⊤",
" ¬∃ M, M.IsMaximal ∧ Submodule.colon J (span {x}) ≤ M",
" ∀ (M : Ideal R), M.IsMaximal → ¬Submodule.colon J (span {x}) ≤ M",
" False",
" s * m * x ∈ J"
] | [
" I ≤ J"
] |
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
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 128 | 134 | 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]
| [
" iteratedDerivWithin n f univ = iteratedDeriv n f",
" iteratedDerivWithin n f univ x = iteratedDeriv n f x",
" iteratedDerivWithin n f s = ⇑(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s",
" iteratedDerivWithin n f s x =\n (⇑(ContinuousMultilinearMap.piFieldEquiv... | [
" iteratedDerivWithin n f univ = iteratedDeriv n f",
" iteratedDerivWithin n f univ x = iteratedDeriv n f x",
" iteratedDerivWithin n f s = ⇑(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s",
" iteratedDerivWithin n f s x =\n (⇑(ContinuousMultilinearMap.piFieldEquiv... |
import Mathlib.Data.Set.Lattice
import Mathlib.Init.Set
import Mathlib.Control.Basic
import Mathlib.Lean.Expr.ExtraRecognizers
#align_import data.set.functor from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u
open Function
namespace Set
variable {α β : Type u} {s : Set α} {f : α → Set β} {g : Set (α → β)}
protected def monad : Monad.{u} Set where
pure a := {a}
bind s f := ⋃ i ∈ s, f i
seq s t := Set.seq s (t ())
map := Set.image
instance : CoeHead (Set s) (Set α) := ⟨fun t => (Subtype.val '' t)⟩
theorem coe_eq_image_val (t : Set s) :
@Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
change ⋃ (x ∈ t), {x.1} = _
ext
simp
variable {β : Set α} {γ : Set β} {a : α}
theorem mem_image_val_of_mem (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) :=
⟨_, ha', rfl⟩
| Mathlib/Data/Set/Functor.lean | 146 | 147 | theorem image_val_subset : (γ : Set α) ⊆ β := by |
rintro _ ⟨⟨_, ha⟩, _, rfl⟩; exact ha
| [
" Lean.Internal.coeM t = Subtype.val '' t",
" ⋃ x ∈ t, {↑x} = Subtype.val '' t",
" x✝ ∈ ⋃ x ∈ t, {↑x} ↔ x✝ ∈ Subtype.val '' t",
" Subtype.val '' γ ⊆ β",
" ↑⟨val✝, ha⟩ ∈ β"
] | [
" Lean.Internal.coeM t = Subtype.val '' t",
" ⋃ x ∈ t, {↑x} = Subtype.val '' t",
" x✝ ∈ ⋃ x ∈ t, {↑x} ↔ x✝ ∈ Subtype.val '' t",
" Subtype.val '' γ ⊆ β"
] |
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Analysis.Convex.Segment
import Mathlib.Tactic.GCongr
#align_import analysis.convex.star from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set
open Convex Pointwise
variable {𝕜 E F : Type*}
section OrderedSemiring
variable [OrderedSemiring 𝕜]
section AddCommMonoid
variable [AddCommMonoid E] [AddCommMonoid F]
section SMul
variable (𝕜) [SMul 𝕜 E] [SMul 𝕜 F] (x : E) (s : Set E)
def StarConvex : Prop :=
∀ ⦃y : E⦄, y ∈ s → ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • x + b • y ∈ s
#align star_convex StarConvex
variable {𝕜 x s} {t : Set E}
theorem starConvex_iff_segment_subset : StarConvex 𝕜 x s ↔ ∀ ⦃y⦄, y ∈ s → [x -[𝕜] y] ⊆ s := by
constructor
· rintro h y hy z ⟨a, b, ha, hb, hab, rfl⟩
exact h hy ha hb hab
· rintro h y hy a b ha hb hab
exact h hy ⟨a, b, ha, hb, hab, rfl⟩
#align star_convex_iff_segment_subset starConvex_iff_segment_subset
theorem StarConvex.segment_subset (h : StarConvex 𝕜 x s) {y : E} (hy : y ∈ s) : [x -[𝕜] y] ⊆ s :=
starConvex_iff_segment_subset.1 h hy
#align star_convex.segment_subset StarConvex.segment_subset
theorem StarConvex.openSegment_subset (h : StarConvex 𝕜 x s) {y : E} (hy : y ∈ s) :
openSegment 𝕜 x y ⊆ s :=
(openSegment_subset_segment 𝕜 x y).trans (h.segment_subset hy)
#align star_convex.open_segment_subset StarConvex.openSegment_subset
| Mathlib/Analysis/Convex/Star.lean | 93 | 99 | theorem starConvex_iff_pointwise_add_subset :
StarConvex 𝕜 x s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • {x} + b • s ⊆ s := by |
refine
⟨?_, fun h y hy a b ha hb hab =>
h ha hb hab (add_mem_add (smul_mem_smul_set <| mem_singleton _) ⟨_, hy, rfl⟩)⟩
rintro hA a b ha hb hab w ⟨au, ⟨u, rfl : u = x, rfl⟩, bv, ⟨v, hv, rfl⟩, rfl⟩
exact hA hv ha hb hab
| [
" StarConvex 𝕜 x s ↔ ∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s",
" StarConvex 𝕜 x s → ∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s",
" a • x + b • y ∈ s",
" (∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s) → StarConvex 𝕜 x s",
" StarConvex 𝕜 x s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • {x} + b • s ⊆ s",
" StarConvex 𝕜 x s → ∀ ⦃... | [
" StarConvex 𝕜 x s ↔ ∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s",
" StarConvex 𝕜 x s → ∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s",
" a • x + b • y ∈ s",
" (∀ ⦃y : E⦄, y ∈ s → [x-[𝕜]y] ⊆ s) → StarConvex 𝕜 x s",
" StarConvex 𝕜 x s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • {x} + b • s ⊆ s"
] |
import Mathlib.Logic.Function.Conjugate
#align_import logic.function.iterate from "leanprover-community/mathlib"@"792a2a264169d64986541c6f8f7e3bbb6acb6295"
universe u v
variable {α : Type u} {β : Type v}
def Nat.iterate {α : Sort u} (op : α → α) : ℕ → α → α
| 0, a => a
| succ k, a => iterate op k (op a)
#align nat.iterate Nat.iterate
@[inherit_doc Nat.iterate]
notation:max f "^["n"]" => Nat.iterate f n
namespace Function
open Function (Commute)
variable (f : α → α)
@[simp]
theorem iterate_zero : f^[0] = id :=
rfl
#align function.iterate_zero Function.iterate_zero
theorem iterate_zero_apply (x : α) : f^[0] x = x :=
rfl
#align function.iterate_zero_apply Function.iterate_zero_apply
@[simp]
theorem iterate_succ (n : ℕ) : f^[n.succ] = f^[n] ∘ f :=
rfl
#align function.iterate_succ Function.iterate_succ
theorem iterate_succ_apply (n : ℕ) (x : α) : f^[n.succ] x = f^[n] (f x) :=
rfl
#align function.iterate_succ_apply Function.iterate_succ_apply
@[simp]
theorem iterate_id (n : ℕ) : (id : α → α)^[n] = id :=
Nat.recOn n rfl fun n ihn ↦ by rw [iterate_succ, ihn, id_comp]
#align function.iterate_id Function.iterate_id
theorem iterate_add (m : ℕ) : ∀ n : ℕ, f^[m + n] = f^[m] ∘ f^[n]
| 0 => rfl
| Nat.succ n => by rw [Nat.add_succ, iterate_succ, iterate_succ, iterate_add m n]; rfl
#align function.iterate_add Function.iterate_add
theorem iterate_add_apply (m n : ℕ) (x : α) : f^[m + n] x = f^[m] (f^[n] x) := by
rw [iterate_add f m n]
rfl
#align function.iterate_add_apply Function.iterate_add_apply
-- can be proved by simp but this is shorter and more natural
@[simp high]
theorem iterate_one : f^[1] = f :=
funext fun _ ↦ rfl
#align function.iterate_one Function.iterate_one
theorem iterate_mul (m : ℕ) : ∀ n, f^[m * n] = f^[m]^[n]
| 0 => by simp only [Nat.mul_zero, iterate_zero]
| n + 1 => by simp only [Nat.mul_succ, Nat.mul_one, iterate_one, iterate_add, iterate_mul m n]
#align function.iterate_mul Function.iterate_mul
variable {f}
theorem iterate_fixed {x} (h : f x = x) (n : ℕ) : f^[n] x = x :=
Nat.recOn n rfl fun n ihn ↦ by rw [iterate_succ_apply, h, ihn]
#align function.iterate_fixed Function.iterate_fixed
theorem Injective.iterate (Hinj : Injective f) (n : ℕ) : Injective f^[n] :=
Nat.recOn n injective_id fun _ ihn ↦ ihn.comp Hinj
#align function.injective.iterate Function.Injective.iterate
theorem Surjective.iterate (Hsurj : Surjective f) (n : ℕ) : Surjective f^[n] :=
Nat.recOn n surjective_id fun _ ihn ↦ ihn.comp Hsurj
#align function.surjective.iterate Function.Surjective.iterate
theorem Bijective.iterate (Hbij : Bijective f) (n : ℕ) : Bijective f^[n] :=
⟨Hbij.1.iterate n, Hbij.2.iterate n⟩
#align function.bijective.iterate Function.Bijective.iterate
namespace Semiconj
theorem iterate_right {f : α → β} {ga : α → α} {gb : β → β} (h : Semiconj f ga gb) (n : ℕ) :
Semiconj f ga^[n] gb^[n] :=
Nat.recOn n id_right fun _ ihn ↦ ihn.comp_right h
#align function.semiconj.iterate_right Function.Semiconj.iterate_right
| Mathlib/Logic/Function/Iterate.lean | 121 | 129 | theorem iterate_left {g : ℕ → α → α} (H : ∀ n, Semiconj f (g n) (g <| n + 1)) (n k : ℕ) :
Semiconj f^[n] (g k) (g <| n + k) := by |
induction n generalizing k with
| zero =>
rw [Nat.zero_add]
exact id_left
| succ n ihn =>
rw [Nat.add_right_comm, Nat.add_assoc]
exact (H k).trans (ihn (k + 1))
| [
" id^[n.succ] = id",
" f^[m + n.succ] = f^[m] ∘ f^[n.succ]",
" (f^[m] ∘ f^[n]) ∘ f = f^[m] ∘ f^[n] ∘ f",
" f^[m + n] x = f^[m] (f^[n] x)",
" (f^[m] ∘ f^[n]) x = f^[m] (f^[n] x)",
" f^[m * 0] = f^[m]^[0]",
" f^[m * (n + 1)] = f^[m]^[n + 1]",
" f^[n.succ] x = x",
" Semiconj f^[n] (g k) (g (n + k))",
... | [
" id^[n.succ] = id",
" f^[m + n.succ] = f^[m] ∘ f^[n.succ]",
" (f^[m] ∘ f^[n]) ∘ f = f^[m] ∘ f^[n] ∘ f",
" f^[m + n] x = f^[m] (f^[n] x)",
" (f^[m] ∘ f^[n]) x = f^[m] (f^[n] x)",
" f^[m * 0] = f^[m]^[0]",
" f^[m * (n + 1)] = f^[m]^[n + 1]",
" f^[n.succ] x = x",
" Semiconj f^[n] (g k) (g (n + k))"
] |
import Mathlib.MeasureTheory.Measure.Typeclasses
open scoped ENNReal
namespace MeasureTheory
variable {α : Type*}
noncomputable
def Measure.trim {m m0 : MeasurableSpace α} (μ : @Measure α m0) (hm : m ≤ m0) : @Measure α m :=
@OuterMeasure.toMeasure α m μ.toOuterMeasure (hm.trans (le_toOuterMeasure_caratheodory μ))
#align measure_theory.measure.trim MeasureTheory.Measure.trim
@[simp]
theorem trim_eq_self [MeasurableSpace α] {μ : Measure α} : μ.trim le_rfl = μ := by
simp [Measure.trim]
#align measure_theory.trim_eq_self MeasureTheory.trim_eq_self
variable {m m0 : MeasurableSpace α} {μ : Measure α} {s : Set α}
theorem toOuterMeasure_trim_eq_trim_toOuterMeasure (μ : Measure α) (hm : m ≤ m0) :
@Measure.toOuterMeasure _ m (μ.trim hm) = @OuterMeasure.trim _ m μ.toOuterMeasure := by
rw [Measure.trim, toMeasure_toOuterMeasure (ms := m)]
#align measure_theory.to_outer_measure_trim_eq_trim_to_outer_measure MeasureTheory.toOuterMeasure_trim_eq_trim_toOuterMeasure
@[simp]
theorem zero_trim (hm : m ≤ m0) : (0 : Measure α).trim hm = (0 : @Measure α m) := by
simp [Measure.trim, @OuterMeasure.toMeasure_zero _ m]
#align measure_theory.zero_trim MeasureTheory.zero_trim
theorem trim_measurableSet_eq (hm : m ≤ m0) (hs : @MeasurableSet α m s) : μ.trim hm s = μ s := by
rw [Measure.trim, toMeasure_apply (ms := m) _ _ hs, Measure.coe_toOuterMeasure]
#align measure_theory.trim_measurable_set_eq MeasureTheory.trim_measurableSet_eq
theorem le_trim (hm : m ≤ m0) : μ s ≤ μ.trim hm s := by
simp_rw [Measure.trim]
exact @le_toMeasure_apply _ m _ _ _
#align measure_theory.le_trim MeasureTheory.le_trim
theorem measure_eq_zero_of_trim_eq_zero (hm : m ≤ m0) (h : μ.trim hm s = 0) : μ s = 0 :=
le_antisymm ((le_trim hm).trans (le_of_eq h)) (zero_le _)
#align measure_theory.measure_eq_zero_of_trim_eq_zero MeasureTheory.measure_eq_zero_of_trim_eq_zero
theorem measure_trim_toMeasurable_eq_zero {hm : m ≤ m0} (hs : μ.trim hm s = 0) :
μ (@toMeasurable α m (μ.trim hm) s) = 0 :=
measure_eq_zero_of_trim_eq_zero hm (by rwa [@measure_toMeasurable _ m])
#align measure_theory.measure_trim_to_measurable_eq_zero MeasureTheory.measure_trim_toMeasurable_eq_zero
theorem ae_of_ae_trim (hm : m ≤ m0) {μ : Measure α} {P : α → Prop} (h : ∀ᵐ x ∂μ.trim hm, P x) :
∀ᵐ x ∂μ, P x :=
measure_eq_zero_of_trim_eq_zero hm h
#align measure_theory.ae_of_ae_trim MeasureTheory.ae_of_ae_trim
theorem ae_eq_of_ae_eq_trim {E} {hm : m ≤ m0} {f₁ f₂ : α → E}
(h12 : f₁ =ᵐ[μ.trim hm] f₂) : f₁ =ᵐ[μ] f₂ :=
measure_eq_zero_of_trim_eq_zero hm h12
#align measure_theory.ae_eq_of_ae_eq_trim MeasureTheory.ae_eq_of_ae_eq_trim
theorem ae_le_of_ae_le_trim {E} [LE E] {hm : m ≤ m0} {f₁ f₂ : α → E}
(h12 : f₁ ≤ᵐ[μ.trim hm] f₂) : f₁ ≤ᵐ[μ] f₂ :=
measure_eq_zero_of_trim_eq_zero hm h12
#align measure_theory.ae_le_of_ae_le_trim MeasureTheory.ae_le_of_ae_le_trim
theorem trim_trim {m₁ m₂ : MeasurableSpace α} {hm₁₂ : m₁ ≤ m₂} {hm₂ : m₂ ≤ m0} :
(μ.trim hm₂).trim hm₁₂ = μ.trim (hm₁₂.trans hm₂) := by
refine @Measure.ext _ m₁ _ _ (fun t ht => ?_)
rw [trim_measurableSet_eq hm₁₂ ht, trim_measurableSet_eq (hm₁₂.trans hm₂) ht,
trim_measurableSet_eq hm₂ (hm₁₂ t ht)]
#align measure_theory.trim_trim MeasureTheory.trim_trim
theorem restrict_trim (hm : m ≤ m0) (μ : Measure α) (hs : @MeasurableSet α m s) :
@Measure.restrict α m (μ.trim hm) s = (μ.restrict s).trim hm := by
refine @Measure.ext _ m _ _ (fun t ht => ?_)
rw [@Measure.restrict_apply α m _ _ _ ht, trim_measurableSet_eq hm ht,
Measure.restrict_apply (hm t ht),
trim_measurableSet_eq hm (@MeasurableSet.inter α m t s ht hs)]
#align measure_theory.restrict_trim MeasureTheory.restrict_trim
instance isFiniteMeasure_trim (hm : m ≤ m0) [IsFiniteMeasure μ] : IsFiniteMeasure (μ.trim hm) where
measure_univ_lt_top := by
rw [trim_measurableSet_eq hm (@MeasurableSet.univ _ m)]
exact measure_lt_top _ _
#align measure_theory.is_finite_measure_trim MeasureTheory.isFiniteMeasure_trim
| Mathlib/MeasureTheory/Measure/Trim.lean | 107 | 121 | theorem sigmaFiniteTrim_mono {m m₂ m0 : MeasurableSpace α} {μ : Measure α} (hm : m ≤ m0)
(hm₂ : m₂ ≤ m) [SigmaFinite (μ.trim (hm₂.trans hm))] : SigmaFinite (μ.trim hm) := by |
refine ⟨⟨?_⟩⟩
refine
{ set := spanningSets (μ.trim (hm₂.trans hm))
set_mem := fun _ => Set.mem_univ _
finite := fun i => ?_
spanning := iUnion_spanningSets _ }
calc
(μ.trim hm) (spanningSets (μ.trim (hm₂.trans hm)) i) =
((μ.trim hm).trim hm₂) (spanningSets (μ.trim (hm₂.trans hm)) i) := by
rw [@trim_measurableSet_eq α m₂ m (μ.trim hm) _ hm₂ (measurable_spanningSets _ _)]
_ = (μ.trim (hm₂.trans hm)) (spanningSets (μ.trim (hm₂.trans hm)) i) := by
rw [@trim_trim _ _ μ _ _ hm₂ hm]
_ < ∞ := measure_spanningSets_lt_top _ _
| [
" μ.trim ⋯ = μ",
" (μ.trim hm).toOuterMeasure = μ.trim",
" Measure.trim 0 hm = 0",
" (μ.trim hm) s = μ s",
" μ s ≤ (μ.trim hm) s",
" μ s ≤ (μ.toMeasure ⋯) s",
" (μ.trim hm) (toMeasurable (μ.trim hm) s) = 0",
" (μ.trim hm₂).trim hm₁₂ = μ.trim ⋯",
" ((μ.trim hm₂).trim hm₁₂) t = (μ.trim ⋯) t",
" (μ.t... | [
" μ.trim ⋯ = μ",
" (μ.trim hm).toOuterMeasure = μ.trim",
" Measure.trim 0 hm = 0",
" (μ.trim hm) s = μ s",
" μ s ≤ (μ.trim hm) s",
" μ s ≤ (μ.toMeasure ⋯) s",
" (μ.trim hm) (toMeasurable (μ.trim hm) s) = 0",
" (μ.trim hm₂).trim hm₁₂ = μ.trim ⋯",
" ((μ.trim hm₂).trim hm₁₂) t = (μ.trim ⋯) t",
" (μ.t... |
import Mathlib.Algebra.Order.Field.Pi
import Mathlib.Algebra.Order.UpperLower
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.Normed.Order.Basic
import Mathlib.Data.Real.Sqrt
import Mathlib.Topology.Algebra.Order.UpperLower
import Mathlib.Topology.MetricSpace.Sequences
#align_import analysis.normed.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
open Bornology Function Metric Set
open scoped Pointwise
variable {α ι : Type*}
section Finite
variable [Finite ι] {s : Set (ι → ℝ)} {x y : ι → ℝ}
theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ∈ closure s)
(h : ∀ i, x i < y i) : y ∈ interior s := by
cases nonempty_fintype ι
obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h
obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε
rw [dist_pi_lt_iff hε] at hxz
have hyz : ∀ i, z i < y i := by
refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_)
rw [← Real.norm_eq_abs, ← dist_eq_norm']
exact (hxz _).le
obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz
refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩
rintro w hw
refine hs (fun i => ?_) hz
simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw
exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le
#align is_upper_set.mem_interior_of_forall_lt IsUpperSet.mem_interior_of_forall_lt
| Mathlib/Analysis/Normed/Order/UpperLower.lean | 112 | 128 | theorem IsLowerSet.mem_interior_of_forall_lt (hs : IsLowerSet s) (hx : x ∈ closure s)
(h : ∀ i, y i < x i) : y ∈ interior s := by |
cases nonempty_fintype ι
obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h
obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε
rw [dist_pi_lt_iff hε] at hxz
have hyz : ∀ i, y i < z i := by
refine fun i =>
(lt_sub_iff_add_lt.2 <| hxy _).trans_le (sub_le_comm.1 <| (le_abs_self _).trans ?_)
rw [← Real.norm_eq_abs, ← dist_eq_norm]
exact (hxz _).le
obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz
refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩
rintro w hw
refine hs (fun i => ?_) hz
simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw
exact ((hw _ <| mem_univ _).2.trans <| hyz _).le
| [
" y ∈ interior s",
" ∀ (i : ι), z i < y i",
" |z i - x i| ≤ ε",
" dist (x i) (z i) ≤ ε",
" ball y δ ⊆ s",
" w ∈ s",
" z i ≤ w i",
" ∀ (i : ι), y i < z i",
" |x i - z i| ≤ ε",
" w i ≤ z i"
] | [
" y ∈ interior s",
" ∀ (i : ι), z i < y i",
" |z i - x i| ≤ ε",
" dist (x i) (z i) ≤ ε",
" ball y δ ⊆ s",
" w ∈ s",
" z i ≤ w i"
] |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
section SqrtMulLog
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
one_div, one_div, ← div_eq_inv_mul]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 122 | 129 | theorem deriv_sqrt_mul_log (x : ℝ) :
deriv (fun x => √x * log x) x = (2 + log x) / (2 * √x) := by |
cases' lt_or_le 0 x with hx hx
· exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
· rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
refine HasDerivWithinAt.deriv_eq_zero ?_ (uniqueDiffOn_Iic 0 x hx)
refine (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => ?_) hx
rw [sqrt_eq_zero_of_nonpos hx, zero_mul]
| [
" StrictConvexOn ℝ (Ici 0) fun x => x ^ n",
" StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))",
" StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)",
" 0 < ↑n",
" StrictConvexOn ℝ univ fun x => x ^ n",
" StrictMono (deriv fun a => a ^ n)",
" StrictMono fun x => ↑n * x ^ (n - 1)",
" 0 ≤ (if f x ≤... | [
" StrictConvexOn ℝ (Ici 0) fun x => x ^ n",
" StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))",
" StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)",
" 0 < ↑n",
" StrictConvexOn ℝ univ fun x => x ^ n",
" StrictMono (deriv fun a => a ^ n)",
" StrictMono fun x => ↑n * x ^ (n - 1)",
" 0 ≤ (if f x ≤... |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
#align order_iso.image_Iio OrderIso.image_Iio
@[simp]
theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) :=
e.dual.image_Iio a
#align order_iso.image_Ioi OrderIso.image_Ioi
@[simp]
theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm]
#align order_iso.image_Ioo OrderIso.image_Ioo
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 93 | 94 | theorem image_Ioc (e : α ≃o β) (a b : α) : e '' Ioc a b = Ioc (e a) (e b) := by |
rw [e.image_eq_preimage, e.symm.preimage_Ioc, e.symm_symm]
| [
" ⇑e ⁻¹' Iic b = Iic (e.symm b)",
" x ∈ ⇑e ⁻¹' Iic b ↔ x ∈ Iic (e.symm b)",
" ⇑e ⁻¹' Ici b = Ici (e.symm b)",
" x ∈ ⇑e ⁻¹' Ici b ↔ x ∈ Ici (e.symm b)",
" ⇑e ⁻¹' Iio b = Iio (e.symm b)",
" x ∈ ⇑e ⁻¹' Iio b ↔ x ∈ Iio (e.symm b)",
" ⇑e ⁻¹' Ioi b = Ioi (e.symm b)",
" x ∈ ⇑e ⁻¹' Ioi b ↔ x ∈ Ioi (e.symm b)"... | [
" ⇑e ⁻¹' Iic b = Iic (e.symm b)",
" x ∈ ⇑e ⁻¹' Iic b ↔ x ∈ Iic (e.symm b)",
" ⇑e ⁻¹' Ici b = Ici (e.symm b)",
" x ∈ ⇑e ⁻¹' Ici b ↔ x ∈ Ici (e.symm b)",
" ⇑e ⁻¹' Iio b = Iio (e.symm b)",
" x ∈ ⇑e ⁻¹' Iio b ↔ x ∈ Iio (e.symm b)",
" ⇑e ⁻¹' Ioi b = Ioi (e.symm b)",
" x ∈ ⇑e ⁻¹' Ioi b ↔ x ∈ Ioi (e.symm b)"... |
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P,
VSub G P where
[nonempty : Nonempty P]
vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor
-- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet
attribute [instance 100] AddTorsor.nonempty
-- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet
--attribute [nolint dangerous_instance] AddTorsor.toVSub
-- Porting note(#12096): linter not ported yet
--@[nolint instance_priority]
instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where
vsub := Sub.sub
vsub_vadd' := sub_add_cancel
vadd_vsub' := add_sub_cancel_right
#align add_group_is_add_torsor addGroupIsAddTorsor
@[simp]
theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ :=
rfl
#align vsub_eq_sub vsub_eq_sub
section General
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
@[simp]
theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ :=
AddTorsor.vsub_vadd' p₁ p₂
#align vsub_vadd vsub_vadd
@[simp]
theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g :=
AddTorsor.vadd_vsub' g p
#align vadd_vsub vadd_vsub
theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
rw [← vadd_vsub g₁ p, h, vadd_vsub]
#align vadd_right_cancel vadd_right_cancel
@[simp]
theorem vadd_right_cancel_iff {g₁ g₂ : G} (p : P) : g₁ +ᵥ p = g₂ +ᵥ p ↔ g₁ = g₂ :=
⟨vadd_right_cancel p, fun h => h ▸ rfl⟩
#align vadd_right_cancel_iff vadd_right_cancel_iff
theorem vadd_right_injective (p : P) : Function.Injective ((· +ᵥ p) : G → P) := fun _ _ =>
vadd_right_cancel p
#align vadd_right_injective vadd_right_injective
theorem vadd_vsub_assoc (g : G) (p₁ p₂ : P) : g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂) := by
apply vadd_right_cancel p₂
rw [vsub_vadd, add_vadd, vsub_vadd]
#align vadd_vsub_assoc vadd_vsub_assoc
@[simp]
theorem vsub_self (p : P) : p -ᵥ p = (0 : G) := by
rw [← zero_add (p -ᵥ p), ← vadd_vsub_assoc, vadd_vsub]
#align vsub_self vsub_self
theorem eq_of_vsub_eq_zero {p₁ p₂ : P} (h : p₁ -ᵥ p₂ = (0 : G)) : p₁ = p₂ := by
rw [← vsub_vadd p₁ p₂, h, zero_vadd]
#align eq_of_vsub_eq_zero eq_of_vsub_eq_zero
@[simp]
theorem vsub_eq_zero_iff_eq {p₁ p₂ : P} : p₁ -ᵥ p₂ = (0 : G) ↔ p₁ = p₂ :=
Iff.intro eq_of_vsub_eq_zero fun h => h ▸ vsub_self _
#align vsub_eq_zero_iff_eq vsub_eq_zero_iff_eq
theorem vsub_ne_zero {p q : P} : p -ᵥ q ≠ (0 : G) ↔ p ≠ q :=
not_congr vsub_eq_zero_iff_eq
#align vsub_ne_zero vsub_ne_zero
@[simp]
theorem vsub_add_vsub_cancel (p₁ p₂ p₃ : P) : p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃ := by
apply vadd_right_cancel p₃
rw [add_vadd, vsub_vadd, vsub_vadd, vsub_vadd]
#align vsub_add_vsub_cancel vsub_add_vsub_cancel
@[simp]
theorem neg_vsub_eq_vsub_rev (p₁ p₂ : P) : -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁ := by
refine neg_eq_of_add_eq_zero_right (vadd_right_cancel p₁ ?_)
rw [vsub_add_vsub_cancel, vsub_self]
#align neg_vsub_eq_vsub_rev neg_vsub_eq_vsub_rev
| Mathlib/Algebra/AddTorsor.lean | 159 | 160 | theorem vadd_vsub_eq_sub_vsub (g : G) (p q : P) : g +ᵥ p -ᵥ q = g - (q -ᵥ p) := by |
rw [vadd_vsub_assoc, sub_eq_add_neg, neg_vsub_eq_vsub_rev]
| [
" g₁ = g₂",
" g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂)",
" g +ᵥ p₁ -ᵥ p₂ +ᵥ p₂ = g + (p₁ -ᵥ p₂) +ᵥ p₂",
" p -ᵥ p = 0",
" p₁ = p₂",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) +ᵥ p₃ = p₁ -ᵥ p₃ +ᵥ p₃",
" -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₁) +ᵥ p₁ = 0 +ᵥ p₁",
" g +ᵥ p -ᵥ q = g - (q... | [
" g₁ = g₂",
" g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂)",
" g +ᵥ p₁ -ᵥ p₂ +ᵥ p₂ = g + (p₁ -ᵥ p₂) +ᵥ p₂",
" p -ᵥ p = 0",
" p₁ = p₂",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) +ᵥ p₃ = p₁ -ᵥ p₃ +ᵥ p₃",
" -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁",
" p₁ -ᵥ p₂ + (p₂ -ᵥ p₁) +ᵥ p₁ = 0 +ᵥ p₁",
" g +ᵥ p -ᵥ q = g - (q... |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.fin_range from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
universe u
namespace List
variable {α : Type u}
@[simp]
theorem map_coe_finRange (n : ℕ) : ((finRange n) : List (Fin n)).map (Fin.val) = List.range n := by
simp_rw [finRange, map_pmap, pmap_eq_map]
exact List.map_id _
#align list.map_coe_fin_range List.map_coe_finRange
theorem finRange_succ_eq_map (n : ℕ) : finRange n.succ = 0 :: (finRange n).map Fin.succ := by
apply map_injective_iff.mpr Fin.val_injective
rw [map_cons, map_coe_finRange, range_succ_eq_map, Fin.val_zero, ← map_coe_finRange, map_map,
map_map]
simp only [Function.comp, Fin.val_succ]
#align list.fin_range_succ_eq_map List.finRange_succ_eq_map
| Mathlib/Data/List/FinRange.lean | 37 | 40 | theorem finRange_succ (n : ℕ) :
finRange n.succ = (finRange n |>.map Fin.castSucc |>.concat (.last _)) := by |
apply map_injective_iff.mpr Fin.val_injective
simp [range_succ, Function.comp_def]
| [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n",
" finRange n.succ = 0 :: map Fin.succ (finRange n)",
" map Fin.val (finRange n.succ) = map Fin.val (0 :: map Fin.succ (finRange n))",
" 0 :: map (Nat.succ ∘ Fin.val) (finRange n) = 0 :: map (Fin.val ∘ Fin.succ) (finRange n)",
... | [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n",
" finRange n.succ = 0 :: map Fin.succ (finRange n)",
" map Fin.val (finRange n.succ) = map Fin.val (0 :: map Fin.succ (finRange n))",
" 0 :: map (Nat.succ ∘ Fin.val) (finRange n) = 0 :: map (Fin.val ∘ Fin.succ) (finRange n)",
... |
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
| Mathlib/Algebra/Polynomial/Monic.lean | 108 | 110 | 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
| [
" Subsingleton R → (∀ (f g : R[X]), f = g) ∧ ∀ (a b : R), a = b",
" (∀ (f g : R[X]), f = g) ∧ ∀ (a b : R), a = b",
" p = X ^ p.natDegree + ∑ i ∈ range p.natDegree, C (p.coeff i) * X ^ i",
"R : Type u S : Type v a b : R m n : ℕ ι : Type y inst✝ : Semiring R p q r : R[X] hp : p.Monic | p",
" C (p.coeff p.natD... | [
" Subsingleton R → (∀ (f g : R[X]), f = g) ∧ ∀ (a b : R), a = b",
" (∀ (f g : R[X]), f = g) ∧ ∀ (a b : R), a = b",
" p = X ^ p.natDegree + ∑ i ∈ range p.natDegree, C (p.coeff i) * X ^ i",
"R : Type u S : Type v a b : R m n : ℕ ι : Type y inst✝ : Semiring R p q r : R[X] hp : p.Monic | p",
" C (p.coeff p.natD... |
import Mathlib.Analysis.Calculus.TangentCone
import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics
#align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
@[mk_iff hasFDerivAtFilter_iff_isLittleO]
structure HasFDerivAtFilter (f : E → F) (f' : E →L[𝕜] F) (x : E) (L : Filter E) : Prop where
of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x
#align has_fderiv_at_filter HasFDerivAtFilter
@[fun_prop]
def HasFDerivWithinAt (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (x : E) :=
HasFDerivAtFilter f f' x (𝓝[s] x)
#align has_fderiv_within_at HasFDerivWithinAt
@[fun_prop]
def HasFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) :=
HasFDerivAtFilter f f' x (𝓝 x)
#align has_fderiv_at HasFDerivAt
@[fun_prop]
def HasStrictFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) :=
(fun p : E × E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[𝓝 (x, x)] fun p : E × E => p.1 - p.2
#align has_strict_fderiv_at HasStrictFDerivAt
variable (𝕜)
@[fun_prop]
def DifferentiableWithinAt (f : E → F) (s : Set E) (x : E) :=
∃ f' : E →L[𝕜] F, HasFDerivWithinAt f f' s x
#align differentiable_within_at DifferentiableWithinAt
@[fun_prop]
def DifferentiableAt (f : E → F) (x : E) :=
∃ f' : E →L[𝕜] F, HasFDerivAt f f' x
#align differentiable_at DifferentiableAt
irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F :=
if 𝓝[s \ {x}] x = ⊥ then 0 else
if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0
#align fderiv_within fderivWithin
irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F :=
if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0
#align fderiv fderiv
@[fun_prop]
def DifferentiableOn (f : E → F) (s : Set E) :=
∀ x ∈ s, DifferentiableWithinAt 𝕜 f s x
#align differentiable_on DifferentiableOn
@[fun_prop]
def Differentiable (f : E → F) :=
∀ x, DifferentiableAt 𝕜 f x
#align differentiable Differentiable
variable {𝕜}
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by
rw [fderivWithin, if_pos h]
theorem fderivWithin_zero_of_nmem_closure (h : x ∉ closure s) : fderivWithin 𝕜 f s x = 0 := by
apply fderivWithin_zero_of_isolated
simp only [mem_closure_iff_nhdsWithin_neBot, neBot_iff, Ne, Classical.not_not] at h
rw [eq_bot_iff, ← h]
exact nhdsWithin_mono _ diff_subset
theorem fderivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt 𝕜 f s x) :
fderivWithin 𝕜 f s x = 0 := by
have : ¬∃ f', HasFDerivWithinAt f f' s x := h
simp [fderivWithin, this]
#align fderiv_within_zero_of_not_differentiable_within_at fderivWithin_zero_of_not_differentiableWithinAt
theorem fderiv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : fderiv 𝕜 f x = 0 := by
have : ¬∃ f', HasFDerivAt f f' x := h
simp [fderiv, this]
#align fderiv_zero_of_not_differentiable_at fderiv_zero_of_not_differentiableAt
section FDerivProperties
| Mathlib/Analysis/Calculus/FDeriv/Basic.lean | 305 | 313 | theorem hasFDerivAtFilter_iff_tendsto :
HasFDerivAtFilter f f' x L ↔
Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) L (𝓝 0) := by |
have h : ∀ x', ‖x' - x‖ = 0 → ‖f x' - f x - f' (x' - x)‖ = 0 := fun x' hx' => by
rw [sub_eq_zero.1 (norm_eq_zero.1 hx')]
simp
rw [hasFDerivAtFilter_iff_isLittleO, ← isLittleO_norm_left, ← isLittleO_norm_right,
isLittleO_iff_tendsto h]
exact tendsto_congr fun _ => div_eq_inv_mul _ _
| [
" fderivWithin 𝕜 f s x = 0",
" 𝓝[s \\ {x}] x = ⊥",
" 𝓝[s \\ {x}] x ≤ 𝓝[s] x",
" fderiv 𝕜 f x = 0",
" HasFDerivAtFilter f f' x L ↔ Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) L (𝓝 0)",
" ‖f x' - f x - f' (x' - x)‖ = 0",
" ‖f x - f x - f' (x - x)‖ = 0",
" Tendsto (fun x_1 => ‖f x_1... | [
" fderivWithin 𝕜 f s x = 0",
" 𝓝[s \\ {x}] x = ⊥",
" 𝓝[s \\ {x}] x ≤ 𝓝[s] x",
" fderiv 𝕜 f x = 0",
" HasFDerivAtFilter f f' x L ↔ Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) L (𝓝 0)"
] |
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 36 | 44 | theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by |
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
| [
" IntegrableAtFilter f l μ",
" ∀ᵐ (a : α) ∂μ.restrict s, ‖f a‖ ≤ ‖C * ‖g a‖‖",
" ‖f x‖ ≤ ‖C * ‖g x‖‖"
] | [
" IntegrableAtFilter f l μ"
] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Monic
#align_import data.polynomial.integral_normalization from "leanprover-community/mathlib"@"6f401acf4faec3ab9ab13a42789c4f68064a61cd"
open Polynomial
namespace Polynomial
universe u v y
variable {R : Type u} {S : Type v} {a b : R} {m n : ℕ} {ι : Type y}
section IntegralNormalization
section Semiring
variable [Semiring R]
noncomputable def integralNormalization (f : R[X]) : R[X] :=
∑ i ∈ f.support,
monomial i (if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i))
#align polynomial.integral_normalization Polynomial.integralNormalization
@[simp]
theorem integralNormalization_zero : integralNormalization (0 : R[X]) = 0 := by
simp [integralNormalization]
#align polynomial.integral_normalization_zero Polynomial.integralNormalization_zero
theorem integralNormalization_coeff {f : R[X]} {i : ℕ} :
(integralNormalization f).coeff i =
if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i) := by
have : f.coeff i = 0 → f.degree ≠ i := fun hc hd => coeff_ne_zero_of_eq_degree hd hc
simp (config := { contextual := true }) [integralNormalization, coeff_monomial, this,
mem_support_iff]
#align polynomial.integral_normalization_coeff Polynomial.integralNormalization_coeff
theorem integralNormalization_support {f : R[X]} :
(integralNormalization f).support ⊆ f.support := by
intro
simp (config := { contextual := true }) [integralNormalization, coeff_monomial, mem_support_iff]
#align polynomial.integral_normalization_support Polynomial.integralNormalization_support
| Mathlib/RingTheory/Polynomial/IntegralNormalization.lean | 62 | 63 | theorem integralNormalization_coeff_degree {f : R[X]} {i : ℕ} (hi : f.degree = i) :
(integralNormalization f).coeff i = 1 := by | rw [integralNormalization_coeff, if_pos hi]
| [
" integralNormalization 0 = 0",
" f.integralNormalization.coeff i = if f.degree = ↑i then 1 else f.coeff i * f.leadingCoeff ^ (f.natDegree - 1 - i)",
" f.integralNormalization.support ⊆ f.support",
" a✝ ∈ f.integralNormalization.support → a✝ ∈ f.support",
" f.integralNormalization.coeff i = 1"
] | [
" integralNormalization 0 = 0",
" f.integralNormalization.coeff i = if f.degree = ↑i then 1 else f.coeff i * f.leadingCoeff ^ (f.natDegree - 1 - i)",
" f.integralNormalization.support ⊆ f.support",
" a✝ ∈ f.integralNormalization.support → a✝ ∈ f.support",
" f.integralNormalization.coeff i = 1"
] |
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where
toFun a :=
{ DistribMulAction.toLinearEquiv ℝ ℂ a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by
ext1
simp
#align rotation_trans rotation_trans
theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by
intro h
have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1
have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I
rw [rotation_apply, RingHom.map_one, mul_one] at h1
rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI
exact one_ne_zero hI
#align rotation_ne_conj_lie rotation_ne_conjLIE
@[simps]
def rotationOf (e : ℂ ≃ₗᵢ[ℝ] ℂ) : circle :=
⟨e 1 / Complex.abs (e 1), by simp⟩
#align rotation_of rotationOf
@[simp]
theorem rotationOf_rotation (a : circle) : rotationOf (rotation a) = a :=
Subtype.ext <| by simp
#align rotation_of_rotation rotationOf_rotation
theorem rotation_injective : Function.Injective rotation :=
Function.LeftInverse.injective rotationOf_rotation
#align rotation_injective rotation_injective
| Mathlib/Analysis/Complex/Isometry.lean | 90 | 93 | theorem LinearIsometry.re_apply_eq_re_of_add_conj_eq (f : ℂ →ₗᵢ[ℝ] ℂ)
(h₃ : ∀ z, z + conj z = f z + conj (f z)) (z : ℂ) : (f z).re = z.re := by |
simpa [ext_iff, add_re, add_im, conj_re, conj_im, ← two_mul,
show (2 : ℝ) ≠ 0 by simp [two_ne_zero]] using (h₃ z).symm
| [
" Complex.abs (↑a * x) = Complex.abs x",
" (rotation a).trans (rotation b) = rotation (b * a)",
" ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝",
" rotation a ≠ conjLIE",
" False",
" e 1 / ↑(Complex.abs (e 1)) ∈ circle",
" ↑(rotationOf (rotation a)) = ↑a",
" (f z).re = z.re",
" 2 ≠ 0"... | [
" Complex.abs (↑a * x) = Complex.abs x",
" (rotation a).trans (rotation b) = rotation (b * a)",
" ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝",
" rotation a ≠ conjLIE",
" False",
" e 1 / ↑(Complex.abs (e 1)) ∈ circle",
" ↑(rotationOf (rotation a)) = ↑a",
" (f z).re = z.re"
] |
import Mathlib.Topology.Instances.ENNReal
#align_import order.filter.ennreal from "leanprover-community/mathlib"@"52932b3a083d4142e78a15dc928084a22fea9ba0"
open Filter ENNReal
namespace ENNReal
variable {α : Type*} {f : Filter α}
theorem eventually_le_limsup [CountableInterFilter f] (u : α → ℝ≥0∞) :
∀ᶠ y in f, u y ≤ f.limsup u :=
_root_.eventually_le_limsup
#align ennreal.eventually_le_limsup ENNReal.eventually_le_limsup
theorem limsup_eq_zero_iff [CountableInterFilter f] {u : α → ℝ≥0∞} :
f.limsup u = 0 ↔ u =ᶠ[f] 0 :=
limsup_eq_bot
#align ennreal.limsup_eq_zero_iff ENNReal.limsup_eq_zero_iff
theorem limsup_const_mul_of_ne_top {u : α → ℝ≥0∞} {a : ℝ≥0∞} (ha_top : a ≠ ⊤) :
(f.limsup fun x : α => a * u x) = a * f.limsup u := by
by_cases ha_zero : a = 0
· simp_rw [ha_zero, zero_mul, ← ENNReal.bot_eq_zero]
exact limsup_const_bot
let g := fun x : ℝ≥0∞ => a * x
have hg_bij : Function.Bijective g :=
Function.bijective_iff_has_inverse.mpr
⟨fun x => a⁻¹ * x,
⟨fun x => by simp [g, ← mul_assoc, ENNReal.inv_mul_cancel ha_zero ha_top], fun x => by
simp [g, ← mul_assoc, ENNReal.mul_inv_cancel ha_zero ha_top]⟩⟩
have hg_mono : StrictMono g :=
Monotone.strictMono_of_injective (fun _ _ _ => by rwa [mul_le_mul_left ha_zero ha_top]) hg_bij.1
let g_iso := StrictMono.orderIsoOfSurjective g hg_mono hg_bij.2
exact (OrderIso.limsup_apply g_iso).symm
#align ennreal.limsup_const_mul_of_ne_top ENNReal.limsup_const_mul_of_ne_top
| Mathlib/Order/Filter/ENNReal.lean | 50 | 68 | theorem limsup_const_mul [CountableInterFilter f] {u : α → ℝ≥0∞} {a : ℝ≥0∞} :
f.limsup (a * u ·) = a * f.limsup u := by |
by_cases ha_top : a ≠ ⊤
· exact limsup_const_mul_of_ne_top ha_top
push_neg at ha_top
by_cases hu : u =ᶠ[f] 0
· have hau : (a * u ·) =ᶠ[f] 0 := hu.mono fun x hx => by simp [hx]
simp only [limsup_congr hu, limsup_congr hau, Pi.zero_apply, ← ENNReal.bot_eq_zero,
limsup_const_bot]
simp
· have hu_mul : ∃ᶠ x : α in f, ⊤ ≤ ite (u x = 0) (0 : ℝ≥0∞) ⊤ := by
rw [EventuallyEq, not_eventually] at hu
refine hu.mono fun x hx => ?_
rw [Pi.zero_apply] at hx
simp [hx]
have h_top_le : (f.limsup fun x : α => ite (u x = 0) (0 : ℝ≥0∞) ⊤) = ⊤ :=
eq_top_iff.mpr (le_limsup_of_frequently_le hu_mul)
have hfu : f.limsup u ≠ 0 := mt limsup_eq_zero_iff.1 hu
simp only [ha_top, top_mul', h_top_le, hfu, ite_false]
| [
" limsup (fun x => a * u x) f = a * limsup u f",
" limsup (fun x => ⊥) f = ⊥",
" (fun x => a⁻¹ * x) (g x) = x",
" g ((fun x => a⁻¹ * x) x) = x",
" g x✝² ≤ g x✝¹",
" (fun x => a * u x) x = 0 x",
" ⊥ = a * ⊥",
" ∃ᶠ (x : α) in f, ⊤ ≤ if u x = 0 then 0 else ⊤",
" ⊤ ≤ if u x = 0 then 0 else ⊤"
] | [
" limsup (fun x => a * u x) f = a * limsup u f",
" limsup (fun x => ⊥) f = ⊥",
" (fun x => a⁻¹ * x) (g x) = x",
" g ((fun x => a⁻¹ * x) x) = x",
" g x✝² ≤ g x✝¹"
] |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module ℝ E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) • x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
| Mathlib/Analysis/Convex/GaugeRescale.lean | 41 | 44 | theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) :
gaugeRescale s t (c • x) = c • gaugeRescale s t x := by |
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
| [
" gaugeRescale s t (c • x) = c • gaugeRescale s t x",
" (c * gauge s x / (c * gauge t x) * c) • x = (c * (gauge s x / gauge t x)) • x"
] | [
" gaugeRescale s t (c • x) = c • gaugeRescale s t x"
] |
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]
| Mathlib/LinearAlgebra/Matrix/Determinant/Basic.lean | 73 | 82 | 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
| [
" M.det = ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, M (σ i) i",
" (diagonal d).det = ∏ i : n, d i",
" ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = ∏ i : n, d i",
" ∀ b ∈ univ, b ≠ 1 → ↑↑(sign b) * ∏ i : n, diagonal d (b i) i = 0",
" ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = 0",
" ∏ i : n, diagonal ... | [
" M.det = ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, M (σ i) i",
" (diagonal d).det = ∏ i : n, d i"
] |
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 Disjoint
def Disjoint (f g : Perm α) :=
∀ x, f x = x ∨ g x = x
#align equiv.perm.disjoint Equiv.Perm.Disjoint
variable {f g h : Perm α}
@[symm]
theorem Disjoint.symm : Disjoint f g → Disjoint g f := by simp only [Disjoint, or_comm, imp_self]
#align equiv.perm.disjoint.symm Equiv.Perm.Disjoint.symm
theorem Disjoint.symmetric : Symmetric (@Disjoint α) := fun _ _ => Disjoint.symm
#align equiv.perm.disjoint.symmetric Equiv.Perm.Disjoint.symmetric
instance : IsSymm (Perm α) Disjoint :=
⟨Disjoint.symmetric⟩
theorem disjoint_comm : Disjoint f g ↔ Disjoint g f :=
⟨Disjoint.symm, Disjoint.symm⟩
#align equiv.perm.disjoint_comm Equiv.Perm.disjoint_comm
theorem Disjoint.commute (h : Disjoint f g) : Commute f g :=
Equiv.ext fun x =>
(h x).elim
(fun hf =>
(h (g x)).elim (fun hg => by simp [mul_apply, hf, hg]) fun hg => by
simp [mul_apply, hf, g.injective hg])
fun hg =>
(h (f x)).elim (fun hf => by simp [mul_apply, f.injective hf, hg]) fun hf => by
simp [mul_apply, hf, hg]
#align equiv.perm.disjoint.commute Equiv.Perm.Disjoint.commute
@[simp]
theorem disjoint_one_left (f : Perm α) : Disjoint 1 f := fun _ => Or.inl rfl
#align equiv.perm.disjoint_one_left Equiv.Perm.disjoint_one_left
@[simp]
theorem disjoint_one_right (f : Perm α) : Disjoint f 1 := fun _ => Or.inr rfl
#align equiv.perm.disjoint_one_right Equiv.Perm.disjoint_one_right
theorem disjoint_iff_eq_or_eq : Disjoint f g ↔ ∀ x : α, f x = x ∨ g x = x :=
Iff.rfl
#align equiv.perm.disjoint_iff_eq_or_eq Equiv.Perm.disjoint_iff_eq_or_eq
@[simp]
theorem disjoint_refl_iff : Disjoint f f ↔ f = 1 := by
refine ⟨fun h => ?_, fun h => h.symm ▸ disjoint_one_left 1⟩
ext x
cases' h x with hx hx <;> simp [hx]
#align equiv.perm.disjoint_refl_iff Equiv.Perm.disjoint_refl_iff
theorem Disjoint.inv_left (h : Disjoint f g) : Disjoint f⁻¹ g := by
intro x
rw [inv_eq_iff_eq, eq_comm]
exact h x
#align equiv.perm.disjoint.inv_left Equiv.Perm.Disjoint.inv_left
theorem Disjoint.inv_right (h : Disjoint f g) : Disjoint f g⁻¹ :=
h.symm.inv_left.symm
#align equiv.perm.disjoint.inv_right Equiv.Perm.Disjoint.inv_right
@[simp]
theorem disjoint_inv_left_iff : Disjoint f⁻¹ g ↔ Disjoint f g := by
refine ⟨fun h => ?_, Disjoint.inv_left⟩
convert h.inv_left
#align equiv.perm.disjoint_inv_left_iff Equiv.Perm.disjoint_inv_left_iff
@[simp]
theorem disjoint_inv_right_iff : Disjoint f g⁻¹ ↔ Disjoint f g := by
rw [disjoint_comm, disjoint_inv_left_iff, disjoint_comm]
#align equiv.perm.disjoint_inv_right_iff Equiv.Perm.disjoint_inv_right_iff
theorem Disjoint.mul_left (H1 : Disjoint f h) (H2 : Disjoint g h) : Disjoint (f * g) h := fun x =>
by cases H1 x <;> cases H2 x <;> simp [*]
#align equiv.perm.disjoint.mul_left Equiv.Perm.Disjoint.mul_left
theorem Disjoint.mul_right (H1 : Disjoint f g) (H2 : Disjoint f h) : Disjoint f (g * h) := by
rw [disjoint_comm]
exact H1.symm.mul_left H2.symm
#align equiv.perm.disjoint.mul_right Equiv.Perm.Disjoint.mul_right
-- Porting note (#11215): TODO: make it `@[simp]`
theorem disjoint_conj (h : Perm α) : Disjoint (h * f * h⁻¹) (h * g * h⁻¹) ↔ Disjoint f g :=
(h⁻¹).forall_congr fun {_} ↦ by simp only [mul_apply, eq_inv_iff_eq]
theorem Disjoint.conj (H : Disjoint f g) (h : Perm α) : Disjoint (h * f * h⁻¹) (h * g * h⁻¹) :=
(disjoint_conj h).2 H
theorem disjoint_prod_right (l : List (Perm α)) (h : ∀ g ∈ l, Disjoint f g) :
Disjoint f l.prod := by
induction' l with g l ih
· exact disjoint_one_right _
· rw [List.prod_cons]
exact (h _ (List.mem_cons_self _ _)).mul_right (ih fun g hg => h g (List.mem_cons_of_mem _ hg))
#align equiv.perm.disjoint_prod_right Equiv.Perm.disjoint_prod_right
open scoped List in
theorem disjoint_prod_perm {l₁ l₂ : List (Perm α)} (hl : l₁.Pairwise Disjoint) (hp : l₁ ~ l₂) :
l₁.prod = l₂.prod :=
hp.prod_eq' <| hl.imp Disjoint.commute
#align equiv.perm.disjoint_prod_perm Equiv.Perm.disjoint_prod_perm
| Mathlib/GroupTheory/Perm/Support.lean | 144 | 152 | theorem nodup_of_pairwise_disjoint {l : List (Perm α)} (h1 : (1 : Perm α) ∉ l)
(h2 : l.Pairwise Disjoint) : l.Nodup := by |
refine List.Pairwise.imp_of_mem ?_ h2
intro τ σ h_mem _ h_disjoint _
subst τ
suffices (σ : Perm α) = 1 by
rw [this] at h_mem
exact h1 h_mem
exact ext fun a => or_self_iff.mp (h_disjoint a)
| [
" f.Disjoint g → g.Disjoint f",
" (f * g) x = (g * f) x",
" f.Disjoint f ↔ f = 1",
" f = 1",
" f x = 1 x",
" f⁻¹.Disjoint g",
" f⁻¹ x = x ∨ g x = x",
" f x = x ∨ g x = x",
" f⁻¹.Disjoint g ↔ f.Disjoint g",
" f.Disjoint g",
" f.Disjoint g⁻¹ ↔ f.Disjoint g",
" (f * g) x = x ∨ h x = x",
" f.Dis... | [
" f.Disjoint g → g.Disjoint f",
" (f * g) x = (g * f) x",
" f.Disjoint f ↔ f = 1",
" f = 1",
" f x = 1 x",
" f⁻¹.Disjoint g",
" f⁻¹ x = x ∨ g x = x",
" f x = x ∨ g x = x",
" f⁻¹.Disjoint g ↔ f.Disjoint g",
" f.Disjoint g",
" f.Disjoint g⁻¹ ↔ f.Disjoint g",
" (f * g) x = x ∨ h x = x",
" f.Dis... |
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 Preorder
variable [Preorder α] {a a₁ a₂ b b₁ b₂ c x : α}
def Ioo (a b : α) :=
{ x | a < x ∧ x < b }
#align set.Ioo Set.Ioo
def Ico (a b : α) :=
{ x | a ≤ x ∧ x < b }
#align set.Ico Set.Ico
def Iio (a : α) :=
{ x | x < a }
#align set.Iio Set.Iio
def Icc (a b : α) :=
{ x | a ≤ x ∧ x ≤ b }
#align set.Icc Set.Icc
def Iic (b : α) :=
{ x | x ≤ b }
#align set.Iic Set.Iic
def Ioc (a b : α) :=
{ x | a < x ∧ x ≤ b }
#align set.Ioc Set.Ioc
def Ici (a : α) :=
{ x | a ≤ x }
#align set.Ici Set.Ici
def Ioi (a : α) :=
{ x | a < x }
#align set.Ioi Set.Ioi
theorem Ioo_def (a b : α) : { x | a < x ∧ x < b } = Ioo a b :=
rfl
#align set.Ioo_def Set.Ioo_def
theorem Ico_def (a b : α) : { x | a ≤ x ∧ x < b } = Ico a b :=
rfl
#align set.Ico_def Set.Ico_def
theorem Iio_def (a : α) : { x | x < a } = Iio a :=
rfl
#align set.Iio_def Set.Iio_def
theorem Icc_def (a b : α) : { x | a ≤ x ∧ x ≤ b } = Icc a b :=
rfl
#align set.Icc_def Set.Icc_def
theorem Iic_def (b : α) : { x | x ≤ b } = Iic b :=
rfl
#align set.Iic_def Set.Iic_def
theorem Ioc_def (a b : α) : { x | a < x ∧ x ≤ b } = Ioc a b :=
rfl
#align set.Ioc_def Set.Ioc_def
theorem Ici_def (a : α) : { x | a ≤ x } = Ici a :=
rfl
#align set.Ici_def Set.Ici_def
theorem Ioi_def (a : α) : { x | a < x } = Ioi a :=
rfl
#align set.Ioi_def Set.Ioi_def
@[simp]
theorem mem_Ioo : x ∈ Ioo a b ↔ a < x ∧ x < b :=
Iff.rfl
#align set.mem_Ioo Set.mem_Ioo
@[simp]
theorem mem_Ico : x ∈ Ico a b ↔ a ≤ x ∧ x < b :=
Iff.rfl
#align set.mem_Ico Set.mem_Ico
@[simp]
theorem mem_Iio : x ∈ Iio b ↔ x < b :=
Iff.rfl
#align set.mem_Iio Set.mem_Iio
@[simp]
theorem mem_Icc : x ∈ Icc a b ↔ a ≤ x ∧ x ≤ b :=
Iff.rfl
#align set.mem_Icc Set.mem_Icc
@[simp]
theorem mem_Iic : x ∈ Iic b ↔ x ≤ b :=
Iff.rfl
#align set.mem_Iic Set.mem_Iic
@[simp]
theorem mem_Ioc : x ∈ Ioc a b ↔ a < x ∧ x ≤ b :=
Iff.rfl
#align set.mem_Ioc Set.mem_Ioc
@[simp]
theorem mem_Ici : x ∈ Ici a ↔ a ≤ x :=
Iff.rfl
#align set.mem_Ici Set.mem_Ici
@[simp]
theorem mem_Ioi : x ∈ Ioi a ↔ a < x :=
Iff.rfl
#align set.mem_Ioi Set.mem_Ioi
instance decidableMemIoo [Decidable (a < x ∧ x < b)] : Decidable (x ∈ Ioo a b) := by assumption
#align set.decidable_mem_Ioo Set.decidableMemIoo
instance decidableMemIco [Decidable (a ≤ x ∧ x < b)] : Decidable (x ∈ Ico a b) := by assumption
#align set.decidable_mem_Ico Set.decidableMemIco
instance decidableMemIio [Decidable (x < b)] : Decidable (x ∈ Iio b) := by assumption
#align set.decidable_mem_Iio Set.decidableMemIio
instance decidableMemIcc [Decidable (a ≤ x ∧ x ≤ b)] : Decidable (x ∈ Icc a b) := by assumption
#align set.decidable_mem_Icc Set.decidableMemIcc
instance decidableMemIic [Decidable (x ≤ b)] : Decidable (x ∈ Iic b) := by assumption
#align set.decidable_mem_Iic Set.decidableMemIic
instance decidableMemIoc [Decidable (a < x ∧ x ≤ b)] : Decidable (x ∈ Ioc a b) := by assumption
#align set.decidable_mem_Ioc Set.decidableMemIoc
instance decidableMemIci [Decidable (a ≤ x)] : Decidable (x ∈ Ici a) := by assumption
#align set.decidable_mem_Ici Set.decidableMemIci
instance decidableMemIoi [Decidable (a < x)] : Decidable (x ∈ Ioi a) := by assumption
#align set.decidable_mem_Ioi Set.decidableMemIoi
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem left_mem_Ioo : a ∈ Ioo a b ↔ False := by simp [lt_irrefl]
#align set.left_mem_Ioo Set.left_mem_Ioo
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by simp [le_refl]
#align set.left_mem_Ico Set.left_mem_Ico
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by simp [le_refl]
#align set.left_mem_Icc Set.left_mem_Icc
-- Porting note (#10618): `simp` can prove this
-- @[simp]
| Mathlib/Order/Interval/Set/Basic.lean | 196 | 196 | theorem left_mem_Ioc : a ∈ Ioc a b ↔ False := by | simp [lt_irrefl]
| [
" Decidable (x ∈ Ioo a b)",
" Decidable (x ∈ Ico a b)",
" Decidable (x ∈ Iio b)",
" Decidable (x ∈ Icc a b)",
" Decidable (x ∈ Iic b)",
" Decidable (x ∈ Ioc a b)",
" Decidable (x ∈ Ici a)",
" Decidable (x ∈ Ioi a)",
" a ∈ Ioo a b ↔ False",
" a ∈ Ico a b ↔ a < b",
" a ∈ Icc a b ↔ a ≤ b",
" a ∈ ... | [
" Decidable (x ∈ Ioo a b)",
" Decidable (x ∈ Ico a b)",
" Decidable (x ∈ Iio b)",
" Decidable (x ∈ Icc a b)",
" Decidable (x ∈ Iic b)",
" Decidable (x ∈ Ioc a b)",
" Decidable (x ∈ Ici a)",
" Decidable (x ∈ Ioi a)",
" a ∈ Ioo a b ↔ False",
" a ∈ Ico a b ↔ a < b",
" a ∈ Icc a b ↔ a ≤ b",
" a ∈ ... |
import Mathlib.Topology.ContinuousOn
#align_import topology.algebra.order.left_right from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Topology
section TopologicalSpace
variable {α β : Type*} [TopologicalSpace α] [LinearOrder α] [TopologicalSpace β]
theorem nhds_left_sup_nhds_right (a : α) : 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ici, nhdsWithin_univ]
#align nhds_left_sup_nhds_right nhds_left_sup_nhds_right
theorem nhds_left'_sup_nhds_right (a : α) : 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iio_union_Ici, nhdsWithin_univ]
#align nhds_left'_sup_nhds_right nhds_left'_sup_nhds_right
theorem nhds_left_sup_nhds_right' (a : α) : 𝓝[≤] a ⊔ 𝓝[>] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ioi, nhdsWithin_univ]
#align nhds_left_sup_nhds_right' nhds_left_sup_nhds_right'
| Mathlib/Topology/Order/LeftRight.lean | 123 | 124 | theorem nhds_left'_sup_nhds_right' (a : α) : 𝓝[<] a ⊔ 𝓝[>] a = 𝓝[≠] a := by |
rw [← nhdsWithin_union, Iio_union_Ioi]
| [
" 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a",
" 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a",
" 𝓝[≤] a ⊔ 𝓝[>] a = 𝓝 a",
" 𝓝[<] a ⊔ 𝓝[>] a = 𝓝[≠] a"
] | [
" 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a",
" 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a",
" 𝓝[≤] a ⊔ 𝓝[>] a = 𝓝 a",
" 𝓝[<] a ⊔ 𝓝[>] a = 𝓝[≠] a"
] |
import Mathlib.Data.Set.Image
import Mathlib.Data.SProd
#align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Function
namespace Set
section Prod
variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β}
theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) :
(s ×ˢ t).Subsingleton := fun _x hx _y hy ↦
Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2)
noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] :
DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable
#align set.decidable_mem_prod Set.decidableMemProd
@[gcongr]
theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ :=
fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩
#align set.prod_mono Set.prod_mono
@[gcongr]
theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t :=
prod_mono hs Subset.rfl
#align set.prod_mono_left Set.prod_mono_left
@[gcongr]
theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ :=
prod_mono Subset.rfl ht
#align set.prod_mono_right Set.prod_mono_right
@[simp]
theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ :=
⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩
#align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self
@[simp]
theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ :=
and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self
#align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self
theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P :=
⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩
#align set.prod_subset_iff Set.prod_subset_iff
theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) :=
prod_subset_iff
#align set.forall_prod_set Set.forall_prod_set
theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by
simp [and_assoc]
#align set.exists_prod_set Set.exists_prod_set
@[simp]
theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by
ext
exact and_false_iff _
#align set.prod_empty Set.prod_empty
@[simp]
theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by
ext
exact false_and_iff _
#align set.empty_prod Set.empty_prod
@[simp, mfld_simps]
theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by
ext
exact true_and_iff _
#align set.univ_prod_univ Set.univ_prod_univ
theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq]
#align set.univ_prod Set.univ_prod
theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by simp [prod_eq]
#align set.prod_univ Set.prod_univ
@[simp] lemma prod_eq_univ [Nonempty α] [Nonempty β] : s ×ˢ t = univ ↔ s = univ ∧ t = univ := by
simp [eq_univ_iff_forall, forall_and]
@[simp]
| Mathlib/Data/Set/Prod.lean | 111 | 113 | theorem singleton_prod : ({a} : Set α) ×ˢ t = Prod.mk a '' t := by |
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
| [
" (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y)",
" s ×ˢ ∅ = ∅",
" x✝ ∈ s ×ˢ ∅ ↔ x✝ ∈ ∅",
" ∅ ×ˢ t = ∅",
" x✝ ∈ ∅ ×ˢ t ↔ x✝ ∈ ∅",
" univ ×ˢ univ = univ",
" x✝ ∈ univ ×ˢ univ ↔ x✝ ∈ univ",
" univ ×ˢ t = Prod.snd ⁻¹' t",
" s ×ˢ univ = Prod.fst ⁻¹' s",
" s ×ˢ t = univ ↔ s = univ ∧ t = univ",
" {... | [
" (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y)",
" s ×ˢ ∅ = ∅",
" x✝ ∈ s ×ˢ ∅ ↔ x✝ ∈ ∅",
" ∅ ×ˢ t = ∅",
" x✝ ∈ ∅ ×ˢ t ↔ x✝ ∈ ∅",
" univ ×ˢ univ = univ",
" x✝ ∈ univ ×ˢ univ ↔ x✝ ∈ univ",
" univ ×ˢ t = Prod.snd ⁻¹' t",
" s ×ˢ univ = Prod.fst ⁻¹' s",
" s ×ˢ t = univ ↔ s = univ ∧ t = univ",
" {... |
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
| Mathlib/Algebra/MonoidAlgebra/Division.lean | 120 | 121 | theorem of'_divOf (a : G) : of' k G a /ᵒᶠ a = 1 := by |
simpa only [one_mul] using mul_of'_divOf (1 : k[G]) a
| [
" x /ᵒᶠ 0 = x",
" (x /ᵒᶠ 0) x✝ = x x✝",
" x /ᵒᶠ (a + b) = x /ᵒᶠ a /ᵒᶠ b",
" (x /ᵒᶠ (a + b)) x✝ = (x /ᵒᶠ a /ᵒᶠ b) x✝",
" of' k G a * x /ᵒᶠ a = x",
" (of' k G a * x /ᵒᶠ a) x✝ = x x✝",
" ∀ (a_1 : G), a + a_1 = a + x✝ ↔ a_1 = x✝",
" a + c = a + x✝ ↔ c = x✝",
" x * of' k G a /ᵒᶠ a = x",
" (x * of' k G ... | [
" x /ᵒᶠ 0 = x",
" (x /ᵒᶠ 0) x✝ = x x✝",
" x /ᵒᶠ (a + b) = x /ᵒᶠ a /ᵒᶠ b",
" (x /ᵒᶠ (a + b)) x✝ = (x /ᵒᶠ a /ᵒᶠ b) x✝",
" of' k G a * x /ᵒᶠ a = x",
" (of' k G a * x /ᵒᶠ a) x✝ = x x✝",
" ∀ (a_1 : G), a + a_1 = a + x✝ ↔ a_1 = x✝",
" a + c = a + x✝ ↔ c = x✝",
" x * of' k G a /ᵒᶠ a = x",
" (x * of' k G ... |
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.matrix.basis from "leanprover-community/mathlib"@"6c263e4bfc2e6714de30f22178b4d0ca4d149a76"
noncomputable section
open LinearMap Matrix Set Submodule
open Matrix
section BasisToMatrix
variable {ι ι' κ κ' : Type*}
variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
variable {R₂ M₂ : Type*} [CommRing R₂] [AddCommGroup M₂] [Module R₂ M₂]
open Function Matrix
def Basis.toMatrix (e : Basis ι R M) (v : ι' → M) : Matrix ι ι' R := fun i j => e.repr (v j) i
#align basis.to_matrix Basis.toMatrix
variable (e : Basis ι R M) (v : ι' → M) (i : ι) (j : ι')
namespace Basis
theorem toMatrix_apply : e.toMatrix v i j = e.repr (v j) i :=
rfl
#align basis.to_matrix_apply Basis.toMatrix_apply
theorem toMatrix_transpose_apply : (e.toMatrix v)ᵀ j = e.repr (v j) :=
funext fun _ => rfl
#align basis.to_matrix_transpose_apply Basis.toMatrix_transpose_apply
theorem toMatrix_eq_toMatrix_constr [Fintype ι] [DecidableEq ι] (v : ι → M) :
e.toMatrix v = LinearMap.toMatrix e e (e.constr ℕ v) := by
ext
rw [Basis.toMatrix_apply, LinearMap.toMatrix_apply, Basis.constr_basis]
#align basis.to_matrix_eq_to_matrix_constr Basis.toMatrix_eq_toMatrix_constr
-- TODO (maybe) Adjust the definition of `Basis.toMatrix` to eliminate the transpose.
| Mathlib/LinearAlgebra/Matrix/Basis.lean | 73 | 76 | theorem coePiBasisFun.toMatrix_eq_transpose [Finite ι] :
((Pi.basisFun R ι).toMatrix : Matrix ι ι R → Matrix ι ι R) = Matrix.transpose := by |
ext M i j
rfl
| [
" e.toMatrix v = (LinearMap.toMatrix e e) ((e.constr ℕ) v)",
" e.toMatrix v i✝ j✝ = (LinearMap.toMatrix e e) ((e.constr ℕ) v) i✝ j✝",
" (Pi.basisFun R ι).toMatrix = transpose",
" (Pi.basisFun R ι).toMatrix M i j = Mᵀ i j"
] | [
" e.toMatrix v = (LinearMap.toMatrix e e) ((e.constr ℕ) v)",
" e.toMatrix v i✝ j✝ = (LinearMap.toMatrix e e) ((e.constr ℕ) v) i✝ j✝",
" (Pi.basisFun R ι).toMatrix = transpose"
] |
import Mathlib.Algebra.Lie.Nilpotent
import Mathlib.Algebra.Lie.Normalizer
#align_import algebra.lie.engel from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
universe u₁ u₂ u₃ u₄
variable {R : Type u₁} {L : Type u₂} {L₂ : Type u₃} {M : Type u₄}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L₂] [LieAlgebra R L₂]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
namespace LieSubmodule
open LieModule
variable {I : LieIdeal R L} {x : L} (hxI : (R ∙ x) ⊔ I = ⊤)
| Mathlib/Algebra/Lie/Engel.lean | 82 | 86 | theorem exists_smul_add_of_span_sup_eq_top (y : L) : ∃ t : R, ∃ z ∈ I, y = t • x + z := by |
have hy : y ∈ (⊤ : Submodule R L) := Submodule.mem_top
simp only [← hxI, Submodule.mem_sup, Submodule.mem_span_singleton] at hy
obtain ⟨-, ⟨t, rfl⟩, z, hz, rfl⟩ := hy
exact ⟨t, z, hz, rfl⟩
| [
" ∃ t, ∃ z ∈ I, y = t • x + z",
" ∃ t_1, ∃ z_1 ∈ I, t • x + z = t_1 • x + z_1"
] | [
" ∃ t, ∃ z ∈ I, y = t • x + z"
] |
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.MeasureTheory.Covering.OneDim
import Mathlib.Order.Monotone.Extension
#align_import analysis.calculus.monotone from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open Set Filter Function Metric MeasureTheory MeasureTheory.Measure IsUnifLocDoublingMeasure
open scoped Topology
| Mathlib/Analysis/Calculus/Monotone.lean | 44 | 62 | theorem tendsto_apply_add_mul_sq_div_sub {f : ℝ → ℝ} {x a c d : ℝ} {l : Filter ℝ} (hl : l ≤ 𝓝[≠] x)
(hf : Tendsto (fun y => (f y - d) / (y - x)) l (𝓝 a))
(h' : Tendsto (fun y => y + c * (y - x) ^ 2) l l) :
Tendsto (fun y => (f (y + c * (y - x) ^ 2) - d) / (y - x)) l (𝓝 a) := by |
have L : Tendsto (fun y => (y + c * (y - x) ^ 2 - x) / (y - x)) l (𝓝 1) := by
have : Tendsto (fun y => 1 + c * (y - x)) l (𝓝 (1 + c * (x - x))) := by
apply Tendsto.mono_left _ (hl.trans nhdsWithin_le_nhds)
exact ((tendsto_id.sub_const x).const_mul c).const_add 1
simp only [_root_.sub_self, add_zero, mul_zero] at this
apply Tendsto.congr' (Eventually.filter_mono hl _) this
filter_upwards [self_mem_nhdsWithin] with y hy
field_simp [sub_ne_zero.2 hy]
ring
have Z := (hf.comp h').mul L
rw [mul_one] at Z
apply Tendsto.congr' _ Z
have : ∀ᶠ y in l, y + c * (y - x) ^ 2 ≠ x := by apply Tendsto.mono_right h' hl self_mem_nhdsWithin
filter_upwards [this] with y hy
field_simp [sub_ne_zero.2 hy]
| [
" Tendsto (fun y => (f (y + c * (y - x) ^ 2) - d) / (y - x)) l (𝓝 a)",
" Tendsto (fun y => (y + c * (y - x) ^ 2 - x) / (y - x)) l (𝓝 1)",
" Tendsto (fun y => 1 + c * (y - x)) l (𝓝 (1 + c * (x - x)))",
" Tendsto (fun y => 1 + c * (y - x)) (𝓝 x) (𝓝 (1 + c * (x - x)))",
" ∀ᶠ (x_1 : ℝ) in 𝓝[≠] x, 1 + c * ... | [
" Tendsto (fun y => (f (y + c * (y - x) ^ 2) - d) / (y - x)) l (𝓝 a)"
] |
import Mathlib.Data.Multiset.Bind
#align_import data.multiset.pi from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
namespace Multiset
section Pi
variable {α : Type*}
open Function
def Pi.empty (δ : α → Sort*) : ∀ a ∈ (0 : Multiset α), δ a :=
nofun
#align multiset.pi.empty Multiset.Pi.empty
universe u v
variable [DecidableEq α] {β : α → Type u} {δ : α → Sort v}
def Pi.cons (m : Multiset α) (a : α) (b : δ a) (f : ∀ a ∈ m, δ a) : ∀ a' ∈ a ::ₘ m, δ a' :=
fun a' ha' => if h : a' = a then Eq.ndrec b h.symm else f a' <| (mem_cons.1 ha').resolve_left h
#align multiset.pi.cons Multiset.Pi.cons
theorem Pi.cons_same {m : Multiset α} {a : α} {b : δ a} {f : ∀ a ∈ m, δ a} (h : a ∈ a ::ₘ m) :
Pi.cons m a b f a h = b :=
dif_pos rfl
#align multiset.pi.cons_same Multiset.Pi.cons_same
theorem Pi.cons_ne {m : Multiset α} {a a' : α} {b : δ a} {f : ∀ a ∈ m, δ a} (h' : a' ∈ a ::ₘ m)
(h : a' ≠ a) : Pi.cons m a b f a' h' = f a' ((mem_cons.1 h').resolve_left h) :=
dif_neg h
#align multiset.pi.cons_ne Multiset.Pi.cons_ne
theorem Pi.cons_swap {a a' : α} {b : δ a} {b' : δ a'} {m : Multiset α} {f : ∀ a ∈ m, δ a}
(h : a ≠ a') : HEq (Pi.cons (a' ::ₘ m) a b (Pi.cons m a' b' f))
(Pi.cons (a ::ₘ m) a' b' (Pi.cons m a b f)) := by
apply hfunext rfl
simp only [heq_iff_eq]
rintro a'' _ rfl
refine hfunext (by rw [Multiset.cons_swap]) fun ha₁ ha₂ _ => ?_
rcases ne_or_eq a'' a with (h₁ | rfl)
on_goal 1 => rcases eq_or_ne a'' a' with (rfl | h₂)
all_goals simp [*, Pi.cons_same, Pi.cons_ne]
#align multiset.pi.cons_swap Multiset.Pi.cons_swap
@[simp, nolint simpNF] -- Porting note: false positive, this lemma can prove itself
| Mathlib/Data/Multiset/Pi.lean | 62 | 68 | theorem pi.cons_eta {m : Multiset α} {a : α} (f : ∀ a' ∈ a ::ₘ m, δ a') :
(Pi.cons m a (f _ (mem_cons_self _ _)) fun a' ha' => f a' (mem_cons_of_mem ha')) = f := by |
ext a' h'
by_cases h : a' = a
· subst h
rw [Pi.cons_same]
· rw [Pi.cons_ne _ h]
| [
" HEq (cons (a' ::ₘ m) a b (cons m a' b' f)) (cons (a ::ₘ m) a' b' (cons m a b f))",
" ∀ (a_1 a'_1 : α),\n HEq a_1 a'_1 → HEq (cons (a' ::ₘ m) a b (cons m a' b' f) a_1) (cons (a ::ₘ m) a' b' (cons m a b f) a'_1)",
" ∀ (a_1 a'_1 : α),\n a_1 = a'_1 → HEq (cons (a' ::ₘ m) a b (cons m a' b' f) a_1) (cons (a :... | [
" HEq (cons (a' ::ₘ m) a b (cons m a' b' f)) (cons (a ::ₘ m) a' b' (cons m a b f))",
" ∀ (a_1 a'_1 : α),\n HEq a_1 a'_1 → HEq (cons (a' ::ₘ m) a b (cons m a' b' f) a_1) (cons (a ::ₘ m) a' b' (cons m a b f) a'_1)",
" ∀ (a_1 a'_1 : α),\n a_1 = a'_1 → HEq (cons (a' ::ₘ m) a b (cons m a' b' f) a_1) (cons (a :... |
import Mathlib.Algebra.Module.Submodule.Localization
import Mathlib.LinearAlgebra.Dimension.DivisionRing
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.OreLocalization.OreSet
open Cardinal nonZeroDivisors
section CommRing
universe u u' v v'
variable {R : Type u} (S : Type u') {M : Type v} {N : Type v'}
variable [CommRing R] [CommRing S] [AddCommGroup M] [AddCommGroup N]
variable [Module R M] [Module R N] [Algebra R S] [Module S N] [IsScalarTower R S N]
variable (p : Submonoid R) [IsLocalization p S] (f : M →ₗ[R] N) [IsLocalizedModule p f]
variable (hp : p ≤ R⁰)
variable {S} in
lemma IsLocalizedModule.linearIndependent_lift {ι} {v : ι → N} (hf : LinearIndependent S v) :
∃ w : ι → M, LinearIndependent R w := by
choose sec hsec using IsLocalizedModule.surj p f
use fun i ↦ (sec (v i)).1
rw [linearIndependent_iff'] at hf ⊢
intro t g hg i hit
apply hp (sec (v i)).2.prop
apply IsLocalization.injective S hp
rw [map_zero]
refine hf t (fun i ↦ algebraMap R S (g i * (sec (v i)).2)) ?_ _ hit
simp only [map_mul, mul_smul, algebraMap_smul, ← Submonoid.smul_def,
hsec, ← map_smul, ← map_sum, hg, map_zero]
lemma IsLocalizedModule.lift_rank_eq :
Cardinal.lift.{v} (Module.rank S N) = Cardinal.lift.{v'} (Module.rank R M) := by
cases' subsingleton_or_nontrivial R
· have := (algebraMap R S).codomain_trivial; simp only [rank_subsingleton, lift_one]
have := (IsLocalization.injective S hp).nontrivial
apply le_antisymm
· rw [Module.rank_def, lift_iSup (bddAbove_range.{v', v'} _)]
apply ciSup_le'
intro ⟨s, hs⟩
exact (IsLocalizedModule.linearIndependent_lift p f hp hs).choose_spec.cardinal_lift_le_rank
· rw [Module.rank_def, lift_iSup (bddAbove_range.{v, v} _)]
apply ciSup_le'
intro ⟨s, hs⟩
choose sec hsec using IsLocalization.surj p (S := S)
refine LinearIndependent.cardinal_lift_le_rank (ι := s) (v := fun i ↦ f i) ?_
rw [linearIndependent_iff'] at hs ⊢
intro t g hg i hit
apply (IsLocalization.map_units S (sec (g i)).2).mul_left_injective
classical
let u := fun (i : s) ↦ (t.erase i).prod (fun j ↦ (sec (g j)).2)
have : f (t.sum fun i ↦ u i • (sec (g i)).1 • i) = f 0 := by
convert congr_arg (t.prod (fun j ↦ (sec (g j)).2) • ·) hg
· simp only [map_sum, map_smul, Submonoid.smul_def, Finset.smul_sum]
apply Finset.sum_congr rfl
intro j hj
simp only [u, ← @IsScalarTower.algebraMap_smul R S N, Submonoid.coe_finset_prod, map_prod]
rw [← hsec, mul_comm (g j), mul_smul, ← mul_smul, Finset.prod_erase_mul (h := hj)]
rw [map_zero, smul_zero]
obtain ⟨c, hc⟩ := IsLocalizedModule.exists_of_eq (S := p) this
simp_rw [smul_zero, Finset.smul_sum, ← mul_smul, Submonoid.smul_def, ← mul_smul, mul_comm] at hc
simp only [hsec, zero_mul, map_eq_zero_iff (algebraMap R S) (IsLocalization.injective S hp)]
apply hp (c * u i).prop
exact hs t _ hc _ hit
lemma IsLocalizedModule.rank_eq {N : Type v} [AddCommGroup N]
[Module R N] [Module S N] [IsScalarTower R S N] (f : M →ₗ[R] N) [IsLocalizedModule p f] :
Module.rank S N = Module.rank R M := by simpa using IsLocalizedModule.lift_rank_eq S p f hp
variable (R M) in
theorem exists_set_linearIndependent_of_isDomain [IsDomain R] :
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val := by
obtain ⟨w, hw⟩ :=
IsLocalizedModule.linearIndependent_lift R⁰ (LocalizedModule.mkLinearMap R⁰ M) le_rfl
(Module.Free.chooseBasis (FractionRing R) (LocalizedModule R⁰ M)).linearIndependent
refine ⟨Set.range w, ?_, (linearIndependent_subtype_range hw.injective).mpr hw⟩
apply Cardinal.lift_injective.{max u v}
rw [Cardinal.mk_range_eq_of_injective hw.injective, ← Module.Free.rank_eq_card_chooseBasisIndex,
IsLocalizedModule.lift_rank_eq (FractionRing R) R⁰ (LocalizedModule.mkLinearMap R⁰ M) le_rfl]
| Mathlib/LinearAlgebra/Dimension/Localization.lean | 96 | 102 | theorem rank_quotient_add_rank_of_isDomain [IsDomain R] (M' : Submodule R M) :
Module.rank R (M ⧸ M') + Module.rank R M' = Module.rank R M := by |
apply lift_injective.{max u v}
rw [lift_add, ← IsLocalizedModule.lift_rank_eq (FractionRing R) R⁰ (M'.toLocalized R⁰) le_rfl,
← IsLocalizedModule.lift_rank_eq (FractionRing R) R⁰ (LocalizedModule.mkLinearMap R⁰ M) le_rfl,
← IsLocalizedModule.lift_rank_eq (FractionRing R) R⁰ (M'.toLocalizedQuotient R⁰) le_rfl,
← lift_add, rank_quotient_add_rank_of_divisionRing]
| [
" ∃ w, LinearIndependent R w",
" LinearIndependent R fun i => (sec (v i)).1",
" ∀ (s : Finset ι) (g : ι → R), ∑ i ∈ s, g i • (sec (v i)).1 = 0 → ∀ i ∈ s, g i = 0",
" g i = 0",
" g i * ↑(sec (v i)).2 = 0",
" (algebraMap R S) (g i * ↑(sec (v i)).2) = (algebraMap R S) 0",
" (algebraMap R S) (g i * ↑(sec (v... | [
" ∃ w, LinearIndependent R w",
" LinearIndependent R fun i => (sec (v i)).1",
" ∀ (s : Finset ι) (g : ι → R), ∑ i ∈ s, g i • (sec (v i)).1 = 0 → ∀ i ∈ s, g i = 0",
" g i = 0",
" g i * ↑(sec (v i)).2 = 0",
" (algebraMap R S) (g i * ↑(sec (v i)).2) = (algebraMap R S) 0",
" (algebraMap R S) (g i * ↑(sec (v... |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Tactic.Ring
#align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
def hyperoperation : ℕ → ℕ → ℕ → ℕ
| 0, _, k => k + 1
| 1, m, 0 => m
| 2, _, 0 => 0
| _ + 3, _, 0 => 1
| n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k)
#align hyperoperation hyperoperation
-- Basic hyperoperation lemmas
@[simp]
theorem hyperoperation_zero (m : ℕ) : hyperoperation 0 m = Nat.succ :=
funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one]
#align hyperoperation_zero hyperoperation_zero
theorem hyperoperation_ge_three_eq_one (n m : ℕ) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
#align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
| Mathlib/Data/Nat/Hyperoperation.lean | 53 | 55 | theorem hyperoperation_recursion (n m k : ℕ) :
hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by |
rw [hyperoperation]
| [
" hyperoperation 0 m k = k.succ",
" hyperoperation (n + 3) m 0 = 1",
" hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k)"
] | [
" hyperoperation 0 m k = k.succ",
" hyperoperation (n + 3) m 0 = 1",
" hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k)"
] |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Data.Set.Basic
import Mathlib.Tactic.Common
#align_import data.set.enumerate from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
noncomputable section
open Function
namespace Set
section Enumerate
variable {α : Type*} (sel : Set α → Option α)
def enumerate : Set α → ℕ → Option α
| s, 0 => sel s
| s, n + 1 => do
let a ← sel s
enumerate (s \ {a}) n
#align set.enumerate Set.enumerate
theorem enumerate_eq_none_of_sel {s : Set α} (h : sel s = none) : ∀ {n}, enumerate sel s n = none
| 0 => by simp [h, enumerate]
| n + 1 => by simp [h, enumerate]
#align set.enumerate_eq_none_of_sel Set.enumerate_eq_none_of_sel
theorem enumerate_eq_none :
∀ {s n₁ n₂}, enumerate sel s n₁ = none → n₁ ≤ n₂ → enumerate sel s n₂ = none
| s, 0, m => fun h _ ↦ enumerate_eq_none_of_sel sel h
| s, n + 1, m => fun h hm ↦ by
cases hs : sel s
· exact enumerate_eq_none_of_sel sel hs
· cases m with
| zero => contradiction
| succ m' =>
simp? [hs, enumerate] at h ⊢ says
simp only [enumerate, hs, Option.bind_eq_bind, Option.some_bind] at h ⊢
have hm : n ≤ m' := Nat.le_of_succ_le_succ hm
exact enumerate_eq_none h hm
#align set.enumerate_eq_none Set.enumerate_eq_none
theorem enumerate_mem (h_sel : ∀ s a, sel s = some a → a ∈ s) :
∀ {s n a}, enumerate sel s n = some a → a ∈ s
| s, 0, a => h_sel s a
| s, n + 1, a => by
cases h : sel s with
| none => simp [enumerate_eq_none_of_sel, h]
| some a' =>
simp only [enumerate, h, Nat.add_eq, add_zero]
exact fun h' : enumerate sel (s \ {a'}) n = some a ↦
have : a ∈ s \ {a'} := enumerate_mem h_sel h'
this.left
#align set.enumerate_mem Set.enumerate_mem
| Mathlib/Data/Set/Enumerate.lean | 75 | 101 | theorem enumerate_inj {n₁ n₂ : ℕ} {a : α} {s : Set α} (h_sel : ∀ s a, sel s = some a → a ∈ s)
(h₁ : enumerate sel s n₁ = some a) (h₂ : enumerate sel s n₂ = some a) : n₁ = n₂ := by |
/- Porting note: The `rcase, on_goal, all_goals` has been used instead of
the not-yet-ported `wlog` -/
rcases le_total n₁ n₂ with (hn|hn)
on_goal 2 => swap_var n₁ ↔ n₂, h₁ ↔ h₂
all_goals
rcases Nat.le.dest hn with ⟨m, rfl⟩
clear hn
induction n₁ generalizing s with
| zero =>
cases m with
| zero => rfl
| succ m =>
have h' : enumerate sel (s \ {a}) m = some a := by
simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add]; exact h₂
have : a ∈ s \ {a} := enumerate_mem sel h_sel h'
simp_all [Set.mem_diff_singleton]
| succ k ih =>
cases h : sel s with
/- Porting note: The original covered both goals with just `simp_all <;> tauto` -/
| none =>
simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
| some =>
simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq,
Nat.add_succ, Nat.succ.injEq]
exact ih h₁ h₂
| [
" enumerate sel s 0 = none",
" enumerate sel s (n + 1) = none",
" enumerate sel s m = none",
" enumerate sel s (m' + 1) = none",
" enumerate sel (s \\ {val✝}) m' = none",
" enumerate sel s (n + 1) = some a → a ∈ s",
" (do\n let a ← some a'\n enumerate sel (s \\ {a}) n) =\n some a →\n ... | [
" enumerate sel s 0 = none",
" enumerate sel s (n + 1) = none",
" enumerate sel s m = none",
" enumerate sel s (m' + 1) = none",
" enumerate sel (s \\ {val✝}) m' = none",
" enumerate sel s (n + 1) = some a → a ∈ s",
" (do\n let a ← some a'\n enumerate sel (s \\ {a}) n) =\n some a →\n ... |
import Mathlib.Order.PartialSups
#align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {α β : Type*}
section GeneralizedBooleanAlgebra
variable [GeneralizedBooleanAlgebra α]
def disjointed (f : ℕ → α) : ℕ → α
| 0 => f 0
| n + 1 => f (n + 1) \ partialSups f n
#align disjointed disjointed
@[simp]
theorem disjointed_zero (f : ℕ → α) : disjointed f 0 = f 0 :=
rfl
#align disjointed_zero disjointed_zero
theorem disjointed_succ (f : ℕ → α) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ partialSups f n :=
rfl
#align disjointed_succ disjointed_succ
| Mathlib/Order/Disjointed.lean | 63 | 67 | theorem disjointed_le_id : disjointed ≤ (id : (ℕ → α) → ℕ → α) := by |
rintro f n
cases n
· rfl
· exact sdiff_le
| [
" disjointed ≤ id",
" disjointed f n ≤ id f n",
" disjointed f 0 ≤ id f 0",
" disjointed f (n✝ + 1) ≤ id f (n✝ + 1)"
] | [
" disjointed ≤ id"
] |
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
theorem inv_goldConj : ψ⁻¹ = -φ := by
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
#align inv_gold_conj inv_goldConj
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
field_simp
rw [← sq_sub_sq]
norm_num
#align gold_mul_gold_conj gold_mul_goldConj
@[simp]
theorem goldConj_mul_gold : ψ * φ = -1 := by
rw [mul_comm]
exact gold_mul_goldConj
#align gold_conj_mul_gold goldConj_mul_gold
@[simp]
theorem gold_add_goldConj : φ + ψ = 1 := by
rw [goldenRatio, goldenConj]
ring
#align gold_add_gold_conj gold_add_goldConj
theorem one_sub_goldConj : 1 - φ = ψ := by
linarith [gold_add_goldConj]
#align one_sub_gold_conj one_sub_goldConj
theorem one_sub_gold : 1 - ψ = φ := by
linarith [gold_add_goldConj]
#align one_sub_gold one_sub_gold
@[simp]
theorem gold_sub_goldConj : φ - ψ = √5 := by ring
#align gold_sub_gold_conj gold_sub_goldConj
theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
rw [goldenRatio, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_sq gold_sq
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
rw [goldenConj, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_conj_sq goldConj_sq
theorem gold_pos : 0 < φ :=
mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two
#align gold_pos gold_pos
theorem gold_ne_zero : φ ≠ 0 :=
ne_of_gt gold_pos
#align gold_ne_zero gold_ne_zero
theorem one_lt_gold : 1 < φ := by
refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos)
simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow`
#align one_lt_gold one_lt_gold
| Mathlib/Data/Real/GoldenRatio.lean | 117 | 119 | theorem gold_lt_two : φ < 2 := by | calc
(1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num
_ = 2 := by norm_num
| [
" φ⁻¹ = -ψ",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" ψ⁻¹ = -φ",
" -ψ = φ⁻¹",
" φ * ψ = -1",
" (1 + √5) * (1 - √5) = -(2 * 2)",
" 1 ^ 2 - √5 ^ 2 = -(2 * 2)",
" ψ * φ = -1",
" φ + ψ = 1",
" (1 + √5) / 2 + (1 - √5) / 2 = 1",
" 1 - φ = ψ",
" 1 - ψ = φ",
" φ - ψ = √5",
" φ ^ (n + 2) - φ ^ (... | [
" φ⁻¹ = -ψ",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" ψ⁻¹ = -φ",
" -ψ = φ⁻¹",
" φ * ψ = -1",
" (1 + √5) * (1 - √5) = -(2 * 2)",
" 1 ^ 2 - √5 ^ 2 = -(2 * 2)",
" ψ * φ = -1",
" φ + ψ = 1",
" (1 + √5) / 2 + (1 - √5) / 2 = 1",
" 1 - φ = ψ",
" 1 - ψ = φ",
" φ - ψ = √5",
" φ ^ (n + 2) - φ ^ (... |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ι : Type*} {α : ι → Type*} {f f₁ f₂ : (i : ι) → Filter (α i)} {s : (i : ι) → Set (α i)}
{p : ∀ i, α i → Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodᵢ (f : ∀ i, Filter (α i)) : Filter (∀ i, α i) :=
⨆ i : ι, comap (eval i) (f i)
#align filter.Coprod Filter.coprodᵢ
theorem mem_coprodᵢ_iff {s : Set (∀ i, α i)} :
s ∈ Filter.coprodᵢ f ↔ ∀ i : ι, ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s := by simp [Filter.coprodᵢ]
#align filter.mem_Coprod_iff Filter.mem_coprodᵢ_iff
theorem compl_mem_coprodᵢ {s : Set (∀ i, α i)} :
sᶜ ∈ Filter.coprodᵢ f ↔ ∀ i, (eval i '' s)ᶜ ∈ f i := by
simp only [Filter.coprodᵢ, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodᵢ
| Mathlib/Order/Filter/Pi.lean | 238 | 240 | theorem coprodᵢ_neBot_iff' :
NeBot (Filter.coprodᵢ f) ↔ (∀ i, Nonempty (α i)) ∧ ∃ d, NeBot (f d) := by |
simp only [Filter.coprodᵢ, iSup_neBot, ← exists_and_left, ← comap_eval_neBot_iff']
| [
" s ∈ Filter.coprodᵢ f ↔ ∀ (i : ι), ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s",
" sᶜ ∈ Filter.coprodᵢ f ↔ ∀ (i : ι), (eval i '' s)ᶜ ∈ f i",
" (Filter.coprodᵢ f).NeBot ↔ (∀ (i : ι), Nonempty (α i)) ∧ ∃ d, (f d).NeBot"
] | [
" s ∈ Filter.coprodᵢ f ↔ ∀ (i : ι), ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s",
" sᶜ ∈ Filter.coprodᵢ f ↔ ∀ (i : ι), (eval i '' s)ᶜ ∈ f i",
" (Filter.coprodᵢ f).NeBot ↔ (∀ (i : ι), Nonempty (α i)) ∧ ∃ d, (f d).NeBot"
] |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Algebra.Star.Unitary
import Mathlib.Data.Nat.ModEq
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.Tactic.Monotonicity
#align_import number_theory.pell_matiyasevic from "leanprover-community/mathlib"@"795b501869b9fa7aa716d5fdadd00c03f983a605"
namespace Pell
open Nat
section
variable {d : ℤ}
def IsPell : ℤ√d → Prop
| ⟨x, y⟩ => x * x - d * y * y = 1
#align pell.is_pell Pell.IsPell
theorem isPell_norm : ∀ {b : ℤ√d}, IsPell b ↔ b * star b = 1
| ⟨x, y⟩ => by simp [Zsqrtd.ext_iff, IsPell, mul_comm]; ring_nf
#align pell.is_pell_norm Pell.isPell_norm
theorem isPell_iff_mem_unitary : ∀ {b : ℤ√d}, IsPell b ↔ b ∈ unitary (ℤ√d)
| ⟨x, y⟩ => by rw [unitary.mem_iff, isPell_norm, mul_comm (star _), and_self_iff]
#align pell.is_pell_iff_mem_unitary Pell.isPell_iff_mem_unitary
theorem isPell_mul {b c : ℤ√d} (hb : IsPell b) (hc : IsPell c) : IsPell (b * c) :=
isPell_norm.2 (by simp [mul_comm, mul_left_comm c, mul_assoc,
star_mul, isPell_norm.1 hb, isPell_norm.1 hc])
#align pell.is_pell_mul Pell.isPell_mul
theorem isPell_star : ∀ {b : ℤ√d}, IsPell b ↔ IsPell (star b)
| ⟨x, y⟩ => by simp [IsPell, Zsqrtd.star_mk]
#align pell.is_pell_star Pell.isPell_star
end
section
-- Porting note: was parameter in Lean3
variable {a : ℕ} (a1 : 1 < a)
private def d (_a1 : 1 < a) :=
a * a - 1
@[simp]
theorem d_pos : 0 < d a1 :=
tsub_pos_of_lt (mul_lt_mul a1 (le_of_lt a1) (by decide) (Nat.zero_le _) : 1 * 1 < a * a)
#align pell.d_pos Pell.d_pos
-- TODO(lint): Fix double namespace issue
--@[nolint dup_namespace]
def pell : ℕ → ℕ × ℕ
-- Porting note: used pattern matching because `Nat.recOn` is noncomputable
| 0 => (1, 0)
| n+1 => ((pell n).1 * a + d a1 * (pell n).2, (pell n).1 + (pell n).2 * a)
#align pell.pell Pell.pell
def xn (n : ℕ) : ℕ :=
(pell a1 n).1
#align pell.xn Pell.xn
def yn (n : ℕ) : ℕ :=
(pell a1 n).2
#align pell.yn Pell.yn
@[simp]
theorem pell_val (n : ℕ) : pell a1 n = (xn a1 n, yn a1 n) :=
show pell a1 n = ((pell a1 n).1, (pell a1 n).2) from
match pell a1 n with
| (_, _) => rfl
#align pell.pell_val Pell.pell_val
@[simp]
theorem xn_zero : xn a1 0 = 1 :=
rfl
#align pell.xn_zero Pell.xn_zero
@[simp]
theorem yn_zero : yn a1 0 = 0 :=
rfl
#align pell.yn_zero Pell.yn_zero
@[simp]
theorem xn_succ (n : ℕ) : xn a1 (n + 1) = xn a1 n * a + d a1 * yn a1 n :=
rfl
#align pell.xn_succ Pell.xn_succ
@[simp]
theorem yn_succ (n : ℕ) : yn a1 (n + 1) = xn a1 n + yn a1 n * a :=
rfl
#align pell.yn_succ Pell.yn_succ
--@[simp] Porting note (#10618): `simp` can prove it
theorem xn_one : xn a1 1 = a := by simp
#align pell.xn_one Pell.xn_one
--@[simp] Porting note (#10618): `simp` can prove it
| Mathlib/NumberTheory/PellMatiyasevic.lean | 155 | 155 | theorem yn_one : yn a1 1 = 1 := by | simp
| [
" IsPell { re := x, im := y } ↔ { re := x, im := y } * star { re := x, im := y } = 1",
" x * x - y * (d * y) = 1 ↔ x * x + -(y * (d * y)) = 1",
" IsPell { re := x, im := y } ↔ { re := x, im := y } ∈ unitary (ℤ√d)",
" b * c * star (b * c) = 1",
" IsPell { re := x, im := y } ↔ IsPell (star { re := x, im := y ... | [
" IsPell { re := x, im := y } ↔ { re := x, im := y } * star { re := x, im := y } = 1",
" x * x - y * (d * y) = 1 ↔ x * x + -(y * (d * y)) = 1",
" IsPell { re := x, im := y } ↔ { re := x, im := y } ∈ unitary (ℤ√d)",
" b * c * star (b * c) = 1",
" IsPell { re := x, im := y } ↔ IsPell (star { re := x, im := y ... |
import Mathlib.Analysis.Calculus.BumpFunction.Basic
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Function Filter Set Metric MeasureTheory FiniteDimensional Measure
open scoped Topology
namespace ContDiffBump
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E]
[MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} {μ : Measure E}
protected def normed (μ : Measure E) : E → ℝ := fun x => f x / ∫ x, f x ∂μ
#align cont_diff_bump.normed ContDiffBump.normed
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ :=
rfl
#align cont_diff_bump.normed_def ContDiffBump.normed_def
theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x :=
div_nonneg f.nonneg <| integral_nonneg f.nonneg'
#align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed
theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ) :=
f.contDiff.div_const _
#align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed
theorem continuous_normed : Continuous (f.normed μ) :=
f.continuous.div_const _
#align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed
theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by
simp_rw [f.normed_def, f.sub]
#align cont_diff_bump.normed_sub ContDiffBump.normed_sub
theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed μ (-x) = f.normed μ x := by
simp_rw [f.normed_def, f.neg]
#align cont_diff_bump.normed_neg ContDiffBump.normed_neg
variable [BorelSpace E] [FiniteDimensional ℝ E] [IsLocallyFiniteMeasure μ]
protected theorem integrable : Integrable f μ :=
f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport
#align cont_diff_bump.integrable ContDiffBump.integrable
protected theorem integrable_normed : Integrable (f.normed μ) μ :=
f.integrable.div_const _
#align cont_diff_bump.integrable_normed ContDiffBump.integrable_normed
variable [μ.IsOpenPosMeasure]
theorem integral_pos : 0 < ∫ x, f x ∂μ := by
refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_
rw [f.support_eq]
exact measure_ball_pos μ c f.rOut_pos
#align cont_diff_bump.integral_pos ContDiffBump.integral_pos
theorem integral_normed : ∫ x, f.normed μ x ∂μ = 1 := by
simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ← smul_eq_mul, integral_smul]
exact inv_mul_cancel f.integral_pos.ne'
#align cont_diff_bump.integral_normed ContDiffBump.integral_normed
| Mathlib/Analysis/Calculus/BumpFunction/Normed.lean | 80 | 82 | theorem support_normed_eq : Function.support (f.normed μ) = Metric.ball c f.rOut := by |
unfold ContDiffBump.normed
rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ]
| [
" f.normed μ (c - x) = f.normed μ (c + x)",
" f.normed μ (-x) = f.normed μ x",
" 0 < ∫ (x : E), ↑f x ∂μ",
" 0 < μ (support fun i => ↑f i)",
" 0 < μ (ball c f.rOut)",
" ∫ (x : E), f.normed μ x ∂μ = 1",
" (∫ (x : E), ↑f x ∂μ)⁻¹ • ∫ (x : E), ↑f x ∂μ = 1",
" support (f.normed μ) = ball c f.rOut",
" (sup... | [
" f.normed μ (c - x) = f.normed μ (c + x)",
" f.normed μ (-x) = f.normed μ x",
" 0 < ∫ (x : E), ↑f x ∂μ",
" 0 < μ (support fun i => ↑f i)",
" 0 < μ (ball c f.rOut)",
" ∫ (x : E), f.normed μ x ∂μ = 1",
" (∫ (x : E), ↑f x ∂μ)⁻¹ • ∫ (x : E), ↑f x ∂μ = 1",
" support (f.normed μ) = ball c f.rOut"
] |
import Batteries.Data.List.Lemmas
namespace List
universe u v
variable {α : Type u} {β : Type v}
@[simp] theorem eraseIdx_zero (l : List α) : eraseIdx l 0 = tail l := by cases l <;> rfl
theorem eraseIdx_eq_take_drop_succ :
∀ (l : List α) (i : Nat), l.eraseIdx i = l.take i ++ l.drop (i + 1)
| nil, _ => by simp
| a::l, 0 => by simp
| a::l, i + 1 => by simp [eraseIdx_eq_take_drop_succ l i]
theorem eraseIdx_sublist : ∀ (l : List α) (k : Nat), eraseIdx l k <+ l
| [], _ => by simp
| a::l, 0 => by simp
| a::l, k + 1 => by simp [eraseIdx_sublist l k]
theorem eraseIdx_subset (l : List α) (k : Nat) : eraseIdx l k ⊆ l := (eraseIdx_sublist l k).subset
@[simp]
theorem eraseIdx_eq_self : ∀ {l : List α} {k : Nat}, eraseIdx l k = l ↔ length l ≤ k
| [], _ => by simp
| a::l, 0 => by simp [(cons_ne_self _ _).symm]
| a::l, k + 1 => by simp [eraseIdx_eq_self]
alias ⟨_, eraseIdx_of_length_le⟩ := eraseIdx_eq_self
theorem eraseIdx_append_of_lt_length {l : List α} {k : Nat} (hk : k < length l) (l' : List α) :
eraseIdx (l ++ l') k = eraseIdx l k ++ l' := by
rw [eraseIdx_eq_take_drop_succ, take_append_of_le_length, drop_append_of_le_length,
eraseIdx_eq_take_drop_succ, append_assoc]
all_goals omega
| .lake/packages/batteries/Batteries/Data/List/EraseIdx.lean | 49 | 55 | theorem eraseIdx_append_of_length_le {l : List α} {k : Nat} (hk : length l ≤ k) (l' : List α) :
eraseIdx (l ++ l') k = l ++ eraseIdx l' (k - length l) := by |
rw [eraseIdx_eq_take_drop_succ, eraseIdx_eq_take_drop_succ,
take_append_eq_append_take, drop_append_eq_append_drop,
take_all_of_le hk, drop_eq_nil_of_le (by omega), nil_append, append_assoc]
congr
omega
| [
" l.eraseIdx 0 = l.tail",
" [].eraseIdx 0 = [].tail",
" (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail",
" [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []",
" (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)",
" (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::... | [
" l.eraseIdx 0 = l.tail",
" [].eraseIdx 0 = [].tail",
" (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail",
" [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []",
" (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)",
" (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::... |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {α β γ : Type*}
class Fintype (α : Type*) where
elems : Finset α
complete : ∀ x : α, x ∈ elems
#align fintype Fintype
namespace Finset
variable [Fintype α] {s t : Finset α}
def univ : Finset α :=
@Fintype.elems α _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : α) : x ∈ (univ : Finset α) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : ∀ x, x ∈ (univ : Finset α).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ ↔ ∀ x, x ∈ s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (∀ x, x ∈ s) → s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : ↑(univ : Finset α) = (Set.univ : Set α) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
| Mathlib/Data/Fintype/Basic.lean | 96 | 96 | theorem coe_eq_univ : (s : Set α) = Set.univ ↔ s = univ := by | rw [← coe_univ, coe_inj]
| [
" s = univ ↔ ∀ (x : α), x ∈ s",
" ↑univ = Set.univ",
" x✝ ∈ ↑univ ↔ x✝ ∈ Set.univ",
" ↑s = Set.univ ↔ s = univ"
] | [
" s = univ ↔ ∀ (x : α), x ∈ s",
" ↑univ = Set.univ",
" x✝ ∈ ↑univ ↔ x✝ ∈ Set.univ",
" ↑s = Set.univ ↔ s = univ"
] |
import Mathlib.Algebra.Order.Group.PiLex
import Mathlib.Data.DFinsupp.Order
import Mathlib.Data.DFinsupp.NeLocus
import Mathlib.Order.WellFoundedSet
#align_import data.dfinsupp.lex from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a"
variable {ι : Type*} {α : ι → Type*}
namespace DFinsupp
section Zero
variable [∀ i, Zero (α i)]
protected def Lex (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) (x y : Π₀ i, α i) : Prop :=
Pi.Lex r (s _) x y
#align dfinsupp.lex DFinsupp.Lex
-- Porting note: Added `_root_` to match more closely with Lean 3. Also updated `s`'s type.
theorem _root_.Pi.lex_eq_dfinsupp_lex {r : ι → ι → Prop} {s : ∀ i, α i → α i → Prop}
(a b : Π₀ i, α i) : Pi.Lex r (s _) (a : ∀ i, α i) b = DFinsupp.Lex r s a b :=
rfl
#align pi.lex_eq_dfinsupp_lex Pi.lex_eq_dfinsupp_lex
-- Porting note: Updated `s`'s type.
theorem lex_def {r : ι → ι → Prop} {s : ∀ i, α i → α i → Prop} {a b : Π₀ i, α i} :
DFinsupp.Lex r s a b ↔ ∃ j, (∀ d, r d j → a d = b d) ∧ s j (a j) (b j) :=
Iff.rfl
#align dfinsupp.lex_def DFinsupp.lex_def
instance [LT ι] [∀ i, LT (α i)] : LT (Lex (Π₀ i, α i)) :=
⟨fun f g ↦ DFinsupp.Lex (· < ·) (fun _ ↦ (· < ·)) (ofLex f) (ofLex g)⟩
theorem lex_lt_of_lt_of_preorder [∀ i, Preorder (α i)] (r) [IsStrictOrder ι 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 := by
obtain ⟨hle, j, hlt⟩ := Pi.lt_def.1 hlt
classical
have : (x.neLocus y : Set ι).WellFoundedOn r := (x.neLocus y).finite_toSet.wellFoundedOn
obtain ⟨i, hi, hl⟩ := this.has_min { i | x i < y i } ⟨⟨j, mem_neLocus.2 hlt.ne⟩, hlt⟩
refine ⟨i, fun k hk ↦ ⟨hle k, ?_⟩, hi⟩
exact of_not_not fun h ↦ hl ⟨k, mem_neLocus.2 (ne_of_not_le h).symm⟩ ((hle k).lt_of_not_le h) hk
#align dfinsupp.lex_lt_of_lt_of_preorder DFinsupp.lex_lt_of_lt_of_preorder
theorem lex_lt_of_lt [∀ i, PartialOrder (α i)] (r) [IsStrictOrder ι r] {x y : Π₀ i, α i}
(hlt : x < y) : Pi.Lex r (· < ·) x y := by
simp_rw [Pi.Lex, le_antisymm_iff]
exact lex_lt_of_lt_of_preorder r hlt
#align dfinsupp.lex_lt_of_lt DFinsupp.lex_lt_of_lt
variable [LinearOrder ι]
instance Lex.isStrictOrder [∀ i, PartialOrder (α i)] :
IsStrictOrder (Lex (Π₀ i, α i)) (· < ·) :=
let i : IsStrictOrder (Lex (∀ i, α i)) (· < ·) := Pi.Lex.isStrictOrder
{ irrefl := toLex.surjective.forall.2 fun _ ↦ @irrefl _ _ i.toIsIrrefl _
trans := toLex.surjective.forall₃.2 fun _ _ _ ↦ @trans _ _ i.toIsTrans _ _ _ }
#align dfinsupp.lex.is_strict_order DFinsupp.Lex.isStrictOrder
instance Lex.partialOrder [∀ i, PartialOrder (α i)] : PartialOrder (Lex (Π₀ i, α i)) where
lt := (· < ·)
le x y := ⇑(ofLex x) = ⇑(ofLex y) ∨ x < y
__ := PartialOrder.lift (fun x : Lex (Π₀ i, α i) ↦ toLex (⇑(ofLex x)))
(DFunLike.coe_injective (F := DFinsupp α))
#align dfinsupp.lex.partial_order DFinsupp.Lex.partialOrder
variable [∀ i, PartialOrder (α i)]
| Mathlib/Data/DFinsupp/Lex.lean | 133 | 139 | theorem toLex_monotone : Monotone (@toLex (Π₀ i, α i)) := by |
intro a b h
refine le_of_lt_or_eq (or_iff_not_imp_right.2 fun hne ↦ ?_)
classical
exact ⟨Finset.min' _ (nonempty_neLocus_iff.2 hne),
fun j hj ↦ not_mem_neLocus.1 fun h ↦ (Finset.min'_le _ _ h).not_lt hj,
(h _).lt_of_ne (mem_neLocus.1 <| Finset.min'_mem _ _)⟩
| [
" ∃ i, (∀ (j : ι), r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i",
" y k ≤ x k",
" Pi.Lex r (fun {i} x x_1 => x < x_1) ⇑x ⇑y",
" Monotone ⇑toLex",
" toLex a ≤ toLex b",
" toLex a < toLex b"
] | [
" ∃ i, (∀ (j : ι), r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i",
" y k ≤ x k",
" Pi.Lex r (fun {i} x x_1 => x < x_1) ⇑x ⇑y",
" Monotone ⇑toLex"
] |
import Mathlib.Data.List.Chain
#align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
variable {α : Type*} (l : List α) (R : α → α → Prop) [DecidableRel R] {a b : α}
namespace List
@[simp]
theorem destutter'_nil : destutter' R a [] = [a] :=
rfl
#align list.destutter'_nil List.destutter'_nil
theorem destutter'_cons :
(b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l :=
rfl
#align list.destutter'_cons List.destutter'_cons
variable {R}
@[simp]
theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by
rw [destutter', if_pos h]
#align list.destutter'_cons_pos List.destutter'_cons_pos
@[simp]
| Mathlib/Data/List/Destutter.lean | 53 | 54 | theorem destutter'_cons_neg (h : ¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by |
rw [destutter', if_neg h]
| [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l"
] | [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l"
] |
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.RingTheory.Prime
import Mathlib.RingTheory.Polynomial.Content
import Mathlib.RingTheory.Ideal.Quotient
#align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff"
open Polynomial Ideal.Quotient
variable {R : Type*} [CommRing R]
namespace Polynomial
open Polynomial
namespace EisensteinCriterionAux
-- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion`
theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R}
(hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) :
map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree :=
Polynomial.ext fun n => by
by_cases hf0 : f = 0
· simp [hf0]
rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h)
· erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg,
mul_zero]
rintro rfl
exact not_lt_of_ge degree_le_natDegree h
· have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm
rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map]
· rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt]
· refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_
rwa [← degree_eq_natDegree hf0]
· exact lt_of_le_of_lt (degree_map_le _ _) h
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem
theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]}
{c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) :
n ≤ q.natDegree :=
Nat.cast_le.1
(calc
↑n = degree (q.map (mk P)) := by
rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one]
_ ≤ degree q := degree_map_le _ _
_ ≤ natDegree q := degree_le_natDegree
)
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow
| Mathlib/RingTheory/EisensteinCriterion.lean | 65 | 68 | theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : Ideal R} {q : R[X]}
{c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n ≠ 0) : eval 0 q ∈ P := by |
rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map, hq,
coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero]
| [
" (map (mk P) f).coeff n = (C ((mk P) f.leadingCoeff) * X ^ f.natDegree).coeff n",
" ¬n = f.natDegree",
" False",
" (C ((mk P) f.leadingCoeff) * X ^ f.natDegree).degree < ↑n",
" ↑f.natDegree < ↑n",
" (map (mk P) f).degree < ↑n",
" ↑n = (map (mk P) q).degree",
" eval 0 q ∈ P"
] | [
" (map (mk P) f).coeff n = (C ((mk P) f.leadingCoeff) * X ^ f.natDegree).coeff n",
" ¬n = f.natDegree",
" False",
" (C ((mk P) f.leadingCoeff) * X ^ f.natDegree).degree < ↑n",
" ↑f.natDegree < ↑n",
" (map (mk P) f).degree < ↑n",
" ↑n = (map (mk P) q).degree",
" eval 0 q ∈ P"
] |
import Mathlib.Algebra.Algebra.Defs
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.Field.Canonical.Basic
import Mathlib.Algebra.Order.Nonneg.Field
import Mathlib.Algebra.Order.Nonneg.Floor
import Mathlib.Data.Real.Pointwise
import Mathlib.Order.ConditionallyCompleteLattice.Group
import Mathlib.Tactic.GCongr.Core
#align_import data.real.nnreal from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
open Function
-- to ensure these instances are computable
def NNReal := { r : ℝ // 0 ≤ r } deriving
Zero, One, Semiring, StrictOrderedSemiring, CommMonoidWithZero, CommSemiring,
SemilatticeInf, SemilatticeSup, DistribLattice, OrderedCommSemiring,
CanonicallyOrderedCommSemiring, Inhabited
#align nnreal NNReal
namespace NNReal
scoped notation "ℝ≥0" => NNReal
noncomputable instance : FloorSemiring ℝ≥0 := Nonneg.floorSemiring
instance instDenselyOrdered : DenselyOrdered ℝ≥0 := Nonneg.instDenselyOrdered
instance : OrderBot ℝ≥0 := inferInstance
instance : Archimedean ℝ≥0 := Nonneg.archimedean
noncomputable instance : Sub ℝ≥0 := Nonneg.sub
noncomputable instance : OrderedSub ℝ≥0 := Nonneg.orderedSub
noncomputable instance : CanonicallyLinearOrderedSemifield ℝ≥0 :=
Nonneg.canonicallyLinearOrderedSemifield
@[coe] def toReal : ℝ≥0 → ℝ := Subtype.val
instance : Coe ℝ≥0 ℝ := ⟨toReal⟩
-- Simp lemma to put back `n.val` into the normal form given by the coercion.
@[simp]
theorem val_eq_coe (n : ℝ≥0) : n.val = n :=
rfl
#align nnreal.val_eq_coe NNReal.val_eq_coe
instance canLift : CanLift ℝ ℝ≥0 toReal fun r => 0 ≤ r :=
Subtype.canLift _
#align nnreal.can_lift NNReal.canLift
@[ext] protected theorem eq {n m : ℝ≥0} : (n : ℝ) = (m : ℝ) → n = m :=
Subtype.eq
#align nnreal.eq NNReal.eq
protected theorem eq_iff {n m : ℝ≥0} : (n : ℝ) = (m : ℝ) ↔ n = m :=
Subtype.ext_iff.symm
#align nnreal.eq_iff NNReal.eq_iff
theorem ne_iff {x y : ℝ≥0} : (x : ℝ) ≠ (y : ℝ) ↔ x ≠ y :=
not_congr <| NNReal.eq_iff
#align nnreal.ne_iff NNReal.ne_iff
protected theorem «forall» {p : ℝ≥0 → Prop} :
(∀ x : ℝ≥0, p x) ↔ ∀ (x : ℝ) (hx : 0 ≤ x), p ⟨x, hx⟩ :=
Subtype.forall
#align nnreal.forall NNReal.forall
protected theorem «exists» {p : ℝ≥0 → Prop} :
(∃ x : ℝ≥0, p x) ↔ ∃ (x : ℝ) (hx : 0 ≤ x), p ⟨x, hx⟩ :=
Subtype.exists
#align nnreal.exists NNReal.exists
noncomputable def _root_.Real.toNNReal (r : ℝ) : ℝ≥0 :=
⟨max r 0, le_max_right _ _⟩
#align real.to_nnreal Real.toNNReal
theorem _root_.Real.coe_toNNReal (r : ℝ) (hr : 0 ≤ r) : (Real.toNNReal r : ℝ) = r :=
max_eq_left hr
#align real.coe_to_nnreal Real.coe_toNNReal
| Mathlib/Data/Real/NNReal.lean | 125 | 126 | theorem _root_.Real.toNNReal_of_nonneg {r : ℝ} (hr : 0 ≤ r) : r.toNNReal = ⟨r, hr⟩ := by |
simp_rw [Real.toNNReal, max_eq_left hr]
| [
" r.toNNReal = ⟨r, hr⟩"
] | [
" r.toNNReal = ⟨r, hr⟩"
] |
import Mathlib.Logic.Function.Conjugate
#align_import logic.function.iterate from "leanprover-community/mathlib"@"792a2a264169d64986541c6f8f7e3bbb6acb6295"
universe u v
variable {α : Type u} {β : Type v}
def Nat.iterate {α : Sort u} (op : α → α) : ℕ → α → α
| 0, a => a
| succ k, a => iterate op k (op a)
#align nat.iterate Nat.iterate
@[inherit_doc Nat.iterate]
notation:max f "^["n"]" => Nat.iterate f n
namespace Function
open Function (Commute)
variable (f : α → α)
@[simp]
theorem iterate_zero : f^[0] = id :=
rfl
#align function.iterate_zero Function.iterate_zero
theorem iterate_zero_apply (x : α) : f^[0] x = x :=
rfl
#align function.iterate_zero_apply Function.iterate_zero_apply
@[simp]
theorem iterate_succ (n : ℕ) : f^[n.succ] = f^[n] ∘ f :=
rfl
#align function.iterate_succ Function.iterate_succ
theorem iterate_succ_apply (n : ℕ) (x : α) : f^[n.succ] x = f^[n] (f x) :=
rfl
#align function.iterate_succ_apply Function.iterate_succ_apply
@[simp]
theorem iterate_id (n : ℕ) : (id : α → α)^[n] = id :=
Nat.recOn n rfl fun n ihn ↦ by rw [iterate_succ, ihn, id_comp]
#align function.iterate_id Function.iterate_id
theorem iterate_add (m : ℕ) : ∀ n : ℕ, f^[m + n] = f^[m] ∘ f^[n]
| 0 => rfl
| Nat.succ n => by rw [Nat.add_succ, iterate_succ, iterate_succ, iterate_add m n]; rfl
#align function.iterate_add Function.iterate_add
| Mathlib/Logic/Function/Iterate.lean | 80 | 82 | theorem iterate_add_apply (m n : ℕ) (x : α) : f^[m + n] x = f^[m] (f^[n] x) := by |
rw [iterate_add f m n]
rfl
| [
" id^[n.succ] = id",
" f^[m + n.succ] = f^[m] ∘ f^[n.succ]",
" (f^[m] ∘ f^[n]) ∘ f = f^[m] ∘ f^[n] ∘ f",
" f^[m + n] x = f^[m] (f^[n] x)",
" (f^[m] ∘ f^[n]) x = f^[m] (f^[n] x)"
] | [
" id^[n.succ] = id",
" f^[m + n.succ] = f^[m] ∘ f^[n.succ]",
" (f^[m] ∘ f^[n]) ∘ f = f^[m] ∘ f^[n] ∘ f",
" f^[m + n] x = f^[m] (f^[n] x)"
] |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.List.MinMax
import Mathlib.Algebra.Tropical.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Finset
#align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
variable {R S : Type*}
open Tropical Finset
theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.trop_sum List.trop_sum
theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) :
trop s.sum = Multiset.prod (s.map trop) :=
Quotient.inductionOn s (by simpa using List.trop_sum)
#align multiset.trop_sum Multiset.trop_sum
theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S → R) :
trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by
convert Multiset.trop_sum (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align trop_sum trop_sum
theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) :
untrop l.prod = List.sum (l.map untrop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.untrop_prod List.untrop_prod
theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) :
untrop s.prod = Multiset.sum (s.map untrop) :=
Quotient.inductionOn s (by simpa using List.untrop_prod)
#align multiset.untrop_prod Multiset.untrop_prod
theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S → Tropical R) :
untrop (∏ i ∈ s, f i) = ∑ i ∈ s, untrop (f i) := by
convert Multiset.untrop_prod (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align untrop_prod untrop_prod
-- Porting note: replaced `coe` with `WithTop.some` in statement
theorem List.trop_minimum [LinearOrder R] (l : List R) :
trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by
induction' l with hd tl IH
· simp
· simp [List.minimum_cons, ← IH]
#align list.trop_minimum List.trop_minimum
theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) :
trop s.inf = Multiset.sum (s.map trop) := by
induction' s using Multiset.induction with s x IH
· simp
· simp [← IH]
#align multiset.trop_inf Multiset.trop_inf
theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S → R) :
trop (s.inf f) = ∑ i ∈ s, trop (f i) := by
convert Multiset.trop_inf (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align finset.trop_inf Finset.trop_inf
theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S → WithTop R) :
trop (sInf (f '' s)) = ∑ i ∈ s, trop (f i) := by
rcases s.eq_empty_or_nonempty with (rfl | h)
· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top]
rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf]
#align trop_Inf_image trop_sInf_image
theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S → WithTop R) :
trop (⨅ i : S, f i) = ∑ i : S, trop (f i) := by
rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image]
#align trop_infi trop_iInf
| Mathlib/Algebra/Tropical/BigOperators.lean | 111 | 116 | theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) :
untrop s.sum = Multiset.inf (s.map untrop) := by |
induction' s using Multiset.induction with s x IH
· simp
· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH]
rfl
| [
" trop l.sum = (map trop l).prod",
" trop [].sum = (map trop []).prod",
" trop (hd :: tl).sum = (map trop (hd :: tl)).prod",
" ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod",
" trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)",
" ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod",
" ... | [
" trop l.sum = (map trop l).prod",
" trop [].sum = (map trop []).prod",
" trop (hd :: tl).sum = (map trop (hd :: tl)).prod",
" ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod",
" trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)",
" ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod",
" ... |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
open scoped Real
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin := by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuousOn_sin fun x hx => ?_
rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
#align strict_concave_on_sin_Icc strictConcaveOn_sin_Icc
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 174 | 177 | theorem strictConcaveOn_cos_Icc : StrictConcaveOn ℝ (Icc (-(π / 2)) (π / 2)) cos := by |
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuousOn_cos fun x hx => ?_
rw [interior_Icc] at hx
simp [cos_pos_of_mem_Ioo hx]
| [
" StrictConvexOn ℝ (Ici 0) fun x => x ^ n",
" StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))",
" StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)",
" 0 < ↑n",
" StrictConvexOn ℝ univ fun x => x ^ n",
" StrictMono (deriv fun a => a ^ n)",
" StrictMono fun x => ↑n * x ^ (n - 1)",
" 0 ≤ (if f x ≤... | [
" StrictConvexOn ℝ (Ici 0) fun x => x ^ n",
" StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))",
" StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)",
" 0 < ↑n",
" StrictConvexOn ℝ univ fun x => x ^ n",
" StrictMono (deriv fun a => a ^ n)",
" StrictMono fun x => ↑n * x ^ (n - 1)",
" 0 ≤ (if f x ≤... |
import Mathlib.Algebra.IsPrimePow
import Mathlib.Algebra.Squarefree.Basic
import Mathlib.Order.Hom.Bounded
import Mathlib.Algebra.GCDMonoid.Basic
#align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {M : Type*} [CancelCommMonoidWithZero M]
theorem Associates.isAtom_iff {p : Associates M} (h₁ : p ≠ 0) : IsAtom p ↔ Irreducible p :=
⟨fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h =>
(hp.le_iff.mp ⟨_, h⟩).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha =>
Or.inr
(show IsUnit b by
rw [ha] at h
apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) h₁)⟩,
fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1,
fun b ⟨⟨a, hab⟩, hb⟩ =>
(hp.isUnit_or_isUnit hab).casesOn
(fun hb => show b = ⊥ by rwa [Associates.isUnit_iff_eq_one, ← Associates.bot_eq_one] at hb)
fun ha =>
absurd
(show p ∣ b from
⟨(ha.unit⁻¹ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]⟩)
hb⟩⟩
#align associates.is_atom_iff Associates.isAtom_iff
open UniqueFactorizationMonoid multiplicity Irreducible Associates
namespace DivisorChain
| Mathlib/RingTheory/ChainOfDivisors.lean | 66 | 81 | theorem exists_chain_of_prime_pow {p : Associates M} {n : ℕ} (hn : n ≠ 0) (hp : Prime p) :
∃ c : Fin (n + 1) → Associates M,
c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ p ^ n ↔ ∃ i, r = c i := by |
refine ⟨fun i => p ^ (i : ℕ), ?_, fun n m h => ?_, @fun y => ⟨fun h => ?_, ?_⟩⟩
· dsimp only
rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one]
exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn)
· exact Associates.dvdNotUnit_iff_lt.mp
⟨pow_ne_zero n hp.ne_zero, p ^ (m - n : ℕ),
not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'),
(pow_mul_pow_sub p h.le).symm⟩
· obtain ⟨i, i_le, hi⟩ := (dvd_prime_pow hp n).1 h
rw [associated_iff_eq] at hi
exact ⟨⟨i, Nat.lt_succ_of_le i_le⟩, hi⟩
· rintro ⟨i, rfl⟩
exact ⟨p ^ (n - i : ℕ), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symm⟩
| [
" ¬IsUnit p",
" IsUnit b",
" Associated (p * b) p",
"M : Type u_1\ninst✝ : CancelCommMonoidWithZero M\np : Associates M\nh₁ : p ≠ 0\nhp : IsAtom p\na b : Associates M\nh : p = p * b\nha : a = p\n| p",
" p ≠ ⊥",
" b = ⊥",
" b = p * ↑ha.unit⁻¹",
" ∃ c, c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ ... | [
" ¬IsUnit p",
" IsUnit b",
" Associated (p * b) p",
"M : Type u_1\ninst✝ : CancelCommMonoidWithZero M\np : Associates M\nh₁ : p ≠ 0\nhp : IsAtom p\na b : Associates M\nh : p = p * b\nha : a = p\n| p",
" p ≠ ⊥",
" b = ⊥",
" b = p * ↑ha.unit⁻¹",
" ∃ c, c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ ... |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
| Mathlib/Algebra/Polynomial/Taylor.lean | 62 | 62 | theorem taylor_zero (f : R[X]) : taylor 0 f = f := by | rw [taylor_zero', LinearMap.id_apply]
| [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... | [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... |
import Mathlib.Algebra.MonoidAlgebra.Ideal
import Mathlib.Algebra.MvPolynomial.Division
#align_import ring_theory.mv_polynomial.ideal from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951"
variable {σ R : Type*}
namespace MvPolynomial
variable [CommSemiring R]
theorem mem_ideal_span_monomial_image {x : MvPolynomial σ R} {s : Set (σ →₀ ℕ)} :
x ∈ Ideal.span ((fun s => monomial s (1 : R)) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi := by
refine AddMonoidAlgebra.mem_ideal_span_of'_image.trans ?_
simp_rw [le_iff_exists_add, add_comm]
rfl
#align mv_polynomial.mem_ideal_span_monomial_image MvPolynomial.mem_ideal_span_monomial_image
| Mathlib/RingTheory/MvPolynomial/Ideal.lean | 39 | 43 | theorem mem_ideal_span_monomial_image_iff_dvd {x : MvPolynomial σ R} {s : Set (σ →₀ ℕ)} :
x ∈ Ideal.span ((fun s => monomial s (1 : R)) '' s) ↔
∀ xi ∈ x.support, ∃ si ∈ s, monomial si 1 ∣ monomial xi (x.coeff xi) := by |
refine mem_ideal_span_monomial_image.trans (forall₂_congr fun xi hxi => ?_)
simp_rw [monomial_dvd_monomial, one_dvd, and_true_iff, mem_support_iff.mp hxi, false_or_iff]
| [
" x ∈ Ideal.span ((fun s => (monomial s) 1) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d + m') ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = m' + d) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, ∃ c, xi = si + c",
" x ∈ Ideal.span ((fun s => (monomial... | [
" x ∈ Ideal.span ((fun s => (monomial s) 1) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d + m') ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = m' + d) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, ∃ c, xi = si + c",
" x ∈ Ideal.span ((fun s => (monomial... |
import Mathlib.Logic.Equiv.Fin
import Mathlib.Topology.DenseEmbedding
import Mathlib.Topology.Support
import Mathlib.Topology.Connected.LocallyConnected
#align_import topology.homeomorph from "leanprover-community/mathlib"@"4c3e1721c58ef9087bbc2c8c38b540f70eda2e53"
open Set Filter
open Topology
variable {X : Type*} {Y : Type*} {Z : Type*}
-- not all spaces are homeomorphic to each other
structure Homeomorph (X : Type*) (Y : Type*) [TopologicalSpace X] [TopologicalSpace Y]
extends X ≃ Y where
continuous_toFun : Continuous toFun := by continuity
continuous_invFun : Continuous invFun := by continuity
#align homeomorph Homeomorph
@[inherit_doc]
infixl:25 " ≃ₜ " => Homeomorph
namespace Homeomorph
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
{X' Y' : Type*} [TopologicalSpace X'] [TopologicalSpace Y']
theorem toEquiv_injective : Function.Injective (toEquiv : X ≃ₜ Y → X ≃ Y)
| ⟨_, _, _⟩, ⟨_, _, _⟩, rfl => rfl
#align homeomorph.to_equiv_injective Homeomorph.toEquiv_injective
instance : EquivLike (X ≃ₜ Y) X Y where
coe := fun h => h.toEquiv
inv := fun h => h.toEquiv.symm
left_inv := fun h => h.left_inv
right_inv := fun h => h.right_inv
coe_injective' := fun _ _ H _ => toEquiv_injective <| DFunLike.ext' H
instance : CoeFun (X ≃ₜ Y) fun _ ↦ X → Y := ⟨DFunLike.coe⟩
@[simp] theorem homeomorph_mk_coe (a : X ≃ Y) (b c) : (Homeomorph.mk a b c : X → Y) = a :=
rfl
#align homeomorph.homeomorph_mk_coe Homeomorph.homeomorph_mk_coe
protected def empty [IsEmpty X] [IsEmpty Y] : X ≃ₜ Y where
__ := Equiv.equivOfIsEmpty X Y
@[symm]
protected def symm (h : X ≃ₜ Y) : Y ≃ₜ X where
continuous_toFun := h.continuous_invFun
continuous_invFun := h.continuous_toFun
toEquiv := h.toEquiv.symm
#align homeomorph.symm Homeomorph.symm
@[simp] theorem symm_symm (h : X ≃ₜ Y) : h.symm.symm = h := rfl
#align homeomorph.symm_symm Homeomorph.symm_symm
theorem symm_bijective : Function.Bijective (Homeomorph.symm : (X ≃ₜ Y) → Y ≃ₜ X) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
def Simps.symm_apply (h : X ≃ₜ Y) : Y → X :=
h.symm
#align homeomorph.simps.symm_apply Homeomorph.Simps.symm_apply
initialize_simps_projections Homeomorph (toFun → apply, invFun → symm_apply)
@[simp]
theorem coe_toEquiv (h : X ≃ₜ Y) : ⇑h.toEquiv = h :=
rfl
#align homeomorph.coe_to_equiv Homeomorph.coe_toEquiv
@[simp]
theorem coe_symm_toEquiv (h : X ≃ₜ Y) : ⇑h.toEquiv.symm = h.symm :=
rfl
#align homeomorph.coe_symm_to_equiv Homeomorph.coe_symm_toEquiv
@[ext]
theorem ext {h h' : X ≃ₜ Y} (H : ∀ x, h x = h' x) : h = h' :=
DFunLike.ext _ _ H
#align homeomorph.ext Homeomorph.ext
@[simps! (config := .asFn) apply]
protected def refl (X : Type*) [TopologicalSpace X] : X ≃ₜ X where
continuous_toFun := continuous_id
continuous_invFun := continuous_id
toEquiv := Equiv.refl X
#align homeomorph.refl Homeomorph.refl
@[trans]
protected def trans (h₁ : X ≃ₜ Y) (h₂ : Y ≃ₜ Z) : X ≃ₜ Z where
continuous_toFun := h₂.continuous_toFun.comp h₁.continuous_toFun
continuous_invFun := h₁.continuous_invFun.comp h₂.continuous_invFun
toEquiv := Equiv.trans h₁.toEquiv h₂.toEquiv
#align homeomorph.trans Homeomorph.trans
@[simp]
theorem trans_apply (h₁ : X ≃ₜ Y) (h₂ : Y ≃ₜ Z) (x : X) : h₁.trans h₂ x = h₂ (h₁ x) :=
rfl
#align homeomorph.trans_apply Homeomorph.trans_apply
@[simp]
theorem symm_trans_apply (f : X ≃ₜ Y) (g : Y ≃ₜ Z) (z : Z) :
(f.trans g).symm z = f.symm (g.symm z) := rfl
@[simp]
theorem homeomorph_mk_coe_symm (a : X ≃ Y) (b c) :
((Homeomorph.mk a b c).symm : Y → X) = a.symm :=
rfl
#align homeomorph.homeomorph_mk_coe_symm Homeomorph.homeomorph_mk_coe_symm
@[simp]
theorem refl_symm : (Homeomorph.refl X).symm = Homeomorph.refl X :=
rfl
#align homeomorph.refl_symm Homeomorph.refl_symm
@[continuity]
protected theorem continuous (h : X ≃ₜ Y) : Continuous h :=
h.continuous_toFun
#align homeomorph.continuous Homeomorph.continuous
-- otherwise `by continuity` can't prove continuity of `h.to_equiv.symm`
@[continuity]
protected theorem continuous_symm (h : X ≃ₜ Y) : Continuous h.symm :=
h.continuous_invFun
#align homeomorph.continuous_symm Homeomorph.continuous_symm
@[simp]
theorem apply_symm_apply (h : X ≃ₜ Y) (y : Y) : h (h.symm y) = y :=
h.toEquiv.apply_symm_apply y
#align homeomorph.apply_symm_apply Homeomorph.apply_symm_apply
@[simp]
theorem symm_apply_apply (h : X ≃ₜ Y) (x : X) : h.symm (h x) = x :=
h.toEquiv.symm_apply_apply x
#align homeomorph.symm_apply_apply Homeomorph.symm_apply_apply
@[simp]
| Mathlib/Topology/Homeomorph.lean | 171 | 173 | theorem self_trans_symm (h : X ≃ₜ Y) : h.trans h.symm = Homeomorph.refl X := by |
ext
apply symm_apply_apply
| [
" h.trans h.symm = Homeomorph.refl X",
" (h.trans h.symm) x✝ = (Homeomorph.refl X) x✝"
] | [
" h.trans h.symm = Homeomorph.refl X"
] |
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
variable {R : Type*} [CommRing R] [IsDomain R]
section NormalizedGCDMonoid
variable [NormalizedGCDMonoid R]
def content (p : R[X]) : R :=
p.support.gcd p.coeff
#align polynomial.content Polynomial.content
theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by
by_cases h : n ∈ p.support
· apply Finset.gcd_dvd h
rw [mem_support_iff, Classical.not_not] at h
rw [h]
apply dvd_zero
#align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff
@[simp]
theorem content_C {r : R} : (C r).content = normalize r := by
rw [content]
by_cases h0 : r = 0
· simp [h0]
have h : (C r).support = {0} := support_monomial _ h0
simp [h]
set_option linter.uppercaseLean3 false in
#align polynomial.content_C Polynomial.content_C
@[simp]
| Mathlib/RingTheory/Polynomial/Content.lean | 102 | 102 | theorem content_zero : content (0 : R[X]) = 0 := by | rw [← C_0, content_C, normalize_zero]
| [
" p.content ∣ p.coeff n",
" p.content ∣ 0",
" (C r).content = normalize r",
" (C r).support.gcd (C r).coeff = normalize r",
" content 0 = 0"
] | [
" p.content ∣ p.coeff n",
" p.content ∣ 0",
" (C r).content = normalize r",
" (C r).support.gcd (C r).coeff = normalize r",
" content 0 = 0"
] |
import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.CategoryTheory.Limits.HasLimits
import Mathlib.CategoryTheory.Limits.Types
#align_import category_theory.limits.filtered from "leanprover-community/mathlib"@"e4ee4e30418efcb8cf304ba76ad653aeec04ba6e"
universe w' w v u
noncomputable section
open CategoryTheory
variable {C : Type u} [Category.{v} C]
namespace CategoryTheory
section NonemptyLimit
open CategoryTheory.Limits Opposite
theorem IsFiltered.iff_nonempty_limit : IsFiltered C ↔
∀ {J : Type v} [SmallCategory J] [FinCategory J] (F : J ⥤ C),
∃ (X : C), Nonempty (limit (F.op ⋙ yoneda.obj X)) := by
rw [IsFiltered.iff_cocone_nonempty.{v}]
refine ⟨fun h J _ _ F => ?_, fun h J _ _ F => ?_⟩
· obtain ⟨c⟩ := h F
exact ⟨c.pt, ⟨(limitCompYonedaIsoCocone F c.pt).inv c.ι⟩⟩
· obtain ⟨pt, ⟨ι⟩⟩ := h F
exact ⟨⟨pt, (limitCompYonedaIsoCocone F pt).hom ι⟩⟩
| Mathlib/CategoryTheory/Limits/Filtered.lean | 52 | 60 | theorem IsCofiltered.iff_nonempty_limit : IsCofiltered C ↔
∀ {J : Type v} [SmallCategory J] [FinCategory J] (F : J ⥤ C),
∃ (X : C), Nonempty (limit (F ⋙ coyoneda.obj (op X))) := by |
rw [IsCofiltered.iff_cone_nonempty.{v}]
refine ⟨fun h J _ _ F => ?_, fun h J _ _ F => ?_⟩
· obtain ⟨c⟩ := h F
exact ⟨c.pt, ⟨(limitCompCoyonedaIsoCone F c.pt).inv c.π⟩⟩
· obtain ⟨pt, ⟨π⟩⟩ := h F
exact ⟨⟨pt, (limitCompCoyonedaIsoCone F pt).hom π⟩⟩
| [
" IsFiltered C ↔\n ∀ {J : Type v} [inst : SmallCategory J] [inst_1 : FinCategory J] (F : J ⥤ C),\n ∃ X, Nonempty (limit (F.op ⋙ yoneda.obj X))",
" (∀ {J : Type v} [inst : SmallCategory J] [inst_1 : FinCategory J] (F : J ⥤ C), Nonempty (Cocone F)) ↔\n ∀ {J : Type v} [inst : SmallCategory J] [inst_1 : Fi... | [
" IsFiltered C ↔\n ∀ {J : Type v} [inst : SmallCategory J] [inst_1 : FinCategory J] (F : J ⥤ C),\n ∃ X, Nonempty (limit (F.op ⋙ yoneda.obj X))",
" (∀ {J : Type v} [inst : SmallCategory J] [inst_1 : FinCategory J] (F : J ⥤ C), Nonempty (Cocone F)) ↔\n ∀ {J : Type v} [inst : SmallCategory J] [inst_1 : Fi... |
import Mathlib.Algebra.Order.AbsoluteValue
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
import Mathlib.Algebra.Ring.Pi
import Mathlib.GroupTheory.GroupAction.Pi
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.Init.Align
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Ring
#align_import data.real.cau_seq from "leanprover-community/mathlib"@"9116dd6709f303dcf781632e15fdef382b0fc579"
assert_not_exists Finset
assert_not_exists Module
assert_not_exists Submonoid
assert_not_exists FloorRing
variable {α β : Type*}
open IsAbsoluteValue
section
variable [LinearOrderedField α] [Ring β] (abv : β → α) [IsAbsoluteValue abv]
theorem rat_add_continuous_lemma {ε : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ →
abv (a₁ + a₂ - (b₁ + b₂)) < ε :=
⟨ε / 2, half_pos ε0, fun {a₁ a₂ b₁ b₂} h₁ h₂ => by
simpa [add_halves, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using
lt_of_le_of_lt (abv_add abv _ _) (add_lt_add h₁ h₂)⟩
#align rat_add_continuous_lemma rat_add_continuous_lemma
theorem rat_mul_continuous_lemma {ε K₁ K₂ : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ →
abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε := by
have K0 : (0 : α) < max 1 (max K₁ K₂) := lt_of_lt_of_le zero_lt_one (le_max_left _ _)
have εK := div_pos (half_pos ε0) K0
refine ⟨_, εK, fun {a₁ a₂ b₁ b₂} ha₁ hb₂ h₁ h₂ => ?_⟩
replace ha₁ := lt_of_lt_of_le ha₁ (le_trans (le_max_left _ K₂) (le_max_right 1 _))
replace hb₂ := lt_of_lt_of_le hb₂ (le_trans (le_max_right K₁ _) (le_max_right 1 _))
set M := max 1 (max K₁ K₂)
have : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M := by
gcongr
rw [← abv_mul abv, mul_comm, div_mul_cancel₀ _ (ne_of_gt K0), ← abv_mul abv, add_halves] at this
simpa [sub_eq_add_neg, mul_add, add_mul, add_left_comm] using
lt_of_le_of_lt (abv_add abv _ _) this
#align rat_mul_continuous_lemma rat_mul_continuous_lemma
| Mathlib/Algebra/Order/CauSeq/Basic.lean | 74 | 85 | theorem rat_inv_continuous_lemma {β : Type*} [DivisionRing β] (abv : β → α) [IsAbsoluteValue abv]
{ε K : α} (ε0 : 0 < ε) (K0 : 0 < K) :
∃ δ > 0, ∀ {a b : β}, K ≤ abv a → K ≤ abv b → abv (a - b) < δ → abv (a⁻¹ - b⁻¹) < ε := by |
refine ⟨K * ε * K, mul_pos (mul_pos K0 ε0) K0, fun {a b} ha hb h => ?_⟩
have a0 := K0.trans_le ha
have b0 := K0.trans_le hb
rw [inv_sub_inv' ((abv_pos abv).1 a0) ((abv_pos abv).1 b0), abv_mul abv, abv_mul abv, abv_inv abv,
abv_inv abv, abv_sub abv]
refine lt_of_mul_lt_mul_left (lt_of_mul_lt_mul_right ?_ b0.le) a0.le
rw [mul_assoc, inv_mul_cancel_right₀ b0.ne', ← mul_assoc, mul_inv_cancel a0.ne', one_mul]
refine h.trans_le ?_
gcongr
| [
" abv (a₁ + a₂ - (b₁ + b₂)) < ε",
" ∃ δ > 0,\n ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M",
" ∃ δ > 0, ∀ {a b : β},... | [
" abv (a₁ + a₂ - (b₁ + b₂)) < ε",
" ∃ δ > 0,\n ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M",
" ∃ δ > 0, ∀ {a b : β},... |
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Algebra.GCDMonoid.Nat
#align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
namespace Int
| Mathlib/RingTheory/Int/Basic.lean | 33 | 46 | theorem gcd_eq_one_iff_coprime {a b : ℤ} : Int.gcd a b = 1 ↔ IsCoprime a b := by |
constructor
· intro hg
obtain ⟨ua, -, ha⟩ := exists_unit_of_abs a
obtain ⟨ub, -, hb⟩ := exists_unit_of_abs b
use Nat.gcdA (Int.natAbs a) (Int.natAbs b) * ua, Nat.gcdB (Int.natAbs a) (Int.natAbs b) * ub
rw [mul_assoc, ← ha, mul_assoc, ← hb, mul_comm, mul_comm _ (Int.natAbs b : ℤ), ←
Nat.gcd_eq_gcd_ab, ← gcd_eq_natAbs, hg, Int.ofNat_one]
· rintro ⟨r, s, h⟩
by_contra hg
obtain ⟨p, ⟨hp, ha, hb⟩⟩ := Nat.Prime.not_coprime_iff_dvd.mp hg
apply Nat.Prime.not_dvd_one hp
rw [← natCast_dvd_natCast, Int.ofNat_one, ← h]
exact dvd_add ((natCast_dvd.mpr ha).mul_left _) ((natCast_dvd.mpr hb).mul_left _)
| [
" a.gcd b = 1 ↔ IsCoprime a b",
" a.gcd b = 1 → IsCoprime a b",
" IsCoprime a b",
" a.natAbs.gcdA b.natAbs * ua * a + a.natAbs.gcdB b.natAbs * ub * b = 1",
" IsCoprime a b → a.gcd b = 1",
" a.gcd b = 1",
" False",
" p ∣ 1",
" ↑p ∣ r * a + s * b"
] | [
" a.gcd b = 1 ↔ IsCoprime a b"
] |
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Algebra.Subalgebra.Prod
import Mathlib.Algebra.Algebra.Subalgebra.Tower
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Prod
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.Prod
#align_import ring_theory.adjoin.basic from "leanprover-community/mathlib"@"a35ddf20601f85f78cd57e7f5b09ed528d71b7af"
universe uR uS uA uB
open Pointwise
open Submodule Subsemiring
variable {R : Type uR} {S : Type uS} {A : Type uA} {B : Type uB}
namespace Algebra
section Semiring
variable [CommSemiring R] [CommSemiring S] [Semiring A] [Semiring B]
variable [Algebra R S] [Algebra R A] [Algebra S A] [Algebra R B] [IsScalarTower R S A]
variable {s t : Set A}
@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_adjoin : s ⊆ adjoin R s :=
Algebra.gc.le_u_l s
#align algebra.subset_adjoin Algebra.subset_adjoin
theorem adjoin_le {S : Subalgebra R A} (H : s ⊆ S) : adjoin R s ≤ S :=
Algebra.gc.l_le H
#align algebra.adjoin_le Algebra.adjoin_le
theorem adjoin_eq_sInf : adjoin R s = sInf { p : Subalgebra R A | s ⊆ p } :=
le_antisymm (le_sInf fun _ h => adjoin_le h) (sInf_le subset_adjoin)
#align algebra.adjoin_eq_Inf Algebra.adjoin_eq_sInf
theorem adjoin_le_iff {S : Subalgebra R A} : adjoin R s ≤ S ↔ s ⊆ S :=
Algebra.gc _ _
#align algebra.adjoin_le_iff Algebra.adjoin_le_iff
theorem adjoin_mono (H : s ⊆ t) : adjoin R s ≤ adjoin R t :=
Algebra.gc.monotone_l H
#align algebra.adjoin_mono Algebra.adjoin_mono
theorem adjoin_eq_of_le (S : Subalgebra R A) (h₁ : s ⊆ S) (h₂ : S ≤ adjoin R s) : adjoin R s = S :=
le_antisymm (adjoin_le h₁) h₂
#align algebra.adjoin_eq_of_le Algebra.adjoin_eq_of_le
theorem adjoin_eq (S : Subalgebra R A) : adjoin R ↑S = S :=
adjoin_eq_of_le _ (Set.Subset.refl _) subset_adjoin
#align algebra.adjoin_eq Algebra.adjoin_eq
theorem adjoin_iUnion {α : Type*} (s : α → Set A) :
adjoin R (Set.iUnion s) = ⨆ i : α, adjoin R (s i) :=
(@Algebra.gc R A _ _ _).l_iSup
#align algebra.adjoin_Union Algebra.adjoin_iUnion
theorem adjoin_attach_biUnion [DecidableEq A] {α : Type*} {s : Finset α} (f : s → Finset A) :
adjoin R (s.attach.biUnion f : Set A) = ⨆ x, adjoin R (f x) := by simp [adjoin_iUnion]
#align algebra.adjoin_attach_bUnion Algebra.adjoin_attach_biUnion
@[elab_as_elim]
theorem adjoin_induction {p : A → Prop} {x : A} (h : x ∈ adjoin R s) (mem : ∀ x ∈ s, p x)
(algebraMap : ∀ r, p (algebraMap R A r)) (add : ∀ x y, p x → p y → p (x + y))
(mul : ∀ x y, p x → p y → p (x * y)) : p x :=
let S : Subalgebra R A :=
{ carrier := p
mul_mem' := mul _ _
add_mem' := add _ _
algebraMap_mem' := algebraMap }
adjoin_le (show s ≤ S from mem) h
#align algebra.adjoin_induction Algebra.adjoin_induction
@[elab_as_elim]
| Mathlib/RingTheory/Adjoin/Basic.lean | 99 | 113 | theorem adjoin_induction₂ {p : A → A → Prop} {a b : A} (ha : a ∈ adjoin R s) (hb : b ∈ adjoin R s)
(Hs : ∀ x ∈ s, ∀ y ∈ s, p x y) (Halg : ∀ r₁ r₂, p (algebraMap R A r₁) (algebraMap R A r₂))
(Halg_left : ∀ (r), ∀ x ∈ s, p (algebraMap R A r) x)
(Halg_right : ∀ (r), ∀ x ∈ s, p x (algebraMap R A r))
(Hadd_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ + x₂) y)
(Hadd_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ + y₂))
(Hmul_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ * x₂) y)
(Hmul_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ * y₂)) : p a b := by |
refine adjoin_induction hb ?_ (fun r => ?_) (Hadd_right a) (Hmul_right a)
· exact adjoin_induction ha Hs Halg_left
(fun x y Hx Hy z hz => Hadd_left x y z (Hx z hz) (Hy z hz))
fun x y Hx Hy z hz => Hmul_left x y z (Hx z hz) (Hy z hz)
· exact adjoin_induction ha (Halg_right r) (fun r' => Halg r' r)
(fun x y => Hadd_left x y ((algebraMap R A) r))
fun x y => Hmul_left x y ((algebraMap R A) r)
| [
" adjoin R ↑(s.attach.biUnion f) = ⨆ x, adjoin R ↑(f x)",
" p a b",
" ∀ x ∈ s, p a x",
" p a ((algebraMap R A) r)"
] | [
" adjoin R ↑(s.attach.biUnion f) = ⨆ x, adjoin R ↑(f x)",
" p a b"
] |
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.LinearAlgebra.Span
#align_import linear_algebra.quotient from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
-- For most of this file we work over a noncommutative ring
section Ring
namespace Submodule
variable {R M : Type*} {r : R} {x y : M} [Ring R] [AddCommGroup M] [Module R M]
variable (p p' : Submodule R M)
open LinearMap QuotientAddGroup
def quotientRel : Setoid M :=
QuotientAddGroup.leftRel p.toAddSubgroup
#align submodule.quotient_rel Submodule.quotientRel
theorem quotientRel_r_def {x y : M} : @Setoid.r _ p.quotientRel x y ↔ x - y ∈ p :=
Iff.trans
(by
rw [leftRel_apply, sub_eq_add_neg, neg_add, neg_neg]
rfl)
neg_mem_iff
#align submodule.quotient_rel_r_def Submodule.quotientRel_r_def
instance hasQuotient : HasQuotient M (Submodule R M) :=
⟨fun p => Quotient (quotientRel p)⟩
#align submodule.has_quotient Submodule.hasQuotient
namespace Quotient
def mk {p : Submodule R M} : M → M ⧸ p :=
Quotient.mk''
#align submodule.quotient.mk Submodule.Quotient.mk
@[simp]
theorem mk'_eq_mk' {p : Submodule R M} (x : M) :
@Quotient.mk' _ (quotientRel p) x = (mk : M → M ⧸ p) x :=
rfl
#align submodule.quotient.mk_eq_mk Submodule.Quotient.mk'_eq_mk'
@[simp]
theorem mk''_eq_mk {p : Submodule R M} (x : M) : (Quotient.mk'' x : M ⧸ p) = (mk : M → M ⧸ p) x :=
rfl
#align submodule.quotient.mk'_eq_mk Submodule.Quotient.mk''_eq_mk
@[simp]
theorem quot_mk_eq_mk {p : Submodule R M} (x : M) : (Quot.mk _ x : M ⧸ p) = (mk : M → M ⧸ p) x :=
rfl
#align submodule.quotient.quot_mk_eq_mk Submodule.Quotient.quot_mk_eq_mk
protected theorem eq' {x y : M} : (mk x : M ⧸ p) = (mk : M → M ⧸ p) y ↔ -x + y ∈ p :=
QuotientAddGroup.eq
#align submodule.quotient.eq' Submodule.Quotient.eq'
protected theorem eq {x y : M} : (mk x : M ⧸ p) = (mk y : M ⧸ p) ↔ x - y ∈ p :=
(Submodule.Quotient.eq' p).trans (leftRel_apply.symm.trans p.quotientRel_r_def)
#align submodule.quotient.eq Submodule.Quotient.eq
instance : Zero (M ⧸ p) where
-- Use Quotient.mk'' instead of mk here because mk is not reducible.
-- This would lead to non-defeq diamonds.
-- See also the same comment at the One instance for Con.
zero := Quotient.mk'' 0
instance : Inhabited (M ⧸ p) :=
⟨0⟩
@[simp]
theorem mk_zero : mk 0 = (0 : M ⧸ p) :=
rfl
#align submodule.quotient.mk_zero Submodule.Quotient.mk_zero
@[simp]
theorem mk_eq_zero : (mk x : M ⧸ p) = 0 ↔ x ∈ p := by simpa using (Quotient.eq' p : mk x = 0 ↔ _)
#align submodule.quotient.mk_eq_zero Submodule.Quotient.mk_eq_zero
instance addCommGroup : AddCommGroup (M ⧸ p) :=
QuotientAddGroup.Quotient.addCommGroup p.toAddSubgroup
#align submodule.quotient.add_comm_group Submodule.Quotient.addCommGroup
@[simp]
theorem mk_add : (mk (x + y) : M ⧸ p) = (mk x : M ⧸ p) + (mk y : M ⧸ p) :=
rfl
#align submodule.quotient.mk_add Submodule.Quotient.mk_add
@[simp]
theorem mk_neg : (mk (-x) : M ⧸ p) = -(mk x : M ⧸ p) :=
rfl
#align submodule.quotient.mk_neg Submodule.Quotient.mk_neg
@[simp]
theorem mk_sub : (mk (x - y) : M ⧸ p) = (mk x : M ⧸ p) - (mk y : M ⧸ p) :=
rfl
#align submodule.quotient.mk_sub Submodule.Quotient.mk_sub
theorem mk_surjective : Function.Surjective (@mk _ _ _ _ _ p) := by
rintro ⟨x⟩
exact ⟨x, rfl⟩
#align submodule.quotient.mk_surjective Submodule.Quotient.mk_surjective
| Mathlib/LinearAlgebra/Quotient.lean | 262 | 265 | theorem nontrivial_of_lt_top (h : p < ⊤) : Nontrivial (M ⧸ p) := by |
obtain ⟨x, _, not_mem_s⟩ := SetLike.exists_of_lt h
refine ⟨⟨mk x, 0, ?_⟩⟩
simpa using not_mem_s
| [
" Setoid.r x y ↔ -(x - y) ∈ p",
" -x + y ∈ p.toAddSubgroup ↔ -x + y ∈ p",
" mk x = 0 ↔ x ∈ p",
" Function.Surjective mk",
" ∃ a, mk a = Quot.mk Setoid.r x",
" Nontrivial (M ⧸ p)",
" mk x ≠ 0"
] | [
" Setoid.r x y ↔ -(x - y) ∈ p",
" -x + y ∈ p.toAddSubgroup ↔ -x + y ∈ p",
" mk x = 0 ↔ x ∈ p",
" Function.Surjective mk",
" ∃ a, mk a = Quot.mk Setoid.r x",
" Nontrivial (M ⧸ p)"
] |
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.MeasureTheory.Measure.MeasureSpaceDef
#align_import measure_theory.function.ae_measurable_sequence from "leanprover-community/mathlib"@"d003c55042c3cd08aefd1ae9a42ef89441cdaaf3"
open MeasureTheory
open scoped Classical
variable {ι : Sort*} {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace β] {f : ι → α → β}
{μ : Measure α} {p : α → (ι → β) → Prop}
def aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : Set α :=
(toMeasurable μ { x | (∀ i, f i x = (hf i).mk (f i) x) ∧ p x fun n => f n x }ᶜ)ᶜ
#align ae_seq_set aeSeqSet
noncomputable def aeSeq (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : ι → α → β :=
fun i x => ite (x ∈ aeSeqSet hf p) ((hf i).mk (f i) x) (⟨f i x⟩ : Nonempty β).some
#align ae_seq aeSeq
namespace aeSeq
section MemAESeqSet
theorem mk_eq_fun_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α} (hx : x ∈ aeSeqSet hf p)
(i : ι) : (hf i).mk (f i) x = f i x :=
haveI h_ss : aeSeqSet hf p ⊆ { x | ∀ i, f i x = (hf i).mk (f i) x } := by
rw [aeSeqSet, ← compl_compl { x | ∀ i, f i x = (hf i).mk (f i) x }, Set.compl_subset_compl]
refine Set.Subset.trans (Set.compl_subset_compl.mpr fun x h => ?_) (subset_toMeasurable _ _)
exact h.1
(h_ss hx i).symm
#align ae_seq.mk_eq_fun_of_mem_ae_seq_set aeSeq.mk_eq_fun_of_mem_aeSeqSet
theorem aeSeq_eq_mk_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α}
(hx : x ∈ aeSeqSet hf p) (i : ι) : aeSeq hf p i x = (hf i).mk (f i) x := by
simp only [aeSeq, hx, if_true]
#align ae_seq.ae_seq_eq_mk_of_mem_ae_seq_set aeSeq.aeSeq_eq_mk_of_mem_aeSeqSet
theorem aeSeq_eq_fun_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α}
(hx : x ∈ aeSeqSet hf p) (i : ι) : aeSeq hf p i x = f i x := by
simp only [aeSeq_eq_mk_of_mem_aeSeqSet hf hx i, mk_eq_fun_of_mem_aeSeqSet hf hx i]
#align ae_seq.ae_seq_eq_fun_of_mem_ae_seq_set aeSeq.aeSeq_eq_fun_of_mem_aeSeqSet
| Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean | 69 | 78 | theorem prop_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α} (hx : x ∈ aeSeqSet hf p) :
p x fun n => aeSeq hf p n x := by |
simp only [aeSeq, hx, if_true]
rw [funext fun n => mk_eq_fun_of_mem_aeSeqSet hf hx n]
have h_ss : aeSeqSet hf p ⊆ { x | p x fun n => f n x } := by
rw [← compl_compl { x | p x fun n => f n x }, aeSeqSet, Set.compl_subset_compl]
refine Set.Subset.trans (Set.compl_subset_compl.mpr ?_) (subset_toMeasurable _ _)
exact fun x hx => hx.2
have hx' := Set.mem_of_subset_of_mem h_ss hx
exact hx'
| [
" aeSeqSet hf p ⊆ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}",
" {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}ᶜ ⊆\n toMeasurable μ {x | (∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x) ∧ p x fun n => f n x}ᶜ",
" x ∈ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}",
" aeSeq hf p i x = AEMeasur... | [
" aeSeqSet hf p ⊆ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}",
" {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}ᶜ ⊆\n toMeasurable μ {x | (∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x) ∧ p x fun n => f n x}ᶜ",
" x ∈ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}",
" aeSeq hf p i x = AEMeasur... |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.RingTheory.Coprime.Basic
import Mathlib.Tactic.AdaptationNote
#align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727"
variable {R S A K : Type*}
namespace Polynomial
open Polynomial
section Semiring
variable [Semiring R] [Semiring S]
noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] :=
∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i))
#align polynomial.scale_roots Polynomial.scaleRoots
@[simp]
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) :
(scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
#align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots
theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) :
(scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by
rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one]
#align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree
@[simp]
theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by
ext
simp
#align polynomial.zero_scale_roots Polynomial.zero_scaleRoots
theorem scaleRoots_ne_zero {p : R[X]} (hp : p ≠ 0) (s : R) : scaleRoots p s ≠ 0 := by
intro h
have : p.coeff p.natDegree ≠ 0 := mt leadingCoeff_eq_zero.mp hp
have : (scaleRoots p s).coeff p.natDegree = 0 :=
congr_fun (congr_arg (coeff : R[X] → ℕ → R) h) p.natDegree
rw [coeff_scaleRoots_natDegree] at this
contradiction
#align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero
theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≤ p.support := by
intro
simpa using left_ne_zero_of_mul
#align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le
theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) :
(scaleRoots p s).support = p.support :=
le_antisymm (support_scaleRoots_le p s)
(by intro i
simp only [coeff_scaleRoots, Polynomial.mem_support_iff]
intro p_ne_zero ps_zero
have := pow_mem hs (p.natDegree - i) _ ps_zero
contradiction)
#align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq
@[simp]
| Mathlib/RingTheory/Polynomial/ScaleRoots.lean | 78 | 86 | theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by |
haveI := Classical.propDecidable
by_cases hp : p = 0
· rw [hp, zero_scaleRoots]
refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_)
rw [coeff_scaleRoots_natDegree]
intro h
have := leadingCoeff_eq_zero.mp h
contradiction
| [
" (p.scaleRoots s).coeff i = p.coeff i * s ^ (p.natDegree - i)",
" (p.scaleRoots s).coeff p.natDegree = p.leadingCoeff",
" scaleRoots 0 s = 0",
" (scaleRoots 0 s).coeff n✝ = coeff 0 n✝",
" p.scaleRoots s ≠ 0",
" False",
" (p.scaleRoots s).support ≤ p.support",
" a✝ ∈ (p.scaleRoots s).support → a✝ ∈ p.... | [
" (p.scaleRoots s).coeff i = p.coeff i * s ^ (p.natDegree - i)",
" (p.scaleRoots s).coeff p.natDegree = p.leadingCoeff",
" scaleRoots 0 s = 0",
" (scaleRoots 0 s).coeff n✝ = coeff 0 n✝",
" p.scaleRoots s ≠ 0",
" False",
" (p.scaleRoots s).support ≤ p.support",
" a✝ ∈ (p.scaleRoots s).support → a✝ ∈ p.... |
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Integral.PeakFunction
#align_import analysis.special_functions.trigonometric.euler_sine_prod from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open scoped Real Topology
open Real Set Filter intervalIntegral MeasureTheory.MeasureSpace
namespace EulerSine
section IntegralRecursion
variable {z : ℂ} {n : ℕ}
| Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean | 39 | 46 | theorem antideriv_cos_comp_const_mul (hz : z ≠ 0) (x : ℝ) :
HasDerivAt (fun y : ℝ => Complex.sin (2 * z * y) / (2 * z)) (Complex.cos (2 * z * x)) x := by |
have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _
have b : HasDerivAt (fun y : ℂ => Complex.sin (y * (2 * z))) _ x :=
HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_sin (x * (2 * z))) a
have c := b.comp_ofReal.div_const (2 * z)
field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c
exact c
| [
" HasDerivAt (fun y => (2 * z * ↑y).sin / (2 * z)) (2 * z * ↑x).cos x"
] | [
" HasDerivAt (fun y => (2 * z * ↑y).sin / (2 * z)) (2 * z * ↑x).cos x"
] |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Data.Nat.Factorial.Basic
import Mathlib.LinearAlgebra.Vandermonde
import Mathlib.RingTheory.Polynomial.Pochhammer
namespace Nat
def superFactorial : ℕ → ℕ
| 0 => 1
| succ n => factorial n.succ * superFactorial n
scoped notation "sf" n:60 => Nat.superFactorial n
section SuperFactorial
variable {n : ℕ}
@[simp]
theorem superFactorial_zero : sf 0 = 1 :=
rfl
theorem superFactorial_succ (n : ℕ) : (sf n.succ) = (n + 1)! * sf n :=
rfl
@[simp]
theorem superFactorial_one : sf 1 = 1 :=
rfl
@[simp]
theorem superFactorial_two : sf 2 = 2 :=
rfl
open Finset
@[simp]
theorem prod_Icc_factorial : ∀ n : ℕ, ∏ x ∈ Icc 1 n, x ! = sf n
| 0 => rfl
| n + 1 => by
rw [← Ico_succ_right 1 n.succ, prod_Ico_succ_top <| Nat.succ_le_succ <| Nat.zero_le n,
Nat.factorial_succ, Ico_succ_right 1 n, prod_Icc_factorial n, superFactorial, factorial,
Nat.succ_eq_add_one, mul_comm]
@[simp]
theorem prod_range_factorial_succ (n : ℕ) : ∏ x ∈ range n, (x + 1)! = sf n :=
(prod_Icc_factorial n) ▸ range_eq_Ico ▸ Finset.prod_Ico_add' _ _ _ _
@[simp]
theorem prod_range_succ_factorial : ∀ n : ℕ, ∏ x ∈ range (n + 1), x ! = sf n
| 0 => rfl
| n + 1 => by
rw [prod_range_succ, prod_range_succ_factorial n, mul_comm, superFactorial]
variable {R : Type*} [CommRing R]
theorem det_vandermonde_id_eq_superFactorial (n : ℕ) :
(Matrix.vandermonde (fun (i : Fin (n + 1)) ↦ (i : R))).det = Nat.superFactorial n := by
induction' n with n hn
· simp [Matrix.det_vandermonde]
· rw [Nat.superFactorial, Matrix.det_vandermonde, Fin.prod_univ_succAbove _ 0]
push_cast
congr
· simp only [Fin.val_zero, Nat.cast_zero, sub_zero]
norm_cast
simp [Fin.prod_univ_eq_prod_range (fun i ↦ (↑i + 1)) (n + 1)]
· rw [Matrix.det_vandermonde] at hn
simp [hn]
theorem superFactorial_two_mul : ∀ n : ℕ,
sf (2 * n) = (∏ i ∈ range n, (2 * i + 1) !) ^ 2 * 2 ^ n * n !
| 0 => rfl
| (n + 1) => by
simp only [prod_range_succ, mul_pow, mul_add, mul_one, superFactorial_succ,
superFactorial_two_mul n, factorial_succ]
ring
theorem superFactorial_four_mul (n : ℕ) :
sf (4 * n) = ((∏ i ∈ range (2 * n), (2 * i + 1) !) * 2 ^ n) ^ 2 * (2 * n) ! :=
calc
sf (4 * n) = (∏ i ∈ range (2 * n), (2 * i + 1) !) ^ 2 * 2 ^ (2 * n) * (2 * n) ! := by
rw [← superFactorial_two_mul, ← mul_assoc, Nat.mul_two]
_ = ((∏ i ∈ range (2 * n), (2 * i + 1) !) * 2 ^ n) ^ 2 * (2 * n) ! := by
rw [pow_mul', mul_pow]
private theorem matrixOf_eval_descPochhammer_eq_mul_matrixOf_choose {n : ℕ} (v : Fin n → ℕ) :
(Matrix.of (fun (i j : Fin n) => (descPochhammer ℤ j).eval (v i : ℤ))).det =
(∏ i : Fin n, Nat.factorial i) *
(Matrix.of (fun (i j : Fin n) => (Nat.choose (v i) (j : ℕ) : ℤ))).det := by
convert Matrix.det_mul_row (fun (i : Fin n) => ((Nat.factorial (i : ℕ)):ℤ)) _
· rw [Matrix.of_apply, descPochhammer_eval_eq_descFactorial ℤ _ _]
congr
exact Nat.descFactorial_eq_factorial_mul_choose _ _
· rw [Nat.cast_prod]
| Mathlib/Data/Nat/Factorial/SuperFactorial.lean | 114 | 125 | theorem superFactorial_dvd_vandermonde_det {n : ℕ} (v : Fin (n + 1) → ℤ) :
↑(Nat.superFactorial n) ∣ (Matrix.vandermonde v).det := by |
let m := inf' univ ⟨0, mem_univ _⟩ v
let w' := fun i ↦ (v i - m).toNat
have hw' : ∀ i, (w' i : ℤ) = v i - m := fun i ↦ Int.toNat_sub_of_le (inf'_le _ (mem_univ _))
have h := Matrix.det_eval_matrixOfPolynomials_eq_det_vandermonde (fun i ↦ ↑(w' i))
(fun i => descPochhammer ℤ i)
(fun i => descPochhammer_natDegree ℤ i)
(fun i => monic_descPochhammer ℤ i)
conv_lhs at h => simp only [hw', Matrix.det_vandermonde_sub]
use (Matrix.of (fun (i j : Fin (n + 1)) => (Nat.choose (w' i) (j : ℕ) : ℤ))).det
simp [h, matrixOf_eval_descPochhammer_eq_mul_matrixOf_choose w', Fin.prod_univ_eq_prod_range]
| [
" ∏ x ∈ Icc 1 (n + 1), x ! = sf n + 1",
" ∏ x ∈ range (n + 1 + 1), x ! = sf n + 1",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf n)",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf 0)",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf n + 1)",
" (∏ j ∈ Ioi 0, (↑↑j - ↑↑0)) * ∏ i : Fin (n + 1), ∏ j ∈ Ioi (F... | [
" ∏ x ∈ Icc 1 (n + 1), x ! = sf n + 1",
" ∏ x ∈ range (n + 1 + 1), x ! = sf n + 1",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf n)",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf 0)",
" (Matrix.vandermonde fun i => ↑↑i).det = ↑(sf n + 1)",
" (∏ j ∈ Ioi 0, (↑↑j - ↑↑0)) * ∏ i : Fin (n + 1), ∏ j ∈ Ioi (F... |
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
section Semiring
variable [Semiring α]
theorem geom_sum_succ {x : α} {n : ℕ} :
∑ i ∈ range (n + 1), x ^ i = (x * ∑ i ∈ range n, x ^ i) + 1 := by
simp only [mul_sum, ← pow_succ', sum_range_succ', pow_zero]
#align geom_sum_succ geom_sum_succ
theorem geom_sum_succ' {x : α} {n : ℕ} :
∑ i ∈ range (n + 1), x ^ i = x ^ n + ∑ i ∈ range n, x ^ i :=
(sum_range_succ _ _).trans (add_comm _ _)
#align geom_sum_succ' geom_sum_succ'
theorem geom_sum_zero (x : α) : ∑ i ∈ range 0, x ^ i = 0 :=
rfl
#align geom_sum_zero geom_sum_zero
theorem geom_sum_one (x : α) : ∑ i ∈ range 1, x ^ i = 1 := by simp [geom_sum_succ']
#align geom_sum_one geom_sum_one
@[simp]
theorem geom_sum_two {x : α} : ∑ i ∈ range 2, x ^ i = x + 1 := by simp [geom_sum_succ']
#align geom_sum_two geom_sum_two
@[simp]
theorem zero_geom_sum : ∀ {n}, ∑ i ∈ range n, (0 : α) ^ i = if n = 0 then 0 else 1
| 0 => by simp
| 1 => by simp
| n + 2 => by
rw [geom_sum_succ']
simp [zero_geom_sum]
#align zero_geom_sum zero_geom_sum
theorem one_geom_sum (n : ℕ) : ∑ i ∈ range n, (1 : α) ^ i = n := by simp
#align one_geom_sum one_geom_sum
-- porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Algebra/GeomSum.lean | 81 | 82 | theorem op_geom_sum (x : α) (n : ℕ) : op (∑ i ∈ range n, x ^ i) = ∑ i ∈ range n, op x ^ i := by |
simp
| [
" ∑ i ∈ range (n + 1), x ^ i = x * ∑ i ∈ range n, x ^ i + 1",
" ∑ i ∈ range 1, x ^ i = 1",
" ∑ i ∈ range 2, x ^ i = x + 1",
" ∑ i ∈ range 0, 0 ^ i = if 0 = 0 then 0 else 1",
" ∑ i ∈ range 1, 0 ^ i = if 1 = 0 then 0 else 1",
" ∑ i ∈ range (n + 2), 0 ^ i = if n + 2 = 0 then 0 else 1",
" 0 ^ (n + 1) + ∑ i ... | [
" ∑ i ∈ range (n + 1), x ^ i = x * ∑ i ∈ range n, x ^ i + 1",
" ∑ i ∈ range 1, x ^ i = 1",
" ∑ i ∈ range 2, x ^ i = x + 1",
" ∑ i ∈ range 0, 0 ^ i = if 0 = 0 then 0 else 1",
" ∑ i ∈ range 1, 0 ^ i = if 1 = 0 then 0 else 1",
" ∑ i ∈ range (n + 2), 0 ^ i = if n + 2 = 0 then 0 else 1",
" 0 ^ (n + 1) + ∑ i ... |
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
namespace Pretrivialization
variable (e : Pretrivialization F (π F E)) {x : TotalSpace F E} {b : B} {y : E b}
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 x : E b => (e ⟨b, x⟩).2 :=
Pretrivialization.IsLinear.linear b hb
#align pretrivialization.linear Pretrivialization.linear
variable [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
@[simps!]
protected def symmₗ (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : F →ₗ[R] E b := by
refine IsLinearMap.mk' (e.symm b) ?_
by_cases hb : b ∈ e.baseSet
· exact (((e.linear R hb).mk' _).inverse (e.symm b) (e.symm_apply_apply_mk hb) fun v ↦
congr_arg Prod.snd <| e.apply_mk_symm hb v).isLinear
· rw [e.coe_symm_of_not_mem hb]
exact (0 : F →ₗ[R] E b).isLinear
#align pretrivialization.symmₗ Pretrivialization.symmₗ
@[simps (config := .asFn)]
def linearEquivAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) (hb : b ∈ e.baseSet) :
E b ≃ₗ[R] F where
toFun y := (e ⟨b, y⟩).2
invFun := e.symm b
left_inv := e.symm_apply_apply_mk hb
right_inv v := by simp_rw [e.apply_mk_symm hb v]
map_add' v w := (e.linear R hb).map_add v w
map_smul' c v := (e.linear R hb).map_smul c v
#align pretrivialization.linear_equiv_at Pretrivialization.linearEquivAt
protected def linearMapAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : E b →ₗ[R] F :=
if hb : b ∈ e.baseSet then e.linearEquivAt R b hb else 0
#align pretrivialization.linear_map_at Pretrivialization.linearMapAt
variable {R}
| Mathlib/Topology/VectorBundle/Basic.lean | 120 | 123 | theorem coe_linearMapAt (e : Pretrivialization 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 := by |
rw [Pretrivialization.linearMapAt]
split_ifs <;> rfl
| [
" F →ₗ[R] E b",
" IsLinearMap R (e.symm b)",
" IsLinearMap R 0",
" { toFun := fun y => (↑e { proj := b, snd := y }).2, map_add' := ⋯, map_smul' := ⋯ }.toFun (e.symm b v) = v",
" ⇑(Pretrivialization.linearMapAt R e b) = fun y => if b ∈ e.baseSet then (↑e { proj := b, snd := y }).2 else 0",
" ⇑(if hb : b ∈ ... | [
" F →ₗ[R] E b",
" IsLinearMap R (e.symm b)",
" IsLinearMap R 0",
" { toFun := fun y => (↑e { proj := b, snd := y }).2, map_add' := ⋯, map_smul' := ⋯ }.toFun (e.symm b v) = v",
" ⇑(Pretrivialization.linearMapAt R e b) = fun y => if b ∈ e.baseSet then (↑e { proj := b, snd := y }).2 else 0"
] |
import Mathlib.Algebra.MonoidAlgebra.Ideal
import Mathlib.Algebra.MvPolynomial.Division
#align_import ring_theory.mv_polynomial.ideal from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951"
variable {σ R : Type*}
namespace MvPolynomial
variable [CommSemiring R]
theorem mem_ideal_span_monomial_image {x : MvPolynomial σ R} {s : Set (σ →₀ ℕ)} :
x ∈ Ideal.span ((fun s => monomial s (1 : R)) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi := by
refine AddMonoidAlgebra.mem_ideal_span_of'_image.trans ?_
simp_rw [le_iff_exists_add, add_comm]
rfl
#align mv_polynomial.mem_ideal_span_monomial_image MvPolynomial.mem_ideal_span_monomial_image
theorem mem_ideal_span_monomial_image_iff_dvd {x : MvPolynomial σ R} {s : Set (σ →₀ ℕ)} :
x ∈ Ideal.span ((fun s => monomial s (1 : R)) '' s) ↔
∀ xi ∈ x.support, ∃ si ∈ s, monomial si 1 ∣ monomial xi (x.coeff xi) := by
refine mem_ideal_span_monomial_image.trans (forall₂_congr fun xi hxi => ?_)
simp_rw [monomial_dvd_monomial, one_dvd, and_true_iff, mem_support_iff.mp hxi, false_or_iff]
#align mv_polynomial.mem_ideal_span_monomial_image_iff_dvd MvPolynomial.mem_ideal_span_monomial_image_iff_dvd
| Mathlib/RingTheory/MvPolynomial/Ideal.lean | 48 | 54 | theorem mem_ideal_span_X_image {x : MvPolynomial σ R} {s : Set σ} :
x ∈ Ideal.span (MvPolynomial.X '' s : Set (MvPolynomial σ R)) ↔
∀ m ∈ x.support, ∃ i ∈ s, (m : σ →₀ ℕ) i ≠ 0 := by |
have := @mem_ideal_span_monomial_image σ R _ x ((fun i => Finsupp.single i 1) '' s)
rw [Set.image_image] at this
refine this.trans ?_
simp [Nat.one_le_iff_ne_zero]
| [
" x ∈ Ideal.span ((fun s => (monomial s) 1) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d + m') ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = m' + d) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, ∃ c, xi = si + c",
" x ∈ Ideal.span ((fun s => (monomial... | [
" x ∈ Ideal.span ((fun s => (monomial s) 1) '' s) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d + m') ↔ ∀ xi ∈ x.support, ∃ si ∈ s, si ≤ xi",
" (∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = m' + d) ↔ ∀ xi ∈ x.support, ∃ si ∈ s, ∃ c, xi = si + c",
" x ∈ Ideal.span ((fun s => (monomial... |
import Mathlib.Algebra.EuclideanDomain.Instances
import Mathlib.RingTheory.Ideal.Colon
import Mathlib.RingTheory.UniqueFactorizationDomain
#align_import ring_theory.principal_ideal_domain from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
universe u v
variable {R : Type u} {M : Type v}
open Set Function
open Submodule
section
variable [Ring R] [AddCommGroup M] [Module R M]
instance bot_isPrincipal : (⊥ : Submodule R M).IsPrincipal :=
⟨⟨0, by simp⟩⟩
#align bot_is_principal bot_isPrincipal
instance top_isPrincipal : (⊤ : Submodule R R).IsPrincipal :=
⟨⟨1, Ideal.span_singleton_one.symm⟩⟩
#align top_is_principal top_isPrincipal
variable (R)
class IsBezout : Prop where
isPrincipal_of_FG : ∀ I : Ideal R, I.FG → I.IsPrincipal
#align is_bezout IsBezout
instance (priority := 100) IsBezout.of_isPrincipalIdealRing [IsPrincipalIdealRing R] : IsBezout R :=
⟨fun I _ => IsPrincipalIdealRing.principal I⟩
#align is_bezout.of_is_principal_ideal_ring IsBezout.of_isPrincipalIdealRing
instance (priority := 100) DivisionRing.isPrincipalIdealRing (K : Type u) [DivisionRing K] :
IsPrincipalIdealRing K where
principal S := by
rcases Ideal.eq_bot_or_top S with (rfl | rfl)
· apply bot_isPrincipal
· apply top_isPrincipal
#align division_ring.is_principal_ideal_ring DivisionRing.isPrincipalIdealRing
end
namespace Submodule.IsPrincipal
variable [AddCommGroup M]
section Ring
variable [Ring R] [Module R M]
noncomputable def generator (S : Submodule R M) [S.IsPrincipal] : M :=
Classical.choose (principal S)
#align submodule.is_principal.generator Submodule.IsPrincipal.generator
theorem span_singleton_generator (S : Submodule R M) [S.IsPrincipal] : span R {generator S} = S :=
Eq.symm (Classical.choose_spec (principal S))
#align submodule.is_principal.span_singleton_generator Submodule.IsPrincipal.span_singleton_generator
@[simp]
theorem _root_.Ideal.span_singleton_generator (I : Ideal R) [I.IsPrincipal] :
Ideal.span ({generator I} : Set R) = I :=
Eq.symm (Classical.choose_spec (principal I))
#align ideal.span_singleton_generator Ideal.span_singleton_generator
@[simp]
theorem generator_mem (S : Submodule R M) [S.IsPrincipal] : generator S ∈ S := by
conv_rhs => rw [← span_singleton_generator S]
exact subset_span (mem_singleton _)
#align submodule.is_principal.generator_mem Submodule.IsPrincipal.generator_mem
theorem mem_iff_eq_smul_generator (S : Submodule R M) [S.IsPrincipal] {x : M} :
x ∈ S ↔ ∃ s : R, x = s • generator S := by
simp_rw [@eq_comm _ x, ← mem_span_singleton, span_singleton_generator]
#align submodule.is_principal.mem_iff_eq_smul_generator Submodule.IsPrincipal.mem_iff_eq_smul_generator
| Mathlib/RingTheory/PrincipalIdealDomain.lean | 114 | 115 | theorem eq_bot_iff_generator_eq_zero (S : Submodule R M) [S.IsPrincipal] :
S = ⊥ ↔ generator S = 0 := by | rw [← @span_singleton_eq_bot R M, span_singleton_generator]
| [
" ⊥ = span R {0}",
" IsPrincipal S",
" IsPrincipal ⊥",
" IsPrincipal ⊤",
" generator S ∈ S",
"R : Type u\nM : Type v\ninst✝³ : AddCommGroup M\ninst✝² : Ring R\ninst✝¹ : Module R M\nS : Submodule R M\ninst✝ : S.IsPrincipal\n| S",
" generator S ∈ span R {generator S}",
" x ∈ S ↔ ∃ s, x = s • generator S... | [
" ⊥ = span R {0}",
" IsPrincipal S",
" IsPrincipal ⊥",
" IsPrincipal ⊤",
" generator S ∈ S",
"R : Type u\nM : Type v\ninst✝³ : AddCommGroup M\ninst✝² : Ring R\ninst✝¹ : Module R M\nS : Submodule R M\ninst✝ : S.IsPrincipal\n| S",
" generator S ∈ span R {generator S}",
" x ∈ S ↔ ∃ s, x = s • generator S... |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesRightLT
variable [LT α] [CovariantClass α α (swap (· * ·)) (· < ·)] {a b c : α}
@[to_additive (attr := simp) "Uses `right` co(ntra)variant."]
| Mathlib/Algebra/Order/Group/Defs.lean | 280 | 281 | theorem Right.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by |
rw [← mul_lt_mul_iff_right a, inv_mul_self, one_mul]
| [
" b ≤ c",
" a⁻¹ < 1 ↔ 1 < a"
] | [
" b ≤ c",
" a⁻¹ < 1 ↔ 1 < a"
] |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Analysis.NormedSpace.LinearIsometry
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.LinearAlgebra.AffineSpace.Restrict
import Mathlib.Tactic.FailIfNoProgress
#align_import analysis.normed_space.affine_isometry from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Function Set
variable (𝕜 : Type*) {V V₁ V₁' V₂ V₃ V₄ : Type*} {P₁ P₁' : Type*} (P P₂ : Type*) {P₃ P₄ : Type*}
[NormedField 𝕜]
[SeminormedAddCommGroup V] [NormedSpace 𝕜 V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[SeminormedAddCommGroup V₁] [NormedSpace 𝕜 V₁] [PseudoMetricSpace P₁] [NormedAddTorsor V₁ P₁]
[SeminormedAddCommGroup V₁'] [NormedSpace 𝕜 V₁'] [MetricSpace P₁'] [NormedAddTorsor V₁' P₁']
[SeminormedAddCommGroup V₂] [NormedSpace 𝕜 V₂] [PseudoMetricSpace P₂] [NormedAddTorsor V₂ P₂]
[SeminormedAddCommGroup V₃] [NormedSpace 𝕜 V₃] [PseudoMetricSpace P₃] [NormedAddTorsor V₃ P₃]
[SeminormedAddCommGroup V₄] [NormedSpace 𝕜 V₄] [PseudoMetricSpace P₄] [NormedAddTorsor V₄ P₄]
structure AffineIsometry extends P →ᵃ[𝕜] P₂ where
norm_map : ∀ x : V, ‖linear x‖ = ‖x‖
#align affine_isometry AffineIsometry
variable {𝕜 P P₂}
@[inherit_doc]
notation:25 -- `→ᵃᵢ` would be more consistent with the linear isometry notation, but it is uglier
P " →ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometry 𝕜 P P₂
namespace AffineIsometry
variable (f : P →ᵃⁱ[𝕜] P₂)
protected def linearIsometry : V →ₗᵢ[𝕜] V₂ :=
{ f.linear with norm_map' := f.norm_map }
#align affine_isometry.linear_isometry AffineIsometry.linearIsometry
@[simp]
| Mathlib/Analysis/NormedSpace/AffineIsometry.lean | 72 | 74 | theorem linear_eq_linearIsometry : f.linear = f.linearIsometry.toLinearMap := by |
ext
rfl
| [
" f.linear = f.linearIsometry.toLinearMap",
" f.linear x✝ = f.linearIsometry.toLinearMap x✝"
] | [
" f.linear = f.linearIsometry.toLinearMap"
] |
import Mathlib.Order.Cover
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.GaloisConnection
#align_import order.modular_lattice from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open Set
variable {α : Type*}
class IsWeakUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy_covBy {a b : α} : a ⊓ b ⋖ a → a ⊓ b ⋖ b → a ⋖ a ⊔ b
#align is_weak_upper_modular_lattice IsWeakUpperModularLattice
class IsWeakLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_covBy_sup {a b : α} : a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ a
#align is_weak_lower_modular_lattice IsWeakLowerModularLattice
class IsUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy {a b : α} : a ⊓ b ⋖ a → b ⋖ a ⊔ b
#align is_upper_modular_lattice IsUpperModularLattice
class IsLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_sup {a b : α} : a ⋖ a ⊔ b → a ⊓ b ⋖ b
#align is_lower_modular_lattice IsLowerModularLattice
class IsModularLattice (α : Type*) [Lattice α] : Prop where
sup_inf_le_assoc_of_le : ∀ {x : α} (y : α) {z : α}, x ≤ z → (x ⊔ y) ⊓ z ≤ x ⊔ y ⊓ z
#align is_modular_lattice IsModularLattice
section WeakLowerModular
variable [Lattice α] [IsWeakLowerModularLattice α] {a b : α}
theorem inf_covBy_of_covBy_sup_of_covBy_sup_left : a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ a :=
IsWeakLowerModularLattice.inf_covBy_of_covBy_covBy_sup
#align inf_covby_of_covby_sup_of_covby_sup_left inf_covBy_of_covBy_sup_of_covBy_sup_left
| Mathlib/Order/ModularLattice.lean | 127 | 129 | theorem inf_covBy_of_covBy_sup_of_covBy_sup_right : a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ b := by |
rw [sup_comm, inf_comm]
exact fun ha hb => inf_covBy_of_covBy_sup_of_covBy_sup_left hb ha
| [
" a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ b",
" a ⋖ b ⊔ a → b ⋖ b ⊔ a → b ⊓ a ⋖ b"
] | [
" a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ b"
] |
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
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
#align complex.circle_transform_deriv_eq Complex.circleTransformDeriv_eq
theorem integral_circleTransform (f : ℂ → E) :
(∫ θ : ℝ in (0)..2 * π, circleTransform R z w f θ) =
(2 * ↑π * I)⁻¹ • ∮ z in C(z, R), (z - w)⁻¹ • f z := by
simp_rw [circleTransform, circleIntegral, deriv_circleMap, circleMap]
simp
#align complex.integral_circle_transform Complex.integral_circleTransform
theorem continuous_circleTransform {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f <| sphere z R) (hw : w ∈ ball z R) :
Continuous (circleTransform R z w f) := by
apply_rules [Continuous.smul, continuous_const]
· simp_rw [deriv_circleMap]
apply_rules [Continuous.mul, continuous_circleMap 0 R, continuous_const]
· exact continuous_circleMap_inv hw
· apply ContinuousOn.comp_continuous hf (continuous_circleMap z R)
exact fun _ => (circleMap_mem_sphere _ hR.le) _
#align complex.continuous_circle_transform Complex.continuous_circleTransform
theorem continuous_circleTransformDeriv {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f (sphere z R)) (hw : w ∈ ball z R) :
Continuous (circleTransformDeriv R z w f) := by
rw [circleTransformDeriv_eq]
exact (continuous_circleMap_inv hw).smul (continuous_circleTransform hR hf hw)
#align complex.continuous_circle_transform_deriv Complex.continuous_circleTransformDeriv
def circleTransformBoundingFunction (R : ℝ) (z : ℂ) (w : ℂ × ℝ) : ℂ :=
circleTransformDeriv R z w.1 (fun _ => 1) w.2
#align complex.circle_transform_bounding_function Complex.circleTransformBoundingFunction
theorem continuousOn_prod_circle_transform_function {R r : ℝ} (hr : r < R) {z : ℂ} :
ContinuousOn (fun w : ℂ × ℝ => (circleMap z R w.snd - w.fst)⁻¹ ^ 2)
(closedBall z r ×ˢ univ) := by
simp_rw [← one_div]
apply_rules [ContinuousOn.pow, ContinuousOn.div, continuousOn_const]
· exact ((continuous_circleMap z R).comp_continuousOn continuousOn_snd).sub continuousOn_fst
· rintro ⟨a, b⟩ ⟨ha, -⟩
have ha2 : a ∈ ball z R := closedBall_subset_ball hr ha
exact sub_ne_zero.2 (circleMap_ne_mem_ball ha2 b)
#align complex.continuous_on_prod_circle_transform_function Complex.continuousOn_prod_circle_transform_function
| Mathlib/MeasureTheory/Integral/CircleTransform.lean | 109 | 117 | theorem continuousOn_abs_circleTransformBoundingFunction {R r : ℝ} (hr : r < R) (z : ℂ) :
ContinuousOn (abs ∘ circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by |
have : ContinuousOn (circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by
apply_rules [ContinuousOn.smul, continuousOn_const]
· simp only [deriv_circleMap]
apply_rules [ContinuousOn.mul, (continuous_circleMap 0 R).comp_continuousOn continuousOn_snd,
continuousOn_const]
· simpa only [inv_pow] using continuousOn_prod_circle_transform_function hr
exact this.norm
| [
" Periodic (circleTransformDeriv R z w f) (2 * π)",
" ∀ (x : ℝ), circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" (2 * ↑π * I)⁻¹ • deriv (circleMap z R) (x + 2 * π) • ((circleMap z R x - w) ^ 2)⁻¹ • f (c... | [
" Periodic (circleTransformDeriv R z w f) (2 * π)",
" ∀ (x : ℝ), circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" (2 * ↑π * I)⁻¹ • deriv (circleMap z R) (x + 2 * π) • ((circleMap z R x - w) ^ 2)⁻¹ • f (c... |
import Mathlib.Data.Nat.Lattice
import Mathlib.Logic.Denumerable
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.Hom.Basic
import Mathlib.Data.Set.Subsingleton
#align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
variable {α : Type*}
namespace RelEmbedding
variable {r : α → α → Prop} [IsStrictOrder α r]
def natLT (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) : ((· < ·) : ℕ → ℕ → Prop) ↪r r :=
ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H
#align rel_embedding.nat_lt RelEmbedding.natLT
@[simp]
theorem coe_natLT {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} : ⇑(natLT f H) = f :=
rfl
#align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT
def natGT (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((· > ·) : ℕ → ℕ → Prop) ↪r r :=
haveI := IsStrictOrder.swap r
RelEmbedding.swap (natLT f H)
#align rel_embedding.nat_gt RelEmbedding.natGT
@[simp]
theorem coe_natGT {f : ℕ → α} {H : ∀ n : ℕ, r (f (n + 1)) (f n)} : ⇑(natGT f H) = f :=
rfl
#align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT
theorem exists_not_acc_lt_of_not_acc {a : α} {r} (h : ¬Acc r a) : ∃ b, ¬Acc r b ∧ r b a := by
contrapose! h
refine ⟨_, fun b hr => ?_⟩
by_contra hb
exact h b hb hr
#align rel_embedding.exists_not_acc_lt_of_not_acc RelEmbedding.exists_not_acc_lt_of_not_acc
theorem acc_iff_no_decreasing_seq {x} :
Acc r x ↔ IsEmpty { f : ((· > ·) : ℕ → ℕ → Prop) ↪r r // x ∈ Set.range f } := by
constructor
· refine fun h => h.recOn fun x _ IH => ?_
constructor
rintro ⟨f, k, hf⟩
exact IsEmpty.elim' (IH (f (k + 1)) (hf ▸ f.map_rel_iff.2 (lt_add_one k))) ⟨f, _, rfl⟩
· have : ∀ x : { a // ¬Acc r a }, ∃ y : { a // ¬Acc r a }, r y.1 x.1 := by
rintro ⟨x, hx⟩
cases exists_not_acc_lt_of_not_acc hx with
| intro w h => exact ⟨⟨w, h.1⟩, h.2⟩
choose f h using this
refine fun E =>
by_contradiction fun hx => E.elim' ⟨natGT (fun n => (f^[n] ⟨x, hx⟩).1) fun n => ?_, 0, rfl⟩
simp only [Function.iterate_succ']
apply h
#align rel_embedding.acc_iff_no_decreasing_seq RelEmbedding.acc_iff_no_decreasing_seq
theorem not_acc_of_decreasing_seq (f : ((· > ·) : ℕ → ℕ → Prop) ↪r r) (k : ℕ) : ¬Acc r (f k) := by
rw [acc_iff_no_decreasing_seq, not_isEmpty_iff]
exact ⟨⟨f, k, rfl⟩⟩
#align rel_embedding.not_acc_of_decreasing_seq RelEmbedding.not_acc_of_decreasing_seq
| Mathlib/Order/OrderIsoNat.lean | 90 | 96 | theorem wellFounded_iff_no_descending_seq :
WellFounded r ↔ IsEmpty (((· > ·) : ℕ → ℕ → Prop) ↪r r) := by |
constructor
· rintro ⟨h⟩
exact ⟨fun f => not_acc_of_decreasing_seq f 0 (h _)⟩
· intro h
exact ⟨fun x => acc_iff_no_decreasing_seq.2 inferInstance⟩
| [
" ∃ b, ¬Acc r b ∧ r b a",
" Acc r a",
" Acc r b",
" False",
" Acc r x ↔ IsEmpty { f // x ∈ Set.range ⇑f }",
" Acc r x → IsEmpty { f // x ∈ Set.range ⇑f }",
" IsEmpty { f // x ∈ Set.range ⇑f }",
" { f // x ∈ Set.range ⇑f } → False",
" IsEmpty { f // x ∈ Set.range ⇑f } → Acc r x",
" ∀ (x : { a // ¬A... | [
" ∃ b, ¬Acc r b ∧ r b a",
" Acc r a",
" Acc r b",
" False",
" Acc r x ↔ IsEmpty { f // x ∈ Set.range ⇑f }",
" Acc r x → IsEmpty { f // x ∈ Set.range ⇑f }",
" IsEmpty { f // x ∈ Set.range ⇑f }",
" { f // x ∈ Set.range ⇑f } → False",
" IsEmpty { f // x ∈ Set.range ⇑f } → Acc r x",
" ∀ (x : { a // ¬A... |
import Mathlib.Algebra.Polynomial.FieldDivision
import Mathlib.Algebra.Polynomial.Lifts
import Mathlib.Data.List.Prime
#align_import data.polynomial.splits from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
noncomputable section
open Polynomial
universe u v w
variable {R : Type*} {F : Type u} {K : Type v} {L : Type w}
namespace Polynomial
open Polynomial
section Splits
section CommRing
variable [CommRing K] [Field L] [Field F]
variable (i : K →+* L)
def Splits (f : K[X]) : Prop :=
f.map i = 0 ∨ ∀ {g : L[X]}, Irreducible g → g ∣ f.map i → degree g = 1
#align polynomial.splits Polynomial.Splits
@[simp]
theorem splits_zero : Splits i (0 : K[X]) :=
Or.inl (Polynomial.map_zero i)
#align polynomial.splits_zero Polynomial.splits_zero
theorem splits_of_map_eq_C {f : K[X]} {a : L} (h : f.map i = C a) : Splits i f :=
letI := Classical.decEq L
if ha : a = 0 then Or.inl (h.trans (ha.symm ▸ C_0))
else
Or.inr fun hg ⟨p, hp⟩ =>
absurd hg.1 <|
Classical.not_not.2 <|
isUnit_iff_degree_eq_zero.2 <| by
have := congr_arg degree hp
rw [h, degree_C ha, degree_mul, @eq_comm (WithBot ℕ) 0,
Nat.WithBot.add_eq_zero_iff] at this
exact this.1
set_option linter.uppercaseLean3 false in
#align polynomial.splits_of_map_eq_C Polynomial.splits_of_map_eq_C
@[simp]
theorem splits_C (a : K) : Splits i (C a) :=
splits_of_map_eq_C i (map_C i)
set_option linter.uppercaseLean3 false in
#align polynomial.splits_C Polynomial.splits_C
theorem splits_of_map_degree_eq_one {f : K[X]} (hf : degree (f.map i) = 1) : Splits i f :=
Or.inr fun hg ⟨p, hp⟩ => by
have := congr_arg degree hp
simp [Nat.WithBot.add_eq_one_iff, hf, @eq_comm (WithBot ℕ) 1,
mt isUnit_iff_degree_eq_zero.2 hg.1] at this
tauto
#align polynomial.splits_of_map_degree_eq_one Polynomial.splits_of_map_degree_eq_one
theorem splits_of_degree_le_one {f : K[X]} (hf : degree f ≤ 1) : Splits i f :=
if hif : degree (f.map i) ≤ 0 then splits_of_map_eq_C i (degree_le_zero_iff.mp hif)
else by
push_neg at hif
rw [← Order.succ_le_iff, ← WithBot.coe_zero, WithBot.succ_coe, Nat.succ_eq_succ] at hif
exact splits_of_map_degree_eq_one i (le_antisymm ((degree_map_le i _).trans hf) hif)
#align polynomial.splits_of_degree_le_one Polynomial.splits_of_degree_le_one
theorem splits_of_degree_eq_one {f : K[X]} (hf : degree f = 1) : Splits i f :=
splits_of_degree_le_one i hf.le
#align polynomial.splits_of_degree_eq_one Polynomial.splits_of_degree_eq_one
theorem splits_of_natDegree_le_one {f : K[X]} (hf : natDegree f ≤ 1) : Splits i f :=
splits_of_degree_le_one i (degree_le_of_natDegree_le hf)
#align polynomial.splits_of_nat_degree_le_one Polynomial.splits_of_natDegree_le_one
theorem splits_of_natDegree_eq_one {f : K[X]} (hf : natDegree f = 1) : Splits i f :=
splits_of_natDegree_le_one i (le_of_eq hf)
#align polynomial.splits_of_nat_degree_eq_one Polynomial.splits_of_natDegree_eq_one
theorem splits_mul {f g : K[X]} (hf : Splits i f) (hg : Splits i g) : Splits i (f * g) :=
letI := Classical.decEq L
if h : (f * g).map i = 0 then Or.inl h
else
Or.inr @fun p hp hpf =>
((irreducible_iff_prime.1 hp).2.2 _ _
(show p ∣ map i f * map i g by convert hpf; rw [Polynomial.map_mul])).elim
(hf.resolve_left (fun hf => by simp [hf] at h) hp)
(hg.resolve_left (fun hg => by simp [hg] at h) hp)
#align polynomial.splits_mul Polynomial.splits_mul
theorem splits_of_splits_mul' {f g : K[X]} (hfg : (f * g).map i ≠ 0) (h : Splits i (f * g)) :
Splits i f ∧ Splits i g :=
⟨Or.inr @fun g hgi hg =>
Or.resolve_left h hfg hgi (by rw [Polynomial.map_mul]; exact hg.trans (dvd_mul_right _ _)),
Or.inr @fun g hgi hg =>
Or.resolve_left h hfg hgi (by rw [Polynomial.map_mul]; exact hg.trans (dvd_mul_left _ _))⟩
#align polynomial.splits_of_splits_mul' Polynomial.splits_of_splits_mul'
| Mathlib/Algebra/Polynomial/Splits.lean | 124 | 125 | theorem splits_map_iff (j : L →+* F) {f : K[X]} : Splits j (f.map i) ↔ Splits (j.comp i) f := by |
simp [Splits, Polynomial.map_map]
| [
" g✝.degree = 0",
" g✝.degree = 1",
" Splits i f",
" p ∣ map i f * map i g",
" map i f * map i g = map i (f * g)",
" False",
" g ∣ map i (f * g✝)",
" g ∣ map i f * map i g✝",
" Splits j (map i f) ↔ Splits (j.comp i) f"
] | [
" g✝.degree = 0",
" g✝.degree = 1",
" Splits i f",
" p ∣ map i f * map i g",
" map i f * map i g = map i (f * g)",
" False",
" g ∣ map i (f * g✝)",
" g ∣ map i f * map i g✝",
" Splits j (map i f) ↔ Splits (j.comp i) f"
] |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.GroupWithZero.Units.Equiv
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Tactic.Positivity.Core
#align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd"
open Function OrderDual
variable {ι α β : Type*}
section
variable [LinearOrderedField α] {a b c d : α} {n : ℤ}
theorem div_pos_iff : 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 := by
simp only [division_def, mul_pos_iff, inv_pos, inv_lt_zero]
#align div_pos_iff div_pos_iff
theorem div_neg_iff : a / b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b := by
simp [division_def, mul_neg_iff]
#align div_neg_iff div_neg_iff
theorem div_nonneg_iff : 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
simp [division_def, mul_nonneg_iff]
#align div_nonneg_iff div_nonneg_iff
| Mathlib/Algebra/Order/Field/Basic.lean | 642 | 643 | theorem div_nonpos_iff : a / b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b := by |
simp [division_def, mul_nonpos_iff]
| [
" 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0",
" a / b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b",
" 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0",
" a / b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b"
] | [
" 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0",
" a / b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b",
" 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0",
" a / b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b"
] |
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.CategoryTheory.DifferentialObject
#align_import algebra.homology.differential_object from "leanprover-community/mathlib"@"b535c2d5d996acd9b0554b76395d9c920e186f4f"
open CategoryTheory CategoryTheory.Limits
open scoped Classical
noncomputable section
namespace CategoryTheory.DifferentialObject
variable {β : Type*} [AddCommGroup β] {b : β}
variable {V : Type*} [Category V] [HasZeroMorphisms V]
variable (X : DifferentialObject ℤ (GradedObjectWithShift b V))
abbrev objEqToHom {i j : β} (h : i = j) :
X.obj i ⟶ X.obj j :=
eqToHom (congr_arg X.obj h)
set_option linter.uppercaseLean3 false in
#align category_theory.differential_object.X_eq_to_hom CategoryTheory.DifferentialObject.objEqToHom
@[simp]
theorem objEqToHom_refl (i : β) : X.objEqToHom (refl i) = 𝟙 _ :=
rfl
set_option linter.uppercaseLean3 false in
#align category_theory.differential_object.X_eq_to_hom_refl CategoryTheory.DifferentialObject.objEqToHom_refl
@[reassoc (attr := simp)]
theorem objEqToHom_d {x y : β} (h : x = y) :
X.objEqToHom h ≫ X.d y = X.d x ≫ X.objEqToHom (by cases h; rfl) := by cases h; dsimp; simp
#align homological_complex.eq_to_hom_d CategoryTheory.DifferentialObject.objEqToHom_d
@[reassoc (attr := simp)]
theorem d_squared_apply {x : β} : X.d x ≫ X.d _ = 0 := congr_fun X.d_squared _
@[reassoc (attr := simp)]
| Mathlib/Algebra/Homology/DifferentialObject.lean | 61 | 62 | theorem eqToHom_f' {X Y : DifferentialObject ℤ (GradedObjectWithShift b V)} (f : X ⟶ Y) {x y : β}
(h : x = y) : X.objEqToHom h ≫ f.f y = f.f x ≫ Y.objEqToHom h := by | cases h; simp
| [
" (fun b_1 => b_1 + { as := 1 }.as • b) x = (fun b_1 => b_1 + { as := 1 }.as • b) y",
" (fun b_1 => b_1 + { as := 1 }.as • b) x = (fun b_1 => b_1 + { as := 1 }.as • b) x",
" X.objEqToHom h ≫ X.d y = X.d x ≫ X.objEqToHom ⋯",
" X.objEqToHom ⋯ ≫ X.d x = X.d x ≫ X.objEqToHom ⋯",
" 𝟙 (X.obj x) ≫ X.d x = X.d x ≫... | [
" (fun b_1 => b_1 + { as := 1 }.as • b) x = (fun b_1 => b_1 + { as := 1 }.as • b) y",
" (fun b_1 => b_1 + { as := 1 }.as • b) x = (fun b_1 => b_1 + { as := 1 }.as • b) x",
" X.objEqToHom h ≫ X.d y = X.d x ≫ X.objEqToHom ⋯",
" X.objEqToHom ⋯ ≫ X.d x = X.d x ≫ X.objEqToHom ⋯",
" 𝟙 (X.obj x) ≫ X.d x = X.d x ≫... |
import Mathlib.Data.PFunctor.Univariate.M
#align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe u
class QPF (F : Type u → Type u) [Functor F] where
P : PFunctor.{u}
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p
#align qpf QPF
namespace QPF
variable {F : Type u → Type u} [Functor F] [q : QPF F]
open Functor (Liftp Liftr)
theorem id_map {α : Type _} (x : F α) : id <$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align qpf.id_map QPF.id_map
| Mathlib/Data/QPF/Univariate/Basic.lean | 78 | 83 | theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) (x : F α) :
(g ∘ f) <$> x = g <$> f <$> x := by |
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
| [
" id <$> x = x",
" id <$> abs (repr x) = abs (repr x)",
" id <$> abs ⟨a, f⟩ = abs ⟨a, f⟩",
" abs ((P F).map id ⟨a, f⟩) = abs ⟨a, f⟩",
" (g ∘ f) <$> x = g <$> f <$> x",
" (g ∘ f) <$> abs (repr x) = g <$> f <$> abs (repr x)",
" (g ∘ f✝) <$> abs ⟨a, f⟩ = g <$> f✝ <$> abs ⟨a, f⟩",
" abs ((P F).map (g ∘ f✝... | [
" id <$> x = x",
" id <$> abs (repr x) = abs (repr x)",
" id <$> abs ⟨a, f⟩ = abs ⟨a, f⟩",
" abs ((P F).map id ⟨a, f⟩) = abs ⟨a, f⟩",
" (g ∘ f) <$> x = g <$> f <$> x"
] |
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import ring_theory.bezout from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
universe u v
variable {R : Type u} [CommRing R]
namespace IsBezout
theorem iff_span_pair_isPrincipal :
IsBezout R ↔ ∀ x y : R, (Ideal.span {x, y} : Ideal R).IsPrincipal := by
classical
constructor
· intro H x y; infer_instance
· intro H
constructor
apply Submodule.fg_induction
· exact fun _ => ⟨⟨_, rfl⟩⟩
· rintro _ _ ⟨⟨x, rfl⟩⟩ ⟨⟨y, rfl⟩⟩; rw [← Submodule.span_insert]; exact H _ _
#align is_bezout.iff_span_pair_is_principal IsBezout.iff_span_pair_isPrincipal
theorem _root_.Function.Surjective.isBezout {S : Type v} [CommRing S] (f : R →+* S)
(hf : Function.Surjective f) [IsBezout R] : IsBezout S := by
rw [iff_span_pair_isPrincipal]
intro x y
obtain ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ := hf x, hf y
use f (gcd x y)
trans Ideal.map f (Ideal.span {gcd x y})
· rw [span_gcd, Ideal.map_span, Set.image_insert_eq, Set.image_singleton]
· rw [Ideal.map_span, Set.image_singleton]; rfl
#align function.surjective.is_bezout Function.Surjective.isBezout
| Mathlib/RingTheory/Bezout.lean | 53 | 78 | theorem TFAE [IsBezout R] [IsDomain R] :
List.TFAE
[IsNoetherianRing R, IsPrincipalIdealRing R, UniqueFactorizationMonoid R, WfDvdMonoid R] := by |
classical
tfae_have 1 → 2
· intro H; exact ⟨fun I => isPrincipal_of_FG _ (IsNoetherian.noetherian _)⟩
tfae_have 2 → 3
· intro; infer_instance
tfae_have 3 → 4
· intro; infer_instance
tfae_have 4 → 1
· rintro ⟨h⟩
rw [isNoetherianRing_iff, isNoetherian_iff_fg_wellFounded]
apply RelEmbedding.wellFounded _ h
have : ∀ I : { J : Ideal R // J.FG }, ∃ x : R, (I : Ideal R) = Ideal.span {x} :=
fun ⟨I, hI⟩ => (IsBezout.isPrincipal_of_FG I hI).1
choose f hf using this
exact
{ toFun := f
inj' := fun x y e => by ext1; rw [hf, hf, e]
map_rel_iff' := by
dsimp
intro a b
rw [← Ideal.span_singleton_lt_span_singleton, ← hf, ← hf]
rfl }
tfae_finish
| [
" IsBezout R ↔ ∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})",
" IsBezout R → ∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})",
" Submodule.IsPrincipal (Ideal.span {x, y})",
" (∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})) → IsBezout R",
" IsBezout R",
" ∀ (I : Ideal R), I.FG → S... | [
" IsBezout R ↔ ∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})",
" IsBezout R → ∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})",
" Submodule.IsPrincipal (Ideal.span {x, y})",
" (∀ (x y : R), Submodule.IsPrincipal (Ideal.span {x, y})) → IsBezout R",
" IsBezout R",
" ∀ (I : Ideal R), I.FG → S... |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.Prod
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.FinCases
import Mathlib.Tactic.LinearCombination
import Mathlib.Lean.Expr.ExtraRecognizers
import Mathlib.Data.Set.Subsingleton
#align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Function Set Submodule
open Cardinal
universe u' u
variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable {v : ι → M}
variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M'']
variable [Module R M] [Module R M'] [Module R M'']
variable {a b : R} {x y : M}
variable (R) (v)
def LinearIndependent : Prop :=
LinearMap.ker (Finsupp.total ι M R v) = ⊥
#align linear_independent LinearIndependent
open Lean PrettyPrinter.Delaborator SubExpr in
@[delab app.LinearIndependent]
def delabLinearIndependent : Delab :=
whenPPOption getPPNotation <|
whenNotPPOption getPPAnalysisSkip <|
withOptionAtCurrPos `pp.analysis.skip true do
let e ← getExpr
guard <| e.isAppOfArity ``LinearIndependent 7
let some _ := (e.getArg! 0).coeTypeSet? | failure
let optionsPerPos ← if (e.getArg! 3).isLambda then
withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true
else
withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true
withTheReader Context ({· with optionsPerPos}) delab
variable {R} {v}
theorem linearIndependent_iff :
LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by
simp [LinearIndependent, LinearMap.ker_eq_bot']
#align linear_independent_iff linearIndependent_iff
theorem linearIndependent_iff' :
LinearIndependent R v ↔
∀ s : Finset ι, ∀ g : ι → R, ∑ i ∈ s, g i • v i = 0 → ∀ i ∈ s, g i = 0 :=
linearIndependent_iff.trans
⟨fun hf s g hg i his =>
have h :=
hf (∑ i ∈ s, Finsupp.single i (g i)) <| by
simpa only [map_sum, Finsupp.total_single] using hg
calc
g i = (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single i (g i)) := by
{ rw [Finsupp.lapply_apply, Finsupp.single_eq_same] }
_ = ∑ j ∈ s, (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single j (g j)) :=
Eq.symm <|
Finset.sum_eq_single i
(fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji])
fun hnis => hnis.elim his
_ = (∑ j ∈ s, Finsupp.single j (g j)) i := (map_sum ..).symm
_ = 0 := DFunLike.ext_iff.1 h i,
fun hf l hl =>
Finsupp.ext fun i =>
_root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩
#align linear_independent_iff' linearIndependent_iff'
theorem linearIndependent_iff'' :
LinearIndependent R v ↔
∀ (s : Finset ι) (g : ι → R), (∀ i ∉ s, g i = 0) →
∑ i ∈ s, g i • v i = 0 → ∀ i, g i = 0 := by
classical
exact linearIndependent_iff'.trans
⟨fun H s g hg hv i => if his : i ∈ s then H s g hv i his else hg i his, fun H s g hg i hi => by
convert
H s (fun j => if j ∈ s then g j else 0) (fun j hj => if_neg hj)
(by simp_rw [ite_smul, zero_smul, Finset.sum_extend_by_zero, hg]) i
exact (if_pos hi).symm⟩
#align linear_independent_iff'' linearIndependent_iff''
| Mathlib/LinearAlgebra/LinearIndependent.lean | 167 | 171 | theorem not_linearIndependent_iff :
¬LinearIndependent R v ↔
∃ s : Finset ι, ∃ g : ι → R, ∑ i ∈ s, g i • v i = 0 ∧ ∃ i ∈ s, g i ≠ 0 := by |
rw [linearIndependent_iff']
simp only [exists_prop, not_forall]
| [
" LinearIndependent R v ↔ ∀ (l : ι →₀ R), (Finsupp.total ι M R v) l = 0 → l = 0",
" (Finsupp.total ι M R v) (∑ i ∈ s, Finsupp.single i (g i)) = 0",
" g i = (Finsupp.lapply i) (Finsupp.single i (g i))",
" (Finsupp.lapply i) (Finsupp.single j (g j)) = 0",
" LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R)... | [
" LinearIndependent R v ↔ ∀ (l : ι →₀ R), (Finsupp.total ι M R v) l = 0 → l = 0",
" (Finsupp.total ι M R v) (∑ i ∈ s, Finsupp.single i (g i)) = 0",
" g i = (Finsupp.lapply i) (Finsupp.single i (g i))",
" (Finsupp.lapply i) (Finsupp.single j (g j)) = 0",
" LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R)... |
import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Order.Monotone
#align_import topology.algebra.order.left_right_lim from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open Set Filter
open Topology
section
variable {α β : Type*} [LinearOrder α] [TopologicalSpace β]
noncomputable def Function.leftLim (f : α → β) (a : α) : β := by
classical
haveI : Nonempty β := ⟨f a⟩
letI : TopologicalSpace α := Preorder.topology α
exact if 𝓝[<] a = ⊥ ∨ ¬∃ y, Tendsto f (𝓝[<] a) (𝓝 y) then f a else limUnder (𝓝[<] a) f
#align function.left_lim Function.leftLim
noncomputable def Function.rightLim (f : α → β) (a : α) : β :=
@Function.leftLim αᵒᵈ β _ _ f a
#align function.right_lim Function.rightLim
open Function
theorem leftLim_eq_of_tendsto [hα : TopologicalSpace α] [h'α : OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[<] a ≠ ⊥) (h' : Tendsto f (𝓝[<] a) (𝓝 y)) :
leftLim f a = y := by
have h'' : ∃ y, Tendsto f (𝓝[<] a) (𝓝 y) := ⟨y, h'⟩
rw [h'α.topology_eq_generate_intervals] at h h' h''
simp only [leftLim, h, h'', not_true, or_self_iff, if_false]
haveI := neBot_iff.2 h
exact lim_eq h'
#align left_lim_eq_of_tendsto leftLim_eq_of_tendsto
theorem leftLim_eq_of_eq_bot [hα : TopologicalSpace α] [h'α : OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[<] a = ⊥) : leftLim f a = f a := by
rw [h'α.topology_eq_generate_intervals] at h
simp [leftLim, ite_eq_left_iff, h]
#align left_lim_eq_of_eq_bot leftLim_eq_of_eq_bot
theorem rightLim_eq_of_tendsto [TopologicalSpace α] [OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[>] a ≠ ⊥) (h' : Tendsto f (𝓝[>] a) (𝓝 y)) :
Function.rightLim f a = y :=
@leftLim_eq_of_tendsto αᵒᵈ _ _ _ _ _ _ f a y h h'
#align right_lim_eq_of_tendsto rightLim_eq_of_tendsto
theorem rightLim_eq_of_eq_bot [TopologicalSpace α] [OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[>] a = ⊥) : rightLim f a = f a :=
@leftLim_eq_of_eq_bot αᵒᵈ _ _ _ _ _ f a h
end
open Function
namespace Monotone
variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : Monotone f) {x y : α}
theorem leftLim_eq_sSup [TopologicalSpace α] [OrderTopology α] (h : 𝓝[<] x ≠ ⊥) :
leftLim f x = sSup (f '' Iio x) :=
leftLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Iio x)
#align monotone.left_lim_eq_Sup Monotone.leftLim_eq_sSup
theorem rightLim_eq_sInf [TopologicalSpace α] [OrderTopology α] (h : 𝓝[>] x ≠ ⊥) :
rightLim f x = sInf (f '' Ioi x) :=
rightLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Ioi x)
#align right_lim_eq_Inf Monotone.rightLim_eq_sInf
| Mathlib/Topology/Order/LeftRightLim.lean | 110 | 122 | theorem leftLim_le (h : x ≤ y) : leftLim f x ≤ f y := by |
letI : TopologicalSpace α := Preorder.topology α
haveI : OrderTopology α := ⟨rfl⟩
rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h')
· simpa [leftLim, h'] using hf h
haveI A : NeBot (𝓝[<] x) := neBot_iff.2 h'
rw [leftLim_eq_sSup hf h']
refine csSup_le ?_ ?_
· simp only [image_nonempty]
exact (forall_mem_nonempty_iff_neBot.2 A) _ self_mem_nhdsWithin
· simp only [mem_image, mem_Iio, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
intro z hz
exact hf (hz.le.trans h)
| [
" β",
" leftLim f a = y",
" limUnder (𝓝[<] a) f = y",
" leftLim f a = f a",
" leftLim f x ≤ f y",
" sSup (f '' Iio x) ≤ f y",
" (f '' Iio x).Nonempty",
" (Iio x).Nonempty",
" ∀ b ∈ f '' Iio x, b ≤ f y",
" ∀ a < x, f a ≤ f y",
" f z ≤ f y"
] | [
" β",
" leftLim f a = y",
" limUnder (𝓝[<] a) f = y",
" leftLim f a = f a",
" leftLim f x ≤ f y"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.special_functions.log.monotone from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {x y : ℝ}
theorem log_mul_self_monotoneOn : MonotoneOn (fun x : ℝ => log x * x) { x | 1 ≤ x } := by
-- TODO: can be strengthened to exp (-1) ≤ x
simp only [MonotoneOn, mem_setOf_eq]
intro x hex y hey hxy
have y_pos : 0 < y := lt_of_lt_of_le zero_lt_one hey
gcongr
rwa [le_log_iff_exp_le y_pos, Real.exp_zero]
#align real.log_mul_self_monotone_on Real.log_mul_self_monotoneOn
| Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean | 41 | 53 | theorem log_div_self_antitoneOn : AntitoneOn (fun x : ℝ => log x / x) { x | exp 1 ≤ x } := by |
simp only [AntitoneOn, mem_setOf_eq]
intro x hex y hey hxy
have x_pos : 0 < x := (exp_pos 1).trans_le hex
have y_pos : 0 < y := (exp_pos 1).trans_le hey
have hlogx : 1 ≤ log x := by rwa [le_log_iff_exp_le x_pos]
have hyx : 0 ≤ y / x - 1 := by rwa [le_sub_iff_add_le, le_div_iff x_pos, zero_add, one_mul]
rw [div_le_iff y_pos, ← sub_le_sub_iff_right (log x)]
calc
log y - log x = log (y / x) := by rw [log_div y_pos.ne' x_pos.ne']
_ ≤ y / x - 1 := log_le_sub_one_of_pos (div_pos y_pos x_pos)
_ ≤ log x * (y / x - 1) := le_mul_of_one_le_left hyx hlogx
_ = log x / x * y - log x := by ring
| [
" MonotoneOn (fun x => x.log * x) {x | 1 ≤ x}",
" ∀ ⦃a : ℝ⦄, 1 ≤ a → ∀ ⦃b : ℝ⦄, 1 ≤ b → a ≤ b → a.log * a ≤ b.log * b",
" x.log * x ≤ y.log * y",
" 0 ≤ y.log",
" AntitoneOn (fun x => x.log / x) {x | rexp 1 ≤ x}",
" ∀ ⦃a : ℝ⦄, rexp 1 ≤ a → ∀ ⦃b : ℝ⦄, rexp 1 ≤ b → a ≤ b → b.log / b ≤ a.log / a",
" y.log /... | [
" MonotoneOn (fun x => x.log * x) {x | 1 ≤ x}",
" ∀ ⦃a : ℝ⦄, 1 ≤ a → ∀ ⦃b : ℝ⦄, 1 ≤ b → a ≤ b → a.log * a ≤ b.log * b",
" x.log * x ≤ y.log * y",
" 0 ≤ y.log",
" AntitoneOn (fun x => x.log / x) {x | rexp 1 ≤ x}"
] |
import Mathlib.Tactic.ApplyFun
import Mathlib.Topology.UniformSpace.Basic
import Mathlib.Topology.Separation
#align_import topology.uniform_space.separation from "leanprover-community/mathlib"@"0c1f285a9f6e608ae2bdffa3f993eafb01eba829"
open Filter Set Function Topology Uniformity UniformSpace
open scoped Classical
noncomputable section
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
variable [UniformSpace α] [UniformSpace β] [UniformSpace γ]
instance (priority := 100) UniformSpace.to_regularSpace : RegularSpace α :=
.of_hasBasis
(fun _ ↦ nhds_basis_uniformity' uniformity_hasBasis_closed)
fun a _V hV ↦ isClosed_ball a hV.2
#align uniform_space.to_regular_space UniformSpace.to_regularSpace
#align separation_rel Inseparable
#noalign separated_equiv
#align separation_rel_iff_specializes specializes_iff_inseparable
#noalign separation_rel_iff_inseparable
theorem Filter.HasBasis.specializes_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)}
(h : (𝓤 α).HasBasis p s) {x y : α} : x ⤳ y ↔ ∀ i, p i → (x, y) ∈ s i :=
(nhds_basis_uniformity h).specializes_iff
theorem Filter.HasBasis.inseparable_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)}
(h : (𝓤 α).HasBasis p s) {x y : α} : Inseparable x y ↔ ∀ i, p i → (x, y) ∈ s i :=
specializes_iff_inseparable.symm.trans h.specializes_iff_uniformity
#align filter.has_basis.mem_separation_rel Filter.HasBasis.inseparable_iff_uniformity
theorem inseparable_iff_ker_uniformity {x y : α} : Inseparable x y ↔ (x, y) ∈ (𝓤 α).ker :=
(𝓤 α).basis_sets.inseparable_iff_uniformity
protected theorem Inseparable.nhds_le_uniformity {x y : α} (h : Inseparable x y) :
𝓝 (x, y) ≤ 𝓤 α := by
rw [h.prod rfl]
apply nhds_le_uniformity
theorem inseparable_iff_clusterPt_uniformity {x y : α} :
Inseparable x y ↔ ClusterPt (x, y) (𝓤 α) := by
refine ⟨fun h ↦ .of_nhds_le h.nhds_le_uniformity, fun h ↦ ?_⟩
simp_rw [uniformity_hasBasis_closed.inseparable_iff_uniformity, isClosed_iff_clusterPt]
exact fun U ⟨hU, hUc⟩ ↦ hUc _ <| h.mono <| le_principal_iff.2 hU
#align separated_space T0Space
theorem t0Space_iff_uniformity :
T0Space α ↔ ∀ x y, (∀ r ∈ 𝓤 α, (x, y) ∈ r) → x = y := by
simp only [t0Space_iff_inseparable, inseparable_iff_ker_uniformity, mem_ker, id]
#align separated_def t0Space_iff_uniformity
theorem t0Space_iff_uniformity' :
T0Space α ↔ Pairwise fun x y ↦ ∃ r ∈ 𝓤 α, (x, y) ∉ r := by
simp [t0Space_iff_not_inseparable, inseparable_iff_ker_uniformity]
#align separated_def' t0Space_iff_uniformity'
| Mathlib/Topology/UniformSpace/Separation.lean | 160 | 163 | theorem t0Space_iff_ker_uniformity : T0Space α ↔ (𝓤 α).ker = diagonal α := by |
simp_rw [t0Space_iff_uniformity, subset_antisymm_iff, diagonal_subset_iff, subset_def,
Prod.forall, Filter.mem_ker, mem_diagonal_iff, iff_self_and]
exact fun _ x s hs ↦ refl_mem_uniformity hs
| [
" 𝓝 (x, y) ≤ 𝓤 α",
" 𝓝 (y, y) ≤ 𝓤 α",
" Inseparable x y ↔ ClusterPt (x, y) (𝓤 α)",
" Inseparable x y",
" ∀ (i : Set (α × α)), (i ∈ 𝓤 α ∧ ∀ (a : α × α), ClusterPt a (𝓟 i) → a ∈ i) → (x, y) ∈ id i",
" T0Space α ↔ ∀ (x y : α), (∀ r ∈ 𝓤 α, (x, y) ∈ r) → x = y",
" T0Space α ↔ Pairwise fun x y => ∃ r ... | [
" 𝓝 (x, y) ≤ 𝓤 α",
" 𝓝 (y, y) ≤ 𝓤 α",
" Inseparable x y ↔ ClusterPt (x, y) (𝓤 α)",
" Inseparable x y",
" ∀ (i : Set (α × α)), (i ∈ 𝓤 α ∧ ∀ (a : α × α), ClusterPt a (𝓟 i) → a ∈ i) → (x, y) ∈ id i",
" T0Space α ↔ ∀ (x y : α), (∀ r ∈ 𝓤 α, (x, y) ∈ r) → x = y",
" T0Space α ↔ Pairwise fun x y => ∃ r ... |
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
| Mathlib/Analysis/Distribution/SchwartzSpace.lean | 103 | 106 | 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 _ _)⟩
| [
" f = g",
" { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ } = g",
" { toFun := toFun✝¹, smooth' := smooth'✝¹, decay' := decay'✝¹ } =\n { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ }",
" ∃ C, 0 < C ∧ ∀ (x : E), ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ C",
" 0 < max C 1"
] | [
" f = g",
" { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ } = g",
" { toFun := toFun✝¹, smooth' := smooth'✝¹, decay' := decay'✝¹ } =\n { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ }",
" ∃ C, 0 < C ∧ ∀ (x : E), ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ C"
] |
import Mathlib.Analysis.InnerProductSpace.Dual
import Mathlib.Analysis.Calculus.FDeriv.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
open Topology InnerProductSpace Set
noncomputable section
variable {𝕜 F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] [CompleteSpace F]
variable {f : F → 𝕜} {f' x : F}
def HasGradientAtFilter (f : F → 𝕜) (f' x : F) (L : Filter F) :=
HasFDerivAtFilter f (toDual 𝕜 F f') x L
def HasGradientWithinAt (f : F → 𝕜) (f' : F) (s : Set F) (x : F) :=
HasGradientAtFilter f f' x (𝓝[s] x)
def HasGradientAt (f : F → 𝕜) (f' x : F) :=
HasGradientAtFilter f f' x (𝓝 x)
def gradientWithin (f : F → 𝕜) (s : Set F) (x : F) : F :=
(toDual 𝕜 F).symm (fderivWithin 𝕜 f s x)
def gradient (f : F → 𝕜) (x : F) : F :=
(toDual 𝕜 F).symm (fderiv 𝕜 f x)
@[inherit_doc]
scoped[Gradient] notation "∇" => gradient
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
open scoped Gradient
variable {s : Set F} {L : Filter F}
theorem hasGradientWithinAt_iff_hasFDerivWithinAt {s : Set F} :
HasGradientWithinAt f f' s x ↔ HasFDerivWithinAt f (toDual 𝕜 F f') s x :=
Iff.rfl
theorem hasFDerivWithinAt_iff_hasGradientWithinAt {frechet : F →L[𝕜] 𝕜} {s : Set F} :
HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x := by
rw [hasGradientWithinAt_iff_hasFDerivWithinAt, (toDual 𝕜 F).apply_symm_apply frechet]
theorem hasGradientAt_iff_hasFDerivAt :
HasGradientAt f f' x ↔ HasFDerivAt f (toDual 𝕜 F f') x :=
Iff.rfl
theorem hasFDerivAt_iff_hasGradientAt {frechet : F →L[𝕜] 𝕜} :
HasFDerivAt f frechet x ↔ HasGradientAt f ((toDual 𝕜 F).symm frechet) x := by
rw [hasGradientAt_iff_hasFDerivAt, (toDual 𝕜 F).apply_symm_apply frechet]
alias ⟨HasGradientWithinAt.hasFDerivWithinAt, _⟩ := hasGradientWithinAt_iff_hasFDerivWithinAt
alias ⟨HasFDerivWithinAt.hasGradientWithinAt, _⟩ := hasFDerivWithinAt_iff_hasGradientWithinAt
alias ⟨HasGradientAt.hasFDerivAt, _⟩ := hasGradientAt_iff_hasFDerivAt
alias ⟨HasFDerivAt.hasGradientAt, _⟩ := hasFDerivAt_iff_hasGradientAt
theorem gradient_eq_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : ∇ f x = 0 := by
rw [gradient, fderiv_zero_of_not_differentiableAt h, map_zero]
theorem HasGradientAt.unique {gradf gradg : F}
(hf : HasGradientAt f gradf x) (hg : HasGradientAt f gradg x) :
gradf = gradg :=
(toDual 𝕜 F).injective (hf.hasFDerivAt.unique hg.hasFDerivAt)
theorem DifferentiableAt.hasGradientAt (h : DifferentiableAt 𝕜 f x) :
HasGradientAt f (∇ f x) x := by
rw [hasGradientAt_iff_hasFDerivAt, gradient, (toDual 𝕜 F).apply_symm_apply (fderiv 𝕜 f x)]
exact h.hasFDerivAt
theorem HasGradientAt.differentiableAt (h : HasGradientAt f f' x) :
DifferentiableAt 𝕜 f x :=
h.hasFDerivAt.differentiableAt
theorem DifferentiableWithinAt.hasGradientWithinAt (h : DifferentiableWithinAt 𝕜 f s x) :
HasGradientWithinAt f (gradientWithin f s x) s x := by
rw [hasGradientWithinAt_iff_hasFDerivWithinAt, gradientWithin,
(toDual 𝕜 F).apply_symm_apply (fderivWithin 𝕜 f s x)]
exact h.hasFDerivWithinAt
theorem HasGradientWithinAt.differentiableWithinAt (h : HasGradientWithinAt f f' s x) :
DifferentiableWithinAt 𝕜 f s x :=
h.hasFDerivWithinAt.differentiableWithinAt
@[simp]
theorem hasGradientWithinAt_univ : HasGradientWithinAt f f' univ x ↔ HasGradientAt f f' x := by
rw [hasGradientWithinAt_iff_hasFDerivWithinAt, hasGradientAt_iff_hasFDerivAt]
exact hasFDerivWithinAt_univ
theorem DifferentiableOn.hasGradientAt (h : DifferentiableOn 𝕜 f s) (hs : s ∈ 𝓝 x) :
HasGradientAt f (∇ f x) x :=
(h.hasFDerivAt hs).hasGradientAt
theorem HasGradientAt.gradient (h : HasGradientAt f f' x) : ∇ f x = f' :=
h.differentiableAt.hasGradientAt.unique h
theorem gradient_eq {f' : F → F} (h : ∀ x, HasGradientAt f (f' x) x) : ∇ f = f' :=
funext fun x => (h x).gradient
section OneDimension
variable {g : 𝕜 → 𝕜} {g' u : 𝕜} {L' : Filter 𝕜}
| Mathlib/Analysis/Calculus/Gradient/Basic.lean | 156 | 160 | theorem HasGradientAtFilter.hasDerivAtFilter (h : HasGradientAtFilter g g' u L') :
HasDerivAtFilter g (starRingEnd 𝕜 g') u L' := by |
have : ContinuousLinearMap.smulRight (1 : 𝕜 →L[𝕜] 𝕜) (starRingEnd 𝕜 g') = (toDual 𝕜 𝕜) g' := by
ext; simp
rwa [HasDerivAtFilter, this]
| [
" HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x",
" HasFDerivAt f frechet x ↔ HasGradientAt f ((toDual 𝕜 F).symm frechet) x",
" ∇ f x = 0",
" HasGradientAt f (∇ f x) x",
" HasFDerivAt f (fderiv 𝕜 f x) x",
" HasGradientWithinAt f (gradientWithin f s x) s x",
"... | [
" HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x",
" HasFDerivAt f frechet x ↔ HasGradientAt f ((toDual 𝕜 F).symm frechet) x",
" ∇ f x = 0",
" HasGradientAt f (∇ f x) x",
" HasFDerivAt f (fderiv 𝕜 f x) x",
" HasGradientWithinAt f (gradientWithin f s x) s x",
"... |
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.Layercake
#align_import analysis.special_functions.japanese_bracket from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped NNReal Filter Topology ENNReal
open Asymptotics Filter Set Real MeasureTheory FiniteDimensional
variable {E : Type*} [NormedAddCommGroup E]
theorem sqrt_one_add_norm_sq_le (x : E) : √((1 : ℝ) + ‖x‖ ^ 2) ≤ 1 + ‖x‖ := by
rw [sqrt_le_left (by positivity)]
simp [add_sq]
#align sqrt_one_add_norm_sq_le sqrt_one_add_norm_sq_le
| Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean | 41 | 46 | theorem one_add_norm_le_sqrt_two_mul_sqrt (x : E) :
(1 : ℝ) + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2) := by |
rw [← sqrt_mul zero_le_two]
have := sq_nonneg (‖x‖ - 1)
apply le_sqrt_of_sq_le
linarith
| [
" √(1 + ‖x‖ ^ 2) ≤ 1 + ‖x‖",
" 0 ≤ 1 + ‖x‖",
" 1 + ‖x‖ ^ 2 ≤ (1 + ‖x‖) ^ 2",
" 1 + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2)",
" 1 + ‖x‖ ≤ √(2 * (1 + ‖x‖ ^ 2))",
" (1 + ‖x‖) ^ 2 ≤ 2 * (1 + ‖x‖ ^ 2)"
] | [
" √(1 + ‖x‖ ^ 2) ≤ 1 + ‖x‖",
" 0 ≤ 1 + ‖x‖",
" 1 + ‖x‖ ^ 2 ≤ (1 + ‖x‖) ^ 2",
" 1 + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2)"
] |
import Mathlib.Data.Nat.Defs
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.log from "leanprover-community/mathlib"@"3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6"
namespace Nat
--@[pp_nodot] porting note: unknown attribute
def log (b : ℕ) : ℕ → ℕ
| n => if h : b ≤ n ∧ 1 < b then log b (n / b) + 1 else 0
decreasing_by
-- putting this in the def triggers the `unusedHavesSuffices` linter:
-- https://github.com/leanprover-community/batteries/issues/428
have : n / b < n := div_lt_self ((Nat.zero_lt_one.trans h.2).trans_le h.1) h.2
decreasing_trivial
#align nat.log Nat.log
@[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 := by
rw [log, dite_eq_right_iff]
simp only [Nat.add_eq_zero_iff, Nat.one_ne_zero, and_false, imp_false, not_and_or, not_le, not_lt]
#align nat.log_eq_zero_iff Nat.log_eq_zero_iff
theorem log_of_lt {b n : ℕ} (hb : n < b) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inl hb)
#align nat.log_of_lt Nat.log_of_lt
theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inr hb)
#align nat.log_of_left_le_one Nat.log_of_left_le_one
@[simp]
theorem log_pos_iff {b n : ℕ} : 0 < log b n ↔ b ≤ n ∧ 1 < b := by
rw [Nat.pos_iff_ne_zero, Ne, log_eq_zero_iff, not_or, not_lt, not_le]
#align nat.log_pos_iff Nat.log_pos_iff
theorem log_pos {b n : ℕ} (hb : 1 < b) (hbn : b ≤ n) : 0 < log b n :=
log_pos_iff.2 ⟨hbn, hb⟩
#align nat.log_pos Nat.log_pos
| Mathlib/Data/Nat/Log.lean | 64 | 66 | theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 := by |
rw [log]
exact if_pos ⟨hn, h⟩
| [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 (n / b) a✝",
" b.log n = 0 ↔ n < b ∨ b ≤ 1",
" (∀ (h : b ≤ n ∧ 1 < b), b.log (n / b) + 1 = 0) ↔ n < b ∨ b ≤ 1",
" 0 < b.log n ↔ b ≤ n ∧ 1 < b",
" b.log n = b.log (n / b) + 1",
" (if h : b ≤ n ∧ 1 < b then b.log (n / b) + 1 else 0) = b.log (n / b)... | [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 (n / b) a✝",
" b.log n = 0 ↔ n < b ∨ b ≤ 1",
" (∀ (h : b ≤ n ∧ 1 < b), b.log (n / b) + 1 = 0) ↔ n < b ∨ b ≤ 1",
" 0 < b.log n ↔ b ≤ n ∧ 1 < b",
" b.log n = b.log (n / b) + 1"
] |
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Algebra.Algebra.Spectrum
import Mathlib.Topology.ContinuousFunction.Algebra
#align_import topology.continuous_function.units from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
variable {X M R 𝕜 : Type*} [TopologicalSpace X]
namespace ContinuousMap
section NormedRing
variable [NormedRing R] [CompleteSpace R]
| Mathlib/Topology/ContinuousFunction/Units.lean | 70 | 79 | theorem continuous_isUnit_unit {f : C(X, R)} (h : ∀ x, IsUnit (f x)) :
Continuous fun x => (h x).unit := by |
refine
continuous_induced_rng.2
(Continuous.prod_mk f.continuous
(MulOpposite.continuous_op.comp (continuous_iff_continuousAt.mpr fun x => ?_)))
have := NormedRing.inverse_continuousAt (h x).unit
simp only
simp only [← Ring.inverse_unit, IsUnit.unit_spec] at this ⊢
exact this.comp (f.continuousAt x)
| [
" Continuous fun x => ⋯.unit",
" ContinuousAt (fun x => ↑((fun x => ⋯.unit) x)⁻¹) x",
" ContinuousAt (fun x => ↑⋯.unit⁻¹) x",
" ContinuousAt (fun x => Ring.inverse (f x)) x"
] | [
" Continuous fun x => ⋯.unit"
] |
import Mathlib.FieldTheory.Normal
import Mathlib.FieldTheory.Perfect
import Mathlib.RingTheory.Localization.Integral
#align_import field_theory.is_alg_closed.basic from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
universe u v w
open scoped Classical Polynomial
open Polynomial
variable (k : Type u) [Field k]
class IsAlgClosed : Prop where
splits : ∀ p : k[X], p.Splits <| RingHom.id k
#align is_alg_closed IsAlgClosed
theorem IsAlgClosed.splits_codomain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : K →+* k}
(p : K[X]) : p.Splits f := by convert IsAlgClosed.splits (p.map f); simp [splits_map_iff]
#align is_alg_closed.splits_codomain IsAlgClosed.splits_codomain
theorem IsAlgClosed.splits_domain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : k →+* K}
(p : k[X]) : p.Splits f :=
Polynomial.splits_of_splits_id _ <| IsAlgClosed.splits _
#align is_alg_closed.splits_domain IsAlgClosed.splits_domain
namespace IsAlgClosed
variable {k}
theorem exists_root [IsAlgClosed k] (p : k[X]) (hp : p.degree ≠ 0) : ∃ x, IsRoot p x :=
exists_root_of_splits _ (IsAlgClosed.splits p) hp
#align is_alg_closed.exists_root IsAlgClosed.exists_root
theorem exists_pow_nat_eq [IsAlgClosed k] (x : k) {n : ℕ} (hn : 0 < n) : ∃ z, z ^ n = x := by
have : degree (X ^ n - C x) ≠ 0 := by
rw [degree_X_pow_sub_C hn x]
exact ne_of_gt (WithBot.coe_lt_coe.2 hn)
obtain ⟨z, hz⟩ := exists_root (X ^ n - C x) this
use z
simp only [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def] at hz
exact sub_eq_zero.1 hz
#align is_alg_closed.exists_pow_nat_eq IsAlgClosed.exists_pow_nat_eq
| Mathlib/FieldTheory/IsAlgClosed/Basic.lean | 99 | 101 | theorem exists_eq_mul_self [IsAlgClosed k] (x : k) : ∃ z, x = z * z := by |
rcases exists_pow_nat_eq x zero_lt_two with ⟨z, rfl⟩
exact ⟨z, sq z⟩
| [
" Splits f p",
" Splits f p ↔ Splits (RingHom.id k) (map f p)",
" ∃ z, z ^ n = x",
" (X ^ n - C x).degree ≠ 0",
" ↑n ≠ 0",
" z ^ n = x",
" ∃ z, x = z * z",
" ∃ z_1, z ^ 2 = z_1 * z_1"
] | [
" Splits f p",
" Splits f p ↔ Splits (RingHom.id k) (map f p)",
" ∃ z, z ^ n = x",
" (X ^ n - C x).degree ≠ 0",
" ↑n ≠ 0",
" z ^ n = x",
" ∃ z, x = z * z"
] |
import Mathlib.Data.Matrix.Notation
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.Fin.Tuple.Reflection
#align_import data.matrix.reflection from "leanprover-community/mathlib"@"820b22968a2bc4a47ce5cf1d2f36a9ebe52510aa"
open Matrix
namespace Matrix
variable {l m n : ℕ} {α β : Type*}
def Forall : ∀ {m n} (_ : Matrix (Fin m) (Fin n) α → Prop), Prop
| 0, _, P => P (of ![])
| _ + 1, _, P => FinVec.Forall fun r => Forall fun A => P (of (Matrix.vecCons r A))
#align matrix.forall Matrix.Forall
theorem forall_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Forall P ↔ ∀ x, P x
| 0, n, P => Iff.symm Fin.forall_fin_zero_pi
| m + 1, n, P => by
simp only [Forall, FinVec.forall_iff, forall_iff]
exact Iff.symm Fin.forall_fin_succ_pi
#align matrix.forall_iff Matrix.forall_iff
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∀ x, P x) ↔ ∀ a b c d e f, P !![a, b, c; d, e, f] :=
(forall_iff _).symm
def Exists : ∀ {m n} (_ : Matrix (Fin m) (Fin n) α → Prop), Prop
| 0, _, P => P (of ![])
| _ + 1, _, P => FinVec.Exists fun r => Exists fun A => P (of (Matrix.vecCons r A))
#align matrix.exists Matrix.Exists
theorem exists_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Exists P ↔ ∃ x, P x
| 0, n, P => Iff.symm Fin.exists_fin_zero_pi
| m + 1, n, P => by
simp only [Exists, FinVec.exists_iff, exists_iff]
exact Iff.symm Fin.exists_fin_succ_pi
#align matrix.exists_iff Matrix.exists_iff
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∃ x, P x) ↔ ∃ a b c d e f, P !![a, b, c; d, e, f] :=
(exists_iff _).symm
def transposeᵣ : ∀ {m n}, Matrix (Fin m) (Fin n) α → Matrix (Fin n) (Fin m) α
| _, 0, _ => of ![]
| _, _ + 1, A =>
of <| vecCons (FinVec.map (fun v : Fin _ → α => v 0) A) (transposeᵣ (A.submatrix id Fin.succ))
#align matrix.transposeᵣ Matrix.transposeᵣ
@[simp]
theorem transposeᵣ_eq : ∀ {m n} (A : Matrix (Fin m) (Fin n) α), transposeᵣ A = transpose A
| _, 0, A => Subsingleton.elim _ _
| m, n + 1, A =>
Matrix.ext fun i j => by
simp_rw [transposeᵣ, transposeᵣ_eq]
refine i.cases ?_ fun i => ?_
· dsimp
rw [FinVec.map_eq, Function.comp_apply]
· simp only [of_apply, Matrix.cons_val_succ]
rfl
#align matrix.transposeᵣ_eq Matrix.transposeᵣ_eq
example (a b c d : α) : transpose !![a, b; c, d] = !![a, c; b, d] :=
(transposeᵣ_eq _).symm
def dotProductᵣ [Mul α] [Add α] [Zero α] {m} (a b : Fin m → α) : α :=
FinVec.sum <| FinVec.seq (FinVec.map (· * ·) a) b
#align matrix.dot_productᵣ Matrix.dotProductᵣ
@[simp]
theorem dotProductᵣ_eq [Mul α] [AddCommMonoid α] {m} (a b : Fin m → α) :
dotProductᵣ a b = dotProduct a b := by
simp_rw [dotProductᵣ, dotProduct, FinVec.sum_eq, FinVec.seq_eq, FinVec.map_eq,
Function.comp_apply]
#align matrix.dot_productᵣ_eq Matrix.dotProductᵣ_eq
example (a b c d : α) [Mul α] [AddCommMonoid α] : dotProduct ![a, b] ![c, d] = a * c + b * d :=
(dotProductᵣ_eq _ _).symm
def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matrix (Fin m) (Fin n) α) :
Matrix (Fin l) (Fin n) α :=
of <| FinVec.map (fun v₁ => FinVec.map (fun v₂ => dotProductᵣ v₁ v₂) Bᵀ) A
#align matrix.mulᵣ Matrix.mulᵣ
@[simp]
theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
(B : Matrix (Fin m) (Fin n) α) : mulᵣ A B = A * B := by
simp [mulᵣ, Function.comp, Matrix.transpose]
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂] * !![b₁₁, b₁₂; b₂₁, b₂₂] =
!![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂;
a₂₁ * b₁₁ + a₂₂ * b₂₁, a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
(mulᵣ_eq _ _).symm
def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) : Fin l → α :=
FinVec.map (fun a => dotProductᵣ a v) A
#align matrix.mul_vecᵣ Matrix.mulVecᵣ
@[simp]
| Mathlib/Data/Matrix/Reflection.lean | 185 | 188 | theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) :
mulVecᵣ A v = A *ᵥ v := by |
simp [mulVecᵣ, Function.comp]
rfl
| [
" Forall P ↔ ∀ (x : Matrix (Fin (m + 1)) (Fin n) α), P x",
" (∀ (x : Fin n → α) (x_1 : Matrix (Fin m) (Fin n) α), P (of (vecCons x x_1))) ↔\n ∀ (x : Matrix (Fin (m + 1)) (Fin n) α), P x",
" Exists P ↔ ∃ x, P x",
" (∃ r A, P (of (vecCons r A))) ↔ ∃ x, P x",
" A.transposeᵣ i j = Aᵀ i j",
" of (vecCons (F... | [
" Forall P ↔ ∀ (x : Matrix (Fin (m + 1)) (Fin n) α), P x",
" (∀ (x : Fin n → α) (x_1 : Matrix (Fin m) (Fin n) α), P (of (vecCons x x_1))) ↔\n ∀ (x : Matrix (Fin (m + 1)) (Fin n) α), P x",
" Exists P ↔ ∃ x, P x",
" (∃ r A, P (of (vecCons r A))) ↔ ∃ x, P x",
" A.transposeᵣ i j = Aᵀ i j",
" of (vecCons (F... |
import Mathlib.Topology.UniformSpace.Cauchy
import Mathlib.Topology.UniformSpace.Separation
import Mathlib.Topology.DenseEmbedding
#align_import topology.uniform_space.uniform_embedding from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c"
open Filter Function Set Uniformity Topology
section
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w} [UniformSpace α] [UniformSpace β] [UniformSpace γ]
@[mk_iff]
structure UniformInducing (f : α → β) : Prop where
comap_uniformity : comap (fun x : α × α => (f x.1, f x.2)) (𝓤 β) = 𝓤 α
#align uniform_inducing UniformInducing
#align uniform_inducing_iff uniformInducing_iff
lemma uniformInducing_iff_uniformSpace {f : α → β} :
UniformInducing f ↔ ‹UniformSpace β›.comap f = ‹UniformSpace α› := by
rw [uniformInducing_iff, UniformSpace.ext_iff, Filter.ext_iff]
rfl
protected alias ⟨UniformInducing.comap_uniformSpace, _⟩ := uniformInducing_iff_uniformSpace
#align uniform_inducing.comap_uniform_space UniformInducing.comap_uniformSpace
lemma uniformInducing_iff' {f : α → β} :
UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α := by
rw [uniformInducing_iff, UniformContinuous, tendsto_iff_comap, le_antisymm_iff, and_comm]; rfl
#align uniform_inducing_iff' uniformInducing_iff'
protected lemma Filter.HasBasis.uniformInducing_iff {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'}
(h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} :
UniformInducing f ↔
(∀ i, p' i → ∃ j, p j ∧ ∀ x y, (x, y) ∈ s j → (f x, f y) ∈ s' i) ∧
(∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by
simp [uniformInducing_iff', h.uniformContinuous_iff h', (h'.comap _).le_basis_iff h, subset_def]
#align filter.has_basis.uniform_inducing_iff Filter.HasBasis.uniformInducing_iff
theorem UniformInducing.mk' {f : α → β}
(h : ∀ s, s ∈ 𝓤 α ↔ ∃ t ∈ 𝓤 β, ∀ x y : α, (f x, f y) ∈ t → (x, y) ∈ s) : UniformInducing f :=
⟨by simp [eq_comm, Filter.ext_iff, subset_def, h]⟩
#align uniform_inducing.mk' UniformInducing.mk'
theorem uniformInducing_id : UniformInducing (@id α) :=
⟨by rw [← Prod.map_def, Prod.map_id, comap_id]⟩
#align uniform_inducing_id uniformInducing_id
theorem UniformInducing.comp {g : β → γ} (hg : UniformInducing g) {f : α → β}
(hf : UniformInducing f) : UniformInducing (g ∘ f) :=
⟨by rw [← hf.1, ← hg.1, comap_comap]; rfl⟩
#align uniform_inducing.comp UniformInducing.comp
| Mathlib/Topology/UniformSpace/UniformEmbedding.lean | 76 | 80 | theorem UniformInducing.of_comp_iff {g : β → γ} (hg : UniformInducing g) {f : α → β} :
UniformInducing (g ∘ f) ↔ UniformInducing f := by |
refine ⟨fun h ↦ ?_, hg.comp⟩
rw [uniformInducing_iff, ← hg.comap_uniformity, comap_comap, ← h.comap_uniformity,
Function.comp, Function.comp]
| [
" UniformInducing f ↔ UniformSpace.comap f inst✝¹ = inst✝²",
" (∀ (s : Set (α × α)), s ∈ comap (fun x => (f x.1, f x.2)) (𝓤 β) ↔ s ∈ 𝓤 α) ↔ ∀ (s : Set (α × α)), s ∈ 𝓤 α ↔ s ∈ 𝓤 α",
" UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α",
" 𝓤 α ≤ comap (fun x => (f x.1, f x.2)) (𝓤... | [
" UniformInducing f ↔ UniformSpace.comap f inst✝¹ = inst✝²",
" (∀ (s : Set (α × α)), s ∈ comap (fun x => (f x.1, f x.2)) (𝓤 β) ↔ s ∈ 𝓤 α) ↔ ∀ (s : Set (α × α)), s ∈ 𝓤 α ↔ s ∈ 𝓤 α",
" UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α",
" 𝓤 α ≤ comap (fun x => (f x.1, f x.2)) (𝓤... |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
| Mathlib/Algebra/RingQuot.lean | 62 | 64 | theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by |
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
| [
" Rel r (a + b) (a + c)",
" Rel r (b + a) (c + a)"
] | [
" Rel r (a + b) (a + c)"
] |
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import data.multiset.lattice from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
namespace Multiset
variable {α : Type*}
section Sup
-- can be defined with just `[Bot α]` where some lemmas hold without requiring `[OrderBot α]`
variable [SemilatticeSup α] [OrderBot α]
def sup (s : Multiset α) : α :=
s.fold (· ⊔ ·) ⊥
#align multiset.sup Multiset.sup
@[simp]
theorem sup_coe (l : List α) : sup (l : Multiset α) = l.foldr (· ⊔ ·) ⊥ :=
rfl
#align multiset.sup_coe Multiset.sup_coe
@[simp]
theorem sup_zero : (0 : Multiset α).sup = ⊥ :=
fold_zero _ _
#align multiset.sup_zero Multiset.sup_zero
@[simp]
theorem sup_cons (a : α) (s : Multiset α) : (a ::ₘ s).sup = a ⊔ s.sup :=
fold_cons_left _ _ _ _
#align multiset.sup_cons Multiset.sup_cons
@[simp]
theorem sup_singleton {a : α} : ({a} : Multiset α).sup = a := sup_bot_eq _
#align multiset.sup_singleton Multiset.sup_singleton
@[simp]
theorem sup_add (s₁ s₂ : Multiset α) : (s₁ + s₂).sup = s₁.sup ⊔ s₂.sup :=
Eq.trans (by simp [sup]) (fold_add _ _ _ _ _)
#align multiset.sup_add Multiset.sup_add
@[simp]
theorem sup_le {s : Multiset α} {a : α} : s.sup ≤ a ↔ ∀ b ∈ s, b ≤ a :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and])
#align multiset.sup_le Multiset.sup_le
theorem le_sup {s : Multiset α} {a : α} (h : a ∈ s) : a ≤ s.sup :=
sup_le.1 le_rfl _ h
#align multiset.le_sup Multiset.le_sup
theorem sup_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₁.sup ≤ s₂.sup :=
sup_le.2 fun _ hb => le_sup (h hb)
#align multiset.sup_mono Multiset.sup_mono
variable [DecidableEq α]
@[simp]
theorem sup_dedup (s : Multiset α) : (dedup s).sup = s.sup :=
fold_dedup_idem _ _ _
#align multiset.sup_dedup Multiset.sup_dedup
@[simp]
theorem sup_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).sup = s₁.sup ⊔ s₂.sup := by
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_add]; simp
#align multiset.sup_ndunion Multiset.sup_ndunion
@[simp]
theorem sup_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).sup = s₁.sup ⊔ s₂.sup := by
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_add]; simp
#align multiset.sup_union Multiset.sup_union
@[simp]
| Mathlib/Data/Multiset/Lattice.lean | 89 | 90 | theorem sup_ndinsert (a : α) (s : Multiset α) : (ndinsert a s).sup = a ⊔ s.sup := by |
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_cons]; simp
| [
" (s₁ + s₂).sup = fold (fun x x_1 => x ⊔ x_1) (⊥ ⊔ ⊥) (s₁ + s₂)",
" sup 0 ≤ a ↔ ∀ b ∈ 0, b ≤ a",
" ∀ (a_1 : α) (s : Multiset α), (s.sup ≤ a ↔ ∀ b ∈ s, b ≤ a) → ((a_1 ::ₘ s).sup ≤ a ↔ ∀ b ∈ a_1 ::ₘ s, b ≤ a)",
" (s₁.ndunion s₂).sup = s₁.sup ⊔ s₂.sup",
" ∀ (a : α), a ∈ s₁.ndunion s₂ ↔ a ∈ s₁ + s₂",
" (s₁ ∪ ... | [
" (s₁ + s₂).sup = fold (fun x x_1 => x ⊔ x_1) (⊥ ⊔ ⊥) (s₁ + s₂)",
" sup 0 ≤ a ↔ ∀ b ∈ 0, b ≤ a",
" ∀ (a_1 : α) (s : Multiset α), (s.sup ≤ a ↔ ∀ b ∈ s, b ≤ a) → ((a_1 ::ₘ s).sup ≤ a ↔ ∀ b ∈ a_1 ::ₘ s, b ≤ a)",
" (s₁.ndunion s₂).sup = s₁.sup ⊔ s₂.sup",
" ∀ (a : α), a ∈ s₁.ndunion s₂ ↔ a ∈ s₁ + s₂",
" (s₁ ∪ ... |
import Mathlib.Data.Set.Basic
#align_import data.bundle from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
open Function Set
namespace Bundle
variable {B F : Type*} (E : B → Type*)
@[ext]
structure TotalSpace (F : Type*) (E : B → Type*) where
proj : B
snd : E proj
#align bundle.total_space Bundle.TotalSpace
instance [Inhabited B] [Inhabited (E default)] : Inhabited (TotalSpace F E) :=
⟨⟨default, default⟩⟩
variable {E}
@[inherit_doc]
scoped notation:max "π" F':max E':max => Bundle.TotalSpace.proj (F := F') (E := E')
abbrev TotalSpace.mk' (F : Type*) (x : B) (y : E x) : TotalSpace F E := ⟨x, y⟩
| Mathlib/Data/Bundle.lean | 69 | 70 | theorem TotalSpace.mk_cast {x x' : B} (h : x = x') (b : E x) :
.mk' F x' (cast (congr_arg E h) b) = TotalSpace.mk x b := by | subst h; rfl
| [
" mk' F x' (cast ⋯ b) = { proj := x, snd := b }",
" mk' F x (cast ⋯ b) = { proj := x, snd := b }"
] | [
" mk' F x' (cast ⋯ b) = { proj := x, snd := b }"
] |
import Mathlib.Data.PFunctor.Multivariate.W
import Mathlib.Data.QPF.Multivariate.Basic
#align_import data.qpf.multivariate.constructions.fix from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
universe u v
namespace MvQPF
open TypeVec
open MvFunctor (LiftP LiftR)
open MvFunctor
variable {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u} [MvFunctor F] [q : MvQPF F]
def recF {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) : q.P.W α → β :=
q.P.wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)
set_option linter.uppercaseLean3 false in
#align mvqpf.recF MvQPF.recF
theorem recF_eq {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (a : q.P.A)
(f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :
recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) := by
rw [recF, MvPFunctor.wRec_eq]; rfl
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq MvQPF.recF_eq
theorem recF_eq' {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (x : q.P.W α) :
recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by
apply q.P.w_cases _ x
intro a f' f
rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp]
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq' MvQPF.recF_eq'
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
| ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
(∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
| abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
(f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
| trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
set_option linter.uppercaseLean3 false in
#align mvqpf.Wequiv MvQPF.WEquiv
| Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean | 92 | 104 | theorem recF_eq_of_wEquiv (α : TypeVec n) {β : Type u} (u : F (α.append1 β) → β) (x y : q.P.W α) :
WEquiv x y → recF u x = recF u y := by |
apply q.P.w_cases _ x
intro a₀ f'₀ f₀
apply q.P.w_cases _ y
intro a₁ f'₁ f₁
intro h
-- Porting note: induction on h doesn't work.
refine @WEquiv.recOn _ _ _ _ _ (fun a a' _ ↦ recF u a = recF u a') _ _ h ?_ ?_ ?_
· intros a f' f₀ f₁ _h ih; simp only [recF_eq, Function.comp]
congr; funext; congr; funext; apply ih
· intros a₀ f'₀ f₀ a₁ f'₁ f₁ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h]
· intros x y z _e₁ _e₂ ih₁ ih₂; exact Eq.trans ih₁ ih₂
| [
" recF g ((P F).wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩)",
" g (abs ⟨a, splitFun f' fun i => (P F).wRec (fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)) (f i)⟩) =\n g (abs ⟨a, splitFun f' (((P F).wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)) ∘ f)⟩)",
" recF g x = g (abs ((TypeVec.id ::: r... | [
" recF g ((P F).wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩)",
" g (abs ⟨a, splitFun f' fun i => (P F).wRec (fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)) (f i)⟩) =\n g (abs ⟨a, splitFun f' (((P F).wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)) ∘ f)⟩)",
" recF g x = g (abs ((TypeVec.id ::: r... |
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.LocallyCompactRegular
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c"
open scoped Filter
open Filter Set Metric
theorem setOf_liouville_eq_iInter_iUnion :
{ x | Liouville x } =
⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by
ext x
simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff,
mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
#align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion
| Mathlib/NumberTheory/Liouville/Residual.lean | 34 | 38 | theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by |
rw [setOf_liouville_eq_iInter_iUnion]
refine .iInter fun n => IsOpen.isGδ ?_
refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_
exact isOpen_ball.inter isClosed_singleton.isOpen_compl
| [
" {x | Liouville x} = ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}",
" x ∈ {x | Liouville x} ↔ x ∈ ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}",
" IsGδ {x | Liouville x}",
" IsGδ (⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b})",
"... | [
" {x | Liouville x} = ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}",
" x ∈ {x | Liouville x} ↔ x ∈ ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}",
" IsGδ {x | Liouville x}"
] |
import Mathlib.Data.List.Nodup
#align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {α : Type*}
namespace List
inductive Duplicate (x : α) : List α → Prop
| cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l)
| cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l)
#align list.duplicate List.Duplicate
local infixl:50 " ∈+ " => List.Duplicate
variable {l : List α} {x : α}
theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l :=
Duplicate.cons_mem h
#align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self
theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l :=
Duplicate.cons_duplicate h
#align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons
theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by
induction' h with l' _ y l' _ hm
· exact mem_cons_self _ _
· exact mem_cons_of_mem _ hm
#align list.duplicate.mem List.Duplicate.mem
theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by
cases' h with _ h _ _ h
· exact h
· exact h.mem
#align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self
@[simp]
theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l :=
⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩
#align list.duplicate_cons_self_iff List.duplicate_cons_self_iff
theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem)
#align list.duplicate.ne_nil List.Duplicate.ne_nil
@[simp]
theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl
#align list.not_duplicate_nil List.not_duplicate_nil
theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by
induction' h with l' h z l' h _
· simp [ne_nil_of_mem h]
· simp [ne_nil_of_mem h.mem]
#align list.duplicate.ne_singleton List.Duplicate.ne_singleton
@[simp]
theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl
#align list.not_duplicate_singleton List.not_duplicate_singleton
theorem Duplicate.elim_nil (h : x ∈+ []) : False :=
not_duplicate_nil x h
#align list.duplicate.elim_nil List.Duplicate.elim_nil
theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False :=
not_duplicate_singleton x y h
#align list.duplicate.elim_singleton List.Duplicate.elim_singleton
theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by
refine ⟨fun h => ?_, fun h => ?_⟩
· cases' h with _ hm _ _ hm
· exact Or.inl ⟨rfl, hm⟩
· exact Or.inr hm
· rcases h with (⟨rfl | h⟩ | h)
· simpa
· exact h.cons_duplicate
#align list.duplicate_cons_iff List.duplicate_cons_iff
theorem Duplicate.of_duplicate_cons {y : α} (h : x ∈+ y :: l) (hx : x ≠ y) : x ∈+ l := by
simpa [duplicate_cons_iff, hx.symm] using h
#align list.duplicate.of_duplicate_cons List.Duplicate.of_duplicate_cons
theorem duplicate_cons_iff_of_ne {y : α} (hne : x ≠ y) : x ∈+ y :: l ↔ x ∈+ l := by
simp [duplicate_cons_iff, hne.symm]
#align list.duplicate_cons_iff_of_ne List.duplicate_cons_iff_of_ne
theorem Duplicate.mono_sublist {l' : List α} (hx : x ∈+ l) (h : l <+ l') : x ∈+ l' := by
induction' h with l₁ l₂ y _ IH l₁ l₂ y h IH
· exact hx
· exact (IH hx).duplicate_cons _
· rw [duplicate_cons_iff] at hx ⊢
rcases hx with (⟨rfl, hx⟩ | hx)
· simp [h.subset hx]
· simp [IH hx]
#align list.duplicate.mono_sublist List.Duplicate.mono_sublist
theorem duplicate_iff_sublist : x ∈+ l ↔ [x, x] <+ l := by
induction' l with y l IH
· simp
· by_cases hx : x = y
· simp [hx, cons_sublist_cons, singleton_sublist]
· rw [duplicate_cons_iff_of_ne hx, IH]
refine ⟨sublist_cons_of_sublist y, fun h => ?_⟩
cases h
· assumption
· contradiction
#align list.duplicate_iff_sublist List.duplicate_iff_sublist
| Mathlib/Data/List/Duplicate.lean | 129 | 130 | theorem nodup_iff_forall_not_duplicate : Nodup l ↔ ∀ x : α, ¬x ∈+ l := by |
simp_rw [nodup_iff_sublist, duplicate_iff_sublist]
| [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l",
" y = x ∧ x ∈ l ∨ x ∈+ l",
" x = x ∧ x ∈ l ∨ x ∈+ l",
" x ∈+ y :: l",
" x ∈+ x :: l",
" x ∈+ l",
" x ∈+ y :: l ↔ x ∈+ l",
" x ∈+ l'",
" x ∈+ []",
" x ∈+ y ... | [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l",
" y = x ∧ x ∈ l ∨ x ∈+ l",
" x = x ∧ x ∈ l ∨ x ∈+ l",
" x ∈+ y :: l",
" x ∈+ x :: l",
" x ∈+ l",
" x ∈+ y :: l ↔ x ∈+ l",
" x ∈+ l'",
" x ∈+ []",
" x ∈+ y ... |
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Geometry.Euclidean.Angle.Oriented.Basic
#align_import geometry.euclidean.angle.oriented.rotation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open FiniteDimensional Complex
open scoped Real RealInnerProductSpace ComplexConjugate
namespace Orientation
attribute [local instance] Complex.finrank_real_complex_fact
variable {V V' : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup V']
variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V']
variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2))
local notation "J" => o.rightAngleRotation
def rotationAux (θ : Real.Angle) : V →ₗᵢ[ℝ] V :=
LinearMap.isometryOfInner
(Real.Angle.cos θ • LinearMap.id +
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
intro x y
simp only [RCLike.conj_to_real, id, LinearMap.smul_apply, LinearMap.add_apply,
LinearMap.id_coe, LinearEquiv.coe_coe, LinearIsometryEquiv.coe_toLinearEquiv,
Orientation.areaForm_rightAngleRotation_left, Orientation.inner_rightAngleRotation_left,
Orientation.inner_rightAngleRotation_right, inner_add_left, inner_smul_left,
inner_add_right, inner_smul_right]
linear_combination inner (𝕜 := ℝ) x y * θ.cos_sq_add_sin_sq)
#align orientation.rotation_aux Orientation.rotationAux
@[simp]
theorem rotationAux_apply (θ : Real.Angle) (x : V) :
o.rotationAux θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_aux_apply Orientation.rotationAux_apply
def rotation (θ : Real.Angle) : V ≃ₗᵢ[ℝ] V :=
LinearIsometryEquiv.ofLinearIsometry (o.rotationAux θ)
(Real.Angle.cos θ • LinearMap.id -
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_smul, map_sub, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, ← mul_smul, add_smul,
smul_add, smul_neg, smul_sub, mul_comm, sq]
abel
· simp)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_add, map_smul, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply,
add_smul, smul_neg, smul_sub, smul_smul]
ring_nf
abel
· simp)
#align orientation.rotation Orientation.rotation
theorem rotation_apply (θ : Real.Angle) (x : V) :
o.rotation θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_apply Orientation.rotation_apply
theorem rotation_symm_apply (θ : Real.Angle) (x : V) :
(o.rotation θ).symm x = Real.Angle.cos θ • x - Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_symm_apply Orientation.rotation_symm_apply
theorem rotation_eq_matrix_toLin (θ : Real.Angle) {x : V} (hx : x ≠ 0) :
(o.rotation θ).toLinearMap =
Matrix.toLin (o.basisRightAngleRotation x hx) (o.basisRightAngleRotation x hx)
!![θ.cos, -θ.sin; θ.sin, θ.cos] := by
apply (o.basisRightAngleRotation x hx).ext
intro i
fin_cases i
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ]
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ, add_comm]
#align orientation.rotation_eq_matrix_to_lin Orientation.rotation_eq_matrix_toLin
@[simp]
theorem det_rotation (θ : Real.Angle) : LinearMap.det (o.rotation θ).toLinearMap = 1 := by
haveI : Nontrivial V :=
FiniteDimensional.nontrivial_of_finrank_eq_succ (@Fact.out (finrank ℝ V = 2) _)
obtain ⟨x, hx⟩ : ∃ x, x ≠ (0 : V) := exists_ne (0 : V)
rw [o.rotation_eq_matrix_toLin θ hx]
simpa [sq] using θ.cos_sq_add_sin_sq
#align orientation.det_rotation Orientation.det_rotation
@[simp]
theorem linearEquiv_det_rotation (θ : Real.Angle) :
LinearEquiv.det (o.rotation θ).toLinearEquiv = 1 :=
Units.ext <| by
-- Porting note: Lean can't see through `LinearEquiv.coe_det` and needed the rewrite
-- in mathlib3 this was just `units.ext <| o.det_rotation θ`
simpa only [LinearEquiv.coe_det, Units.val_one] using o.det_rotation θ
#align orientation.linear_equiv_det_rotation Orientation.linearEquiv_det_rotation
@[simp]
| Mathlib/Geometry/Euclidean/Angle/Oriented/Rotation.lean | 134 | 135 | theorem rotation_symm (θ : Real.Angle) : (o.rotation θ).symm = o.rotation (-θ) := by |
ext; simp [o.rotation_apply, o.rotation_symm_apply, sub_eq_add_neg]
| [
" ∀ (x y : V),\n ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) y⟫_ℝ =\n ⟪x, y⟫_ℝ",
" ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.r... | [
" ∀ (x y : V),\n ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) y⟫_ℝ =\n ⟪x, y⟫_ℝ",
" ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.r... |
import Mathlib.Computability.Halting
import Mathlib.Computability.TuringMachine
import Mathlib.Data.Num.Lemmas
import Mathlib.Tactic.DeriveFintype
#align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
open Function (update)
open Relation
namespace Turing
namespace ToPartrec
inductive Code
| zero'
| succ
| tail
| cons : Code → Code → Code
| comp : Code → Code → Code
| case : Code → Code → Code
| fix : Code → Code
deriving DecidableEq, Inhabited
#align turing.to_partrec.code Turing.ToPartrec.Code
#align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero'
#align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ
#align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail
#align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons
#align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp
#align turing.to_partrec.code.case Turing.ToPartrec.Code.case
#align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix
def Code.eval : Code → List ℕ →. List ℕ
| Code.zero' => fun v => pure (0 :: v)
| Code.succ => fun v => pure [v.headI.succ]
| Code.tail => fun v => pure v.tail
| Code.cons f fs => fun v => do
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns)
| Code.comp f g => fun v => g.eval v >>= f.eval
| Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail)
| Code.fix f =>
PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail
#align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval
namespace Code
@[simp]
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval]
@[simp]
theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval]
@[simp]
theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval]
@[simp]
theorem cons_eval (f fs) : (cons f fs).eval = fun v => do {
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns) } := by simp [eval]
@[simp]
theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval]
@[simp]
theorem case_eval (f g) :
(case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by
simp [eval]
@[simp]
theorem fix_eval (f) : (fix f).eval =
PFun.fix fun v => (f.eval v).map fun v =>
if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by
simp [eval]
def nil : Code :=
tail.comp succ
#align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil
@[simp]
| Mathlib/Computability/TMToPartrec.lean | 174 | 174 | theorem nil_eval (v) : nil.eval v = pure [] := by | simp [nil]
| [
" zero'.eval = fun v => pure (0 :: v)",
" succ.eval = fun v => pure [v.headI.succ]",
" tail.eval = fun v => pure v.tail",
" (f.cons fs).eval = fun v => do\n let n ← f.eval v\n let ns ← fs.eval v\n pure (n.headI :: ns)",
" (f.comp g).eval = fun v => g.eval v >>= f.eval",
" (f.case g).eval = fun v ... | [
" zero'.eval = fun v => pure (0 :: v)",
" succ.eval = fun v => pure [v.headI.succ]",
" tail.eval = fun v => pure v.tail",
" (f.cons fs).eval = fun v => do\n let n ← f.eval v\n let ns ← fs.eval v\n pure (n.headI :: ns)",
" (f.comp g).eval = fun v => g.eval v >>= f.eval",
" (f.case g).eval = fun v ... |
import Mathlib.MeasureTheory.Measure.Typeclasses
open scoped ENNReal
namespace MeasureTheory
variable {α : Type*}
noncomputable
def Measure.trim {m m0 : MeasurableSpace α} (μ : @Measure α m0) (hm : m ≤ m0) : @Measure α m :=
@OuterMeasure.toMeasure α m μ.toOuterMeasure (hm.trans (le_toOuterMeasure_caratheodory μ))
#align measure_theory.measure.trim MeasureTheory.Measure.trim
@[simp]
theorem trim_eq_self [MeasurableSpace α] {μ : Measure α} : μ.trim le_rfl = μ := by
simp [Measure.trim]
#align measure_theory.trim_eq_self MeasureTheory.trim_eq_self
variable {m m0 : MeasurableSpace α} {μ : Measure α} {s : Set α}
| Mathlib/MeasureTheory/Measure/Trim.lean | 43 | 45 | theorem toOuterMeasure_trim_eq_trim_toOuterMeasure (μ : Measure α) (hm : m ≤ m0) :
@Measure.toOuterMeasure _ m (μ.trim hm) = @OuterMeasure.trim _ m μ.toOuterMeasure := by |
rw [Measure.trim, toMeasure_toOuterMeasure (ms := m)]
| [
" μ.trim ⋯ = μ",
" (μ.trim hm).toOuterMeasure = μ.trim"
] | [
" μ.trim ⋯ = μ",
" (μ.trim hm).toOuterMeasure = μ.trim"
] |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator
import Mathlib.MeasureTheory.Function.UniformIntegrable
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
#align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α}
theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ}
(hf : Integrable f μ) :
SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by
refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_
· exact fun _ _ _ => (integrable_of_integrable_trim hm
(SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn
· intro s hs _
conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs,
← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm)
(hf.withDensityᵥ_trim_absolutelyContinuous hm)]
rw [withDensityᵥ_apply
(SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs,
← setIntegral_trim hm _ hs]
exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable
· exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable'
#align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp
-- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality
-- for the conditional expectation (not in mathlib yet) .
theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by
by_cases hf : Integrable f μ
swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _
by_cases hm : m ≤ m0
swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _
by_cases hsig : SigmaFinite (μ.trim hm)
swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _
calc
snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by
refine snorm_mono_ae ?_
filter_upwards [condexp_mono hf hf.abs
(ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)),
EventuallyLE.trans (condexp_neg f).symm.le
(condexp_mono hf.neg hf.abs
(ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂
exact abs_le_abs hx₁ hx₂
_ = snorm f 1 μ := by
rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ←
ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ←
integral_norm_eq_lintegral_nnnorm
(stronglyMeasurable_condexp.mono hm).aestronglyMeasurable,
← integral_norm_eq_lintegral_nnnorm hf.1]
simp_rw [Real.norm_eq_abs]
rw [← integral_condexp hm hf.abs]
refine integral_congr_ae ?_
have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by
rw [← condexp_zero]
exact condexp_mono (integrable_zero _ _ _) hf.abs
(ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|))
filter_upwards [this] with x hx
exact abs_eq_self.2 hx
#align measure_theory.snorm_one_condexp_le_snorm MeasureTheory.snorm_one_condexp_le_snorm
theorem integral_abs_condexp_le (f : α → ℝ) : ∫ x, |(μ[f|m]) x| ∂μ ≤ ∫ x, |f x| ∂μ := by
by_cases hm : m ≤ m0
swap
· simp_rw [condexp_of_not_le hm, Pi.zero_apply, abs_zero, integral_zero]
positivity
by_cases hfint : Integrable f μ
swap
· simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul,
mul_zero]
positivity
rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae]
· rw [ENNReal.toReal_le_toReal] <;> simp_rw [← Real.norm_eq_abs, ofReal_norm_eq_coe_nnnorm]
· rw [← snorm_one_eq_lintegral_nnnorm, ← snorm_one_eq_lintegral_nnnorm]
exact snorm_one_condexp_le_snorm _
· exact integrable_condexp.2.ne
· exact hfint.2.ne
· filter_upwards with x using abs_nonneg _
· simp_rw [← Real.norm_eq_abs]
exact hfint.1.norm
· filter_upwards with x using abs_nonneg _
· simp_rw [← Real.norm_eq_abs]
exact (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable.norm
#align measure_theory.integral_abs_condexp_le MeasureTheory.integral_abs_condexp_le
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean | 116 | 138 | theorem setIntegral_abs_condexp_le {s : Set α} (hs : MeasurableSet[m] s) (f : α → ℝ) :
∫ x in s, |(μ[f|m]) x| ∂μ ≤ ∫ x in s, |f x| ∂μ := by |
by_cases hnm : m ≤ m0
swap
· simp_rw [condexp_of_not_le hnm, Pi.zero_apply, abs_zero, integral_zero]
positivity
by_cases hfint : Integrable f μ
swap
· simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul,
mul_zero]
positivity
have : ∫ x in s, |(μ[f|m]) x| ∂μ = ∫ x, |(μ[s.indicator f|m]) x| ∂μ := by
rw [← integral_indicator (hnm _ hs)]
refine integral_congr_ae ?_
have : (fun x => |(μ[s.indicator f|m]) x|) =ᵐ[μ] fun x => |s.indicator (μ[f|m]) x| :=
(condexp_indicator hfint hs).fun_comp abs
refine EventuallyEq.trans (eventually_of_forall fun x => ?_) this.symm
rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm]
simp only [Real.norm_eq_abs]
rw [this, ← integral_indicator (hnm _ hs)]
refine (integral_abs_condexp_le _).trans
(le_of_eq <| integral_congr_ae <| eventually_of_forall fun x => ?_)
simp_rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm]
| [
" SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᶠ[ae μ] μ[f|m]",
" ∀ (s : Set α),\n MeasurableSet s → μ s < ⊤ → IntegrableOn (SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) s μ",
" ∀ (s : Set α),\n MeasurableSet s →\n μ s < ⊤ →\n ∫ (x : α) in s, SignedMeasure... | [
" SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᶠ[ae μ] μ[f|m]",
" ∀ (s : Set α),\n MeasurableSet s → μ s < ⊤ → IntegrableOn (SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) s μ",
" ∀ (s : Set α),\n MeasurableSet s →\n μ s < ⊤ →\n ∫ (x : α) in s, SignedMeasure... |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.NormedSpace.FiniteDimension
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Function Set Filter
open scoped Topology Filter
variable {E X : Type*}
structure ContDiffBump (c : E) where
(rIn rOut : ℝ)
rIn_pos : 0 < rIn
rIn_lt_rOut : rIn < rOut
#align cont_diff_bump ContDiffBump
#align cont_diff_bump.r ContDiffBump.rIn
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.R ContDiffBump.rOut
#align cont_diff_bump.r_pos ContDiffBump.rIn_pos
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.r_lt_R ContDiffBump.rIn_lt_rOut
-- Porting note(#5171): linter not yet ported; was @[nolint has_nonempty_instance]
structure ContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where
toFun : ℝ → E → ℝ
mem_Icc : ∀ (R : ℝ) (x : E), toFun R x ∈ Icc (0 : ℝ) 1
symmetric : ∀ (R : ℝ) (x : E), toFun R (-x) = toFun R x
smooth : ContDiffOn ℝ ⊤ (uncurry toFun) (Ioi (1 : ℝ) ×ˢ (univ : Set E))
eq_one : ∀ R : ℝ, 1 < R → ∀ x : E, ‖x‖ ≤ 1 → toFun R x = 1
support : ∀ R : ℝ, 1 < R → Function.support (toFun R) = Metric.ball (0 : E) R
#align cont_diff_bump_base ContDiffBumpBase
class HasContDiffBump (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop where
out : Nonempty (ContDiffBumpBase E)
#align has_cont_diff_bump HasContDiffBump
def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E]
[hb : HasContDiffBump E] : ContDiffBumpBase E :=
Nonempty.some hb.out
#align some_cont_diff_bump_base someContDiffBumpBase
namespace ContDiffBump
theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut :=
f.rIn_pos.trans f.rIn_lt_rOut
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.R_pos ContDiffBump.rOut_pos
theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by
rw [one_lt_div f.rIn_pos]
exact f.rIn_lt_rOut
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.one_lt_R_div_r ContDiffBump.one_lt_rOut_div_rIn
instance (c : E) : Inhabited (ContDiffBump c) :=
⟨⟨1, 2, zero_lt_one, one_lt_two⟩⟩
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup X] [NormedSpace ℝ X]
[HasContDiffBump E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞}
@[coe] def toFun {c : E} (f : ContDiffBump c) : E → ℝ :=
(someContDiffBumpBase E).toFun (f.rOut / f.rIn) ∘ fun x ↦ (f.rIn⁻¹ • (x - c))
#align cont_diff_bump.to_fun ContDiffBump.toFun
instance : CoeFun (ContDiffBump c) fun _ => E → ℝ :=
⟨toFun⟩
protected theorem apply (x : E) :
f x = (someContDiffBumpBase E).toFun (f.rOut / f.rIn) (f.rIn⁻¹ • (x - c)) :=
rfl
#align cont_diff_bump.def ContDiffBump.apply
protected theorem sub (x : E) : f (c - x) = f (c + x) := by
simp [f.apply, ContDiffBumpBase.symmetric]
#align cont_diff_bump.sub ContDiffBump.sub
protected theorem neg (f : ContDiffBump (0 : E)) (x : E) : f (-x) = f x := by
simp_rw [← zero_sub, f.sub, zero_add]
#align cont_diff_bump.neg ContDiffBump.neg
open Metric
theorem one_of_mem_closedBall (hx : x ∈ closedBall c f.rIn) : f x = 1 := by
apply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn
simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, ← div_eq_inv_mul,
div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx
#align cont_diff_bump.one_of_mem_closed_ball ContDiffBump.one_of_mem_closedBall
theorem nonneg : 0 ≤ f x :=
(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).1
#align cont_diff_bump.nonneg ContDiffBump.nonneg
theorem nonneg' (x : E) : 0 ≤ f x := f.nonneg
#align cont_diff_bump.nonneg' ContDiffBump.nonneg'
theorem le_one : f x ≤ 1 :=
(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).2
#align cont_diff_bump.le_one ContDiffBump.le_one
theorem support_eq : Function.support f = Metric.ball c f.rOut := by
simp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn]
ext x
simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv,
abs_of_pos f.rIn_pos, ← div_eq_inv_mul, div_lt_div_right f.rIn_pos]
#align cont_diff_bump.support_eq ContDiffBump.support_eq
| Mathlib/Analysis/Calculus/BumpFunction/Basic.lean | 179 | 180 | theorem tsupport_eq : tsupport f = closedBall c f.rOut := by |
simp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']
| [
" 1 < f.rOut / f.rIn",
" f.rIn < f.rOut",
" ↑f (c - x) = ↑f (c + x)",
" ↑f (-x) = ↑f x",
" ↑f x = 1",
" ‖(fun x => f.rIn⁻¹ • (x - c)) x‖ ≤ 1",
" support ↑f = ball c f.rOut",
" (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.rOut / f.rIn) = ball c f.rOut",
" x ∈ (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.... | [
" 1 < f.rOut / f.rIn",
" f.rIn < f.rOut",
" ↑f (c - x) = ↑f (c + x)",
" ↑f (-x) = ↑f x",
" ↑f x = 1",
" ‖(fun x => f.rIn⁻¹ • (x - c)) x‖ ≤ 1",
" support ↑f = ball c f.rOut",
" (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.rOut / f.rIn) = ball c f.rOut",
" x ∈ (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.... |
import Mathlib.Data.Set.Equitable
import Mathlib.Logic.Equiv.Fin
import Mathlib.Order.Partition.Finpartition
#align_import order.partition.equipartition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
open Finset Fintype
namespace Finpartition
variable {α : Type*} [DecidableEq α] {s t : Finset α} (P : Finpartition s)
def IsEquipartition : Prop :=
(P.parts : Set (Finset α)).EquitableOn card
#align finpartition.is_equipartition Finpartition.IsEquipartition
theorem isEquipartition_iff_card_parts_eq_average :
P.IsEquipartition ↔
∀ a : Finset α,
a ∈ P.parts → a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1 := by
simp_rw [IsEquipartition, Finset.equitableOn_iff, P.sum_card_parts]
#align finpartition.is_equipartition_iff_card_parts_eq_average Finpartition.isEquipartition_iff_card_parts_eq_average
variable {P}
lemma not_isEquipartition :
¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card :=
Set.not_equitableOn
theorem _root_.Set.Subsingleton.isEquipartition (h : (P.parts : Set (Finset α)).Subsingleton) :
P.IsEquipartition :=
Set.Subsingleton.equitableOn h _
#align finpartition.set.subsingleton.is_equipartition Set.Subsingleton.isEquipartition
theorem IsEquipartition.card_parts_eq_average (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 :=
P.isEquipartition_iff_card_parts_eq_average.1 hP _ ht
#align finpartition.is_equipartition.card_parts_eq_average Finpartition.IsEquipartition.card_parts_eq_average
theorem IsEquipartition.card_part_eq_average_iff (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1 := by
have a := hP.card_parts_eq_average ht
have b : ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1) := by
by_contra h; exact absurd (h.1 ▸ h.2) (lt_add_one _).ne
tauto
theorem IsEquipartition.average_le_card_part (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
s.card / P.parts.card ≤ t.card := by
rw [← P.sum_card_parts]
exact Finset.EquitableOn.le hP ht
#align finpartition.is_equipartition.average_le_card_part Finpartition.IsEquipartition.average_le_card_part
| Mathlib/Order/Partition/Equipartition.lean | 74 | 77 | theorem IsEquipartition.card_part_le_average_add_one (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card ≤ s.card / P.parts.card + 1 := by |
rw [← P.sum_card_parts]
exact Finset.EquitableOn.le_add_one hP ht
| [
" P.IsEquipartition ↔ ∀ a ∈ P.parts, a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1",
" t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1",
" ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1)",
" False",
" s.card / P.parts.card ≤ t.card",
" (∑ i ... | [
" P.IsEquipartition ↔ ∀ a ∈ P.parts, a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1",
" t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1",
" ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1)",
" False",
" s.card / P.parts.card ≤ t.card",
" (∑ i ... |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section ENNReal
variable (μ) {f g : α → ℝ≥0∞}
noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.laverage MeasureTheory.laverage
notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r
notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r
notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r
notation3 (prettyPrint := false)
"⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r
@[simp]
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero]
#align measure_theory.laverage_zero MeasureTheory.laverage_zero
@[simp]
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage]
#align measure_theory.laverage_zero_measure MeasureTheory.laverage_zero_measure
theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl
#align measure_theory.laverage_eq' MeasureTheory.laverage_eq'
theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by
rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul]
#align measure_theory.laverage_eq MeasureTheory.laverage_eq
theorem laverage_eq_lintegral [IsProbabilityMeasure μ] (f : α → ℝ≥0∞) :
⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rw [laverage, measure_univ, inv_one, one_smul]
#align measure_theory.laverage_eq_lintegral MeasureTheory.laverage_eq_lintegral
@[simp]
theorem measure_mul_laverage [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
μ univ * ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, lintegral_zero_measure, laverage_zero_measure, mul_zero]
· rw [laverage_eq, ENNReal.mul_div_cancel' (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)]
#align measure_theory.measure_mul_laverage MeasureTheory.measure_mul_laverage
theorem setLaverage_eq (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = (∫⁻ x in s, f x ∂μ) / μ s := by rw [laverage_eq, restrict_apply_univ]
#align measure_theory.set_laverage_eq MeasureTheory.setLaverage_eq
theorem setLaverage_eq' (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = ∫⁻ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [laverage_eq', restrict_apply_univ]
#align measure_theory.set_laverage_eq' MeasureTheory.setLaverage_eq'
variable {μ}
theorem laverage_congr {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ⨍⁻ x, f x ∂μ = ⨍⁻ x, g x ∂μ := by
simp only [laverage_eq, lintegral_congr_ae h]
#align measure_theory.laverage_congr MeasureTheory.laverage_congr
theorem setLaverage_congr (h : s =ᵐ[μ] t) : ⨍⁻ x in s, f x ∂μ = ⨍⁻ x in t, f x ∂μ := by
simp only [setLaverage_eq, set_lintegral_congr h, measure_congr h]
#align measure_theory.set_laverage_congr MeasureTheory.setLaverage_congr
| Mathlib/MeasureTheory/Integral/Average.lean | 153 | 155 | theorem setLaverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) :
⨍⁻ x in s, f x ∂μ = ⨍⁻ x in s, g x ∂μ := by |
simp only [laverage_eq, set_lintegral_congr_fun hs h]
| [
" ⨍⁻ (_x : α), 0 ∂μ = 0",
" ⨍⁻ (x : α), f x ∂0 = 0",
" ⨍⁻ (x : α), f x ∂μ = (∫⁻ (x : α), f x ∂μ) / μ univ",
" ⨍⁻ (x : α), f x ∂μ = ∫⁻ (x : α), f x ∂μ",
" μ univ * ⨍⁻ (x : α), f x ∂μ = ∫⁻ (x : α), f x ∂μ",
" ⨍⁻ (x : α) in s, f x ∂μ = (∫⁻ (x : α) in s, f x ∂μ) / μ s",
" ⨍⁻ (x : α) in s, f x ∂μ = ∫⁻ (x : α... | [
" ⨍⁻ (_x : α), 0 ∂μ = 0",
" ⨍⁻ (x : α), f x ∂0 = 0",
" ⨍⁻ (x : α), f x ∂μ = (∫⁻ (x : α), f x ∂μ) / μ univ",
" ⨍⁻ (x : α), f x ∂μ = ∫⁻ (x : α), f x ∂μ",
" μ univ * ⨍⁻ (x : α), f x ∂μ = ∫⁻ (x : α), f x ∂μ",
" ⨍⁻ (x : α) in s, f x ∂μ = (∫⁻ (x : α) in s, f x ∂μ) / μ s",
" ⨍⁻ (x : α) in s, f x ∂μ = ∫⁻ (x : α... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.