The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V06. Rings, fields and ordered algebra

Mathlib.Algebra.Order.Ring.Defs

30 declarations. Mathlib docs · Source

Ordered rings and semirings

This file develops the basics of ordered (semi)rings.

Each typeclass here comprises

  • an algebraic class (Semiring, CommSemiring, Ring, CommRing)
  • an order class (PartialOrder, LinearOrder)
  • assumptions on how both interact ((strict) monotonicity, canonicity)

For short,

  • "+ respects ≤" means "monotonicity of addition"
  • "+ respects <" means "strict monotonicity of addition"
  • "* respects ≤" means "monotonicity of multiplication by a nonnegative number".
  • "* respects <" means "strict monotonicity of multiplication by a positive number".

Typeclasses

  • IsOrderedRing: Semiring with a partial order such that addition and multiplication by a nonnegative number are both monotone.
  • IsStrictOrderedRing: Nontrivial semiring with a partial order such that addition and multiplication by a positive number are both strictly monotone.

Hierarchy

The hardest part of proving order lemmas might be to figure out the correct generality and its corresponding typeclass. Here's an attempt at demystifying it. For each typeclass, we list its immediate predecessors and what conditions are added to each of them.

  • PartialOrder + Semiring + IsOrderedRing
    • IsOrderedAddMonoid & multiplication & * respects ≤
  • PartialOrder + Semiring + IsStrictOrderedRing
    • IsOrderedCancelAddMonoid & multiplication & * respects < & nontriviality
  • LinearOrder + Ring + IsOrderedRing
    • IsStrictOrderedRing & totality of the order
    • IsDomain & linear order structure

Note that OrderDual does not satisfy any of the ordered ring typeclasses due to the zero_le_one field.

class IsOrderedRing E3 #

(R : Type u_1) → [Semiring R] → [PartialOrder R] → Prop

An ordered semiring is a semiring with a partial order such that addition is monotone and multiplication by a nonnegative number is monotone.

instance IsOrderedRing.toPosMulMono E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsOrderedRing R], PosMulMono R

instance IsOrderedRing.toZeroLEOneClass E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsOrderedRing R], ZeroLEOneClass R

ctor IsOrderedRing.mk E0 #

∀ {R : Type u_1} [inst : Semiring R] [inst_1 : PartialOrder R] [toIsOrderedAddMonoid : IsOrderedAddMonoid R]
  [toZeroLEOneClass : ZeroLEOneClass R] [toPosMulMono : PosMulMono R] [toMulPosMono : MulPosMono R], IsOrderedRing R

instance IsOrderedRing.toIsOrderedAddMonoid E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsOrderedRing R], IsOrderedAddMonoid R

instance IsOrderedRing.toMulPosMono E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsOrderedRing R], MulPosMono R

class IsStrictOrderedRing E3 #

(R : Type u_1) → [Semiring R] → [PartialOrder R] → Prop

A strict ordered semiring is a nontrivial semiring with a partial order such that addition is strictly monotone and multiplication by a positive number is strictly monotone.

instance IsStrictOrderedRing.toMulPosStrictMono E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsStrictOrderedRing R], MulPosStrictMono R

ctor IsStrictOrderedRing.mk E0 #

∀ {R : Type u_1} [inst : Semiring R] [inst_1 : PartialOrder R] [toIsOrderedCancelAddMonoid : IsOrderedCancelAddMonoid R]
  [toZeroLEOneClass : ZeroLEOneClass R] [toNontrivial : Nontrivial R] [toPosMulStrictMono : PosMulStrictMono R]
  [toMulPosStrictMono : MulPosStrictMono R], IsStrictOrderedRing R

instance IsStrictOrderedRing.toIsOrderedCancelAddMonoid E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsStrictOrderedRing R],
  IsOrderedCancelAddMonoid R

instance IsStrictOrderedRing.toNontrivial E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsStrictOrderedRing R], Nontrivial R

instance IsStrictOrderedRing.toZeroLEOneClass E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsStrictOrderedRing R], ZeroLEOneClass R

instance IsStrictOrderedRing.toPosMulStrictMono E0 #

∀ {R : Type u_1} {inst : Semiring R} {inst_1 : PartialOrder R} [self : IsStrictOrderedRing R], PosMulStrictMono R

instance instOrderedRingOfIsStrictOrderedRing E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : PartialOrder R] [IsStrictOrderedRing R], Lean.Grind.OrderedRing R

theorem IsOrderedRing.of_mul_nonneg E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedAddMonoid R] [ZeroLEOneClass R],
  (∀ (a b : R), 0 ≤ a → 0 ≤ b → 0 ≤ a * b) → IsOrderedRing R

theorem IsStrictOrderedRing.of_mul_pos E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedAddMonoid R] [ZeroLEOneClass R] [Nontrivial R],
  (∀ (a b : R), 0 < a → 0 < b → 0 < a * b) → IsStrictOrderedRing R

instance IsOrderedRing.toIsStrictOrderedRing E0 #

∀ (R : Type u_1) [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] [NoZeroDivisors R] [Nontrivial R],
  IsStrictOrderedRing R

Turn an ordered domain into a strict ordered ring.

instance IsStrictOrderedRing.toIsOrderedRing E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : PartialOrder R] [IsStrictOrderedRing R], IsOrderedRing R

theorem AddMonoidWithOne.toCharZero E1 #

∀ {R : Type u_1} [inst : AddMonoidWithOne R] [inst_1 : PartialOrder R] [ZeroLEOneClass R] [NeZero 1]
  [AddLeftStrictMono R], CharZero R

This is not an instance, as it would loop with NeZero.charZero_one.

instance IsStrictOrderedRing.toCharZero E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : PartialOrder R] [IsStrictOrderedRing R], CharZero R

instance IsStrictOrderedRing.toNoMaxOrder E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : PartialOrder R] [IsStrictOrderedRing R], NoMaxOrder R

instance IsStrictOrderedRing.noZeroDivisors E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : LinearOrder R] [IsStrictOrderedRing R] [ExistsAddOfLE R], NoZeroDivisors R

instance IsStrictOrderedRing.isDomain E0 #

∀ {R : Type u} [inst : Semiring R] [inst_1 : LinearOrder R] [IsStrictOrderedRing R] [ExistsAddOfLE R], IsDomain R

theorem one_add_le_one_sub_mul_one_add E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] {a b c : R},
  a + b + b * c ≤ c → 1 + a ≤ (1 - b) * (1 + c)

theorem one_add_le_one_add_mul_one_sub E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] {a b c : R},
  a + c + b * c ≤ b → 1 + a ≤ (1 + b) * (1 - c)

theorem one_sub_le_one_sub_mul_one_add E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] {a b c : R},
  b + b * c ≤ a + c → 1 - a ≤ (1 - b) * (1 + c)

theorem one_sub_le_one_add_mul_one_sub E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] {a b c : R},
  c + b * c ≤ a + b → 1 - a ≤ (1 + b) * (1 - c)

theorem IsOrderedRing.toCharZero E1 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] [Nontrivial R], CharZero R

A nontrivial ordered ring is of characteristic zero. This is not made a global instance for performance reasons.

instance instNoMaxOrderOfNontrivial E0 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] [Nontrivial R], NoMaxOrder R

instance instNoMinOrderOfNontrivial E0 #

∀ {R : Type u} [inst : Ring R] [inst_1 : PartialOrder R] [IsOrderedRing R] [Nontrivial R], NoMinOrder R