Skip to content

Commit

Permalink
chore(Order/Filter/Basic): assert_not_exists OrderedSemiring (#14179)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Jun 27, 2024
1 parent b0640e9 commit 76bb425
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 53 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3349,6 +3349,7 @@ import Mathlib.Order.Filter.Partial
import Mathlib.Order.Filter.Pi
import Mathlib.Order.Filter.Pointwise
import Mathlib.Order.Filter.Prod
import Mathlib.Order.Filter.Ring
import Mathlib.Order.Filter.SmallSets
import Mathlib.Order.Filter.Subsingleton
import Mathlib.Order.Filter.Ultrafilter
Expand Down
1 change: 1 addition & 0 deletions Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.NormedSpace.Dual
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.Order.Filter.Ring

#align_import measure_theory.function.ae_eq_of_integral from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"

Expand Down
26 changes: 2 additions & 24 deletions Mathlib/Order/Filter/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Jeremy Avigad
-/
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Set.Finite

#align_import order.filter.basic from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
Expand Down Expand Up @@ -78,6 +77,8 @@ we do *not* require. This gives `Filter X` better formal properties, in particul
`[NeBot f]` in a number of lemmas and definitions.
-/

assert_not_exists OrderedSemiring

set_option autoImplicit true


Expand Down Expand Up @@ -1871,29 +1872,6 @@ theorem set_eventuallyEq_iff_inf_principal {s t : Set α} {l : Filter α} :
simp only [eventuallyLE_antisymm_iff, le_antisymm_iff, set_eventuallyLE_iff_inf_principal_le]
#align filter.set_eventually_eq_iff_inf_principal Filter.set_eventuallyEq_iff_inf_principal

theorem EventuallyLE.mul_le_mul [MulZeroClass β] [PartialOrder β] [PosMulMono β] [MulPosMono β]
{l : Filter α} {f₁ f₂ g₁ g₂ : α → β} (hf : f₁ ≤ᶠ[l] f₂) (hg : g₁ ≤ᶠ[l] g₂) (hg₀ : 0 ≤ᶠ[l] g₁)
(hf₀ : 0 ≤ᶠ[l] f₂) : f₁ * g₁ ≤ᶠ[l] f₂ * g₂ := by
filter_upwards [hf, hg, hg₀, hf₀] with x using _root_.mul_le_mul
#align filter.eventually_le.mul_le_mul Filter.EventuallyLE.mul_le_mul

@[to_additive EventuallyLE.add_le_add]
theorem EventuallyLE.mul_le_mul' [Mul β] [Preorder β] [CovariantClass β β (· * ·) (· ≤ ·)]
[CovariantClass β β (swap (· * ·)) (· ≤ ·)] {l : Filter α} {f₁ f₂ g₁ g₂ : α → β}
(hf : f₁ ≤ᶠ[l] f₂) (hg : g₁ ≤ᶠ[l] g₂) : f₁ * g₁ ≤ᶠ[l] f₂ * g₂ := by
filter_upwards [hf, hg] with x hfx hgx using _root_.mul_le_mul' hfx hgx
#align filter.eventually_le.mul_le_mul' Filter.EventuallyLE.mul_le_mul'
#align filter.eventually_le.add_le_add Filter.EventuallyLE.add_le_add

theorem EventuallyLE.mul_nonneg [OrderedSemiring β] {l : Filter α} {f g : α → β} (hf : 0 ≤ᶠ[l] f)
(hg : 0 ≤ᶠ[l] g) : 0 ≤ᶠ[l] f * g := by filter_upwards [hf, hg] with x using _root_.mul_nonneg
#align filter.eventually_le.mul_nonneg Filter.EventuallyLE.mul_nonneg

theorem eventually_sub_nonneg [OrderedRing β] {l : Filter α} {f g : α → β} :
0 ≤ᶠ[l] g - f ↔ f ≤ᶠ[l] g :=
eventually_congr <| eventually_of_forall fun _ => sub_nonneg
#align filter.eventually_sub_nonneg Filter.eventually_sub_nonneg

theorem EventuallyLE.sup [SemilatticeSup β] {l : Filter α} {f₁ f₂ g₁ g₂ : α → β} (hf : f₁ ≤ᶠ[l] f₂)
(hg : g₁ ≤ᶠ[l] g₂) : f₁ ⊔ g₁ ≤ᶠ[l] f₂ ⊔ g₂ := by
filter_upwards [hf, hg] with x hfx hgx using sup_le_sup hfx hgx
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Order/Filter/Extr.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Authors: Yury Kudryashov
-/
import Mathlib.Order.Filter.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Algebra.Order.Group.Defs

#align_import order.filter.extr from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Order/Filter/FilterProduct.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Abhimanyu Pallavi Sudhir, Yury Kudryashov
-/
import Mathlib.Order.Filter.Ultrafilter
import Mathlib.Order.Filter.Germ
import Mathlib.Order.Filter.Ring

#align_import order.filter.filter_product from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"

Expand Down
29 changes: 1 addition & 28 deletions Mathlib/Order/Filter/Germ.lean
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ For each of the following structures we prove that if `β` has this structure, t
filter, germ
-/

assert_not_exists OrderedSemiring

namespace Filter

Expand Down Expand Up @@ -842,11 +843,6 @@ instance instOrderedCancelCommMonoid [OrderedCancelCommMonoid β] :
le_of_mul_le_mul_left f g h := inductionOn₃ f g h fun _f _g _h H ↦ H.mono
fun _x ↦ le_of_mul_le_mul_left'

@[to_additive]
instance instOrderedCommGroup [OrderedCommGroup β] : OrderedCommGroup (Germ l β) where
__ := instOrderedCancelCommMonoid
__ := instCommGroup

@[to_additive]
instance instExistsMulOfLE [Mul β] [LE β] [ExistsMulOfLE β] : ExistsMulOfLE (Germ l β) where
exists_mul_of_le {x y} := inductionOn₂ x y fun f g (h : f ≤ᶠ[l] g) ↦ by
Expand All @@ -862,29 +858,6 @@ instance instCanonicallyOrderedCommMonoid [CanonicallyOrderedCommMonoid β] :
__ := instExistsMulOfLE
le_self_mul x y := inductionOn₂ x y fun _ _ ↦ eventually_of_forall fun _ ↦ le_self_mul

instance instOrderedSemiring [OrderedSemiring β] : OrderedSemiring (Germ l β) where
__ := instSemiring
__ := instOrderedAddCommMonoid
zero_le_one := const_le zero_le_one
mul_le_mul_of_nonneg_left x y z := inductionOn₃ x y z fun _f _g _h hfg hh ↦ hh.mp <| hfg.mono
fun _a ↦ mul_le_mul_of_nonneg_left
mul_le_mul_of_nonneg_right x y z := inductionOn₃ x y z fun _f _g _h hfg hh ↦ hh.mp <| hfg.mono
fun _a ↦ mul_le_mul_of_nonneg_right

instance instOrderedCommSemiring [OrderedCommSemiring β] : OrderedCommSemiring (Germ l β) where
__ := instOrderedSemiring
__ := instCommSemiring

instance instOrderedRing [OrderedRing β] : OrderedRing (Germ l β) where
__ := instRing
__ := instOrderedAddCommGroup
__ := instOrderedSemiring
mul_nonneg x y := inductionOn₂ x y fun _f _g hf hg ↦ hg.mp <| hf.mono fun _a ↦ mul_nonneg

instance instOrderedCommRing [OrderedCommRing β] : OrderedCommRing (Germ l β) where
__ := instOrderedRing
__ := instOrderedCommSemiring

end Germ

end Filter
77 changes: 77 additions & 0 deletions Mathlib/Order/Filter/Ring.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/-
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Jeremy Avigad
-/
import Mathlib.Order.Filter.Germ
import Mathlib.Algebra.Order.Ring.Defs

/-!
# Lemmas about filters and ordered rings.
-/
namespace Filter

open Function Filter

universe u v

variable {α : Type u} {β : Type v}

theorem EventuallyLE.mul_le_mul [MulZeroClass β] [PartialOrder β] [PosMulMono β] [MulPosMono β]
{l : Filter α} {f₁ f₂ g₁ g₂ : α → β} (hf : f₁ ≤ᶠ[l] f₂) (hg : g₁ ≤ᶠ[l] g₂) (hg₀ : 0 ≤ᶠ[l] g₁)
(hf₀ : 0 ≤ᶠ[l] f₂) : f₁ * g₁ ≤ᶠ[l] f₂ * g₂ := by
filter_upwards [hf, hg, hg₀, hf₀] with x using _root_.mul_le_mul
#align filter.eventually_le.mul_le_mul Filter.EventuallyLE.mul_le_mul

@[to_additive EventuallyLE.add_le_add]
theorem EventuallyLE.mul_le_mul' [Mul β] [Preorder β] [CovariantClass β β (· * ·) (· ≤ ·)]
[CovariantClass β β (swap (· * ·)) (· ≤ ·)] {l : Filter α} {f₁ f₂ g₁ g₂ : α → β}
(hf : f₁ ≤ᶠ[l] f₂) (hg : g₁ ≤ᶠ[l] g₂) : f₁ * g₁ ≤ᶠ[l] f₂ * g₂ := by
filter_upwards [hf, hg] with x hfx hgx using _root_.mul_le_mul' hfx hgx
#align filter.eventually_le.mul_le_mul' Filter.EventuallyLE.mul_le_mul'
#align filter.eventually_le.add_le_add Filter.EventuallyLE.add_le_add

theorem EventuallyLE.mul_nonneg [OrderedSemiring β] {l : Filter α} {f g : α → β} (hf : 0 ≤ᶠ[l] f)
(hg : 0 ≤ᶠ[l] g) : 0 ≤ᶠ[l] f * g := by filter_upwards [hf, hg] with x using _root_.mul_nonneg
#align filter.eventually_le.mul_nonneg Filter.EventuallyLE.mul_nonneg

theorem eventually_sub_nonneg [OrderedRing β] {l : Filter α} {f g : α → β} :
0 ≤ᶠ[l] g - f ↔ f ≤ᶠ[l] g :=
eventually_congr <| eventually_of_forall fun _ => sub_nonneg
#align filter.eventually_sub_nonneg Filter.eventually_sub_nonneg

namespace Germ

variable {l : Filter α}

@[to_additive]
instance instOrderedCommGroup [OrderedCommGroup β] : OrderedCommGroup (Germ l β) where
__ := instOrderedCancelCommMonoid
__ := instCommGroup

instance instOrderedSemiring [OrderedSemiring β] : OrderedSemiring (Germ l β) where
__ := instSemiring
__ := instOrderedAddCommMonoid
zero_le_one := const_le zero_le_one
mul_le_mul_of_nonneg_left x y z := inductionOn₃ x y z fun _f _g _h hfg hh ↦ hh.mp <| hfg.mono
fun _a ↦ mul_le_mul_of_nonneg_left
mul_le_mul_of_nonneg_right x y z := inductionOn₃ x y z fun _f _g _h hfg hh ↦ hh.mp <| hfg.mono
fun _a ↦ mul_le_mul_of_nonneg_right

instance instOrderedCommSemiring [OrderedCommSemiring β] : OrderedCommSemiring (Germ l β) where
__ := instOrderedSemiring
__ := instCommSemiring

instance instOrderedRing [OrderedRing β] : OrderedRing (Germ l β) where
__ := instRing
__ := instOrderedAddCommGroup
__ := instOrderedSemiring
mul_nonneg x y := inductionOn₂ x y fun _f _g hf hg ↦ hg.mp <| hf.mono fun _a ↦ mul_nonneg

instance instOrderedCommRing [OrderedCommRing β] : OrderedCommRing (Germ l β) where
__ := instOrderedRing
__ := instOrderedCommSemiring

end Germ

end Filter

0 comments on commit 76bb425

Please sign in to comment.