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 #
- OrderedSemiring: Semiring with a partial order such that- +and- *respect- ≤.
- StrictOrderedSemiring: Nontrivial semiring with a partial order such that- +and- *respects- <.
- OrderedCommSemiring: Commutative semiring with a partial order such that- +and- *respect- ≤.
- StrictOrderedCommSemiring: Nontrivial commutative semiring with a partial order such that- +and- *respect- <.
- OrderedRing: Ring with a partial order such that- +respects- ≤and- *respects- <.
- OrderedCommRing: Commutative ring with a partial order such that- +respects- ≤and- *respects- <.
- LinearOrderedSemiring: Nontrivial semiring with a linear order such that- +respects- ≤and- *respects- <.
- LinearOrderedCommSemiring: Nontrivial commutative semiring with a linear order such that- +respects- ≤and- *respects- <.
- LinearOrderedRing: Nontrivial ring with a linear order such that- +respects- ≤and- *respects- <.
- LinearOrderedCommRing: Nontrivial commutative ring with a linear order such that- +respects- ≤and- *respects- <.
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.
- OrderedSemiring- OrderedAddCommMonoid& multiplication &- *respects- ≤
- Semiring& partial order structure &- +respects- ≤&- *respects- ≤
 
- StrictOrderedSemiring- OrderedCancelAddCommMonoid& multiplication &- *respects- <& nontriviality
- OrderedSemiring&- +respects- <&- *respects- <& nontriviality
 
- OrderedCommSemiring- OrderedSemiring& commutativity of multiplication
- CommSemiring& partial order structure &- +respects- ≤&- *respects- <
 
- StrictOrderedCommSemiring- StrictOrderedSemiring& commutativity of multiplication
- OrderedCommSemiring&- +respects- <&- *respects- <& nontriviality
 
- OrderedRing- OrderedSemiring& additive inverses
- OrderedAddCommGroup& multiplication &- *respects- <
- Ring& partial order structure &- +respects- ≤&- *respects- <
 
- StrictOrderedRing- StrictOrderedSemiring& additive inverses
- OrderedSemiring&- +respects- <&- *respects- <& nontriviality
 
- OrderedCommRing- OrderedRing& commutativity of multiplication
- OrderedCommSemiring& additive inverses
- CommRing& partial order structure &- +respects- ≤&- *respects- <
 
- StrictOrderedCommRing- StrictOrderedCommSemiring& additive inverses
- StrictOrderedRing& commutativity of multiplication
- OrderedCommRing&- +respects- <&- *respects- <& nontriviality
 
- LinearOrderedSemiring- StrictOrderedSemiring& totality of the order
- LinearOrderedAddCommMonoid& multiplication & nontriviality &- *respects- <
 
- LinearOrderedCommSemiring- StrictOrderedCommSemiring& totality of the order
- LinearOrderedSemiring& commutativity of multiplication
 
- LinearOrderedRing- StrictOrderedRing& totality of the order
- LinearOrderedSemiring& additive inverses
- LinearOrderedAddCommGroup& multiplication &- *respects- <
- Ring&- IsDomain& linear order structure
 
- LinearOrderedCommRing- StrictOrderedCommRing& totality of the order
- LinearOrderedRing& commutativity of multiplication
- LinearOrderedCommSemiring& additive inverses
- CommRing&- IsDomain& linear order structure
 
An ordered semiring is a semiring with a partial order such that addition is monotone and multiplication by a nonnegative number is monotone.
Instances
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.
Instances
Turn an ordered domain into a strict ordered ring.
This is not an instance, as it would loop with NeZero.charZero_one.
Note that OrderDual does not satisfy any of the ordered ring typeclasses due to the
zero_le_one field.
An OrderedSemiring is a semiring with a partial order such that addition is monotone and
multiplication by a nonnegative number is monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- 0 ≤ 1in any ordered semiring.
- In an ordered semiring, we can multiply an inequality - a ≤ bon the left by a non-negative element- 0 ≤ cto obtain- c * a ≤ c * b.
- In an ordered semiring, we can multiply an inequality - a ≤ bon the right by a non-negative element- 0 ≤ cto obtain- a * c ≤ b * c.
Instances For
An OrderedCommSemiring is a commutative semiring with a partial order such that addition is
monotone and multiplication by a nonnegative number is monotone.
Instances For
An OrderedRing is a ring with a partial order such that addition is monotone and
multiplication by a nonnegative number is monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- neg : R → R
- sub : R → R → R
- 0 ≤ 1in any ordered ring.
- The product of non-negative elements is non-negative. 
Instances For
An OrderedCommRing is a commutative ring with a partial order such that addition is monotone
and multiplication by a nonnegative number is monotone.
Instances For
A StrictOrderedSemiring is a nontrivial semiring with a partial order such that addition is
strictly monotone and multiplication by a positive number is strictly monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- In a strict ordered semiring, - 0 ≤ 1.
- Left multiplication by a positive element is strictly monotone. 
- Right multiplication by a positive element is strictly monotone. 
Instances For
A StrictOrderedCommSemiring is a commutative semiring with a partial order such that
addition is strictly monotone and multiplication by a positive number is strictly monotone.
Instances For
A StrictOrderedRing is a ring with a partial order such that addition is strictly monotone
and multiplication by a positive number is strictly monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- neg : R → R
- sub : R → R → R
- In a strict ordered ring, - 0 ≤ 1.
- The product of two positive elements is positive. 
Instances For
A StrictOrderedCommRing is a commutative ring with a partial order such that addition is
strictly monotone and multiplication by a positive number is strictly monotone.
Instances For
A LinearOrderedSemiring is a nontrivial semiring with a linear order such that
addition is monotone and multiplication by a positive number is strictly monotone.
Instances For
A LinearOrderedCommSemiring is a nontrivial commutative semiring with a linear order such
that addition is monotone and multiplication by a positive number is strictly monotone.
Instances For
A LinearOrderedRing is a ring with a linear order such that addition is monotone and
multiplication by a positive number is strictly monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- neg : R → R
- sub : R → R → R
- min : R → R → R
- max : R → R → R
Instances For
A LinearOrderedCommRing is a commutative ring with a linear order such that addition is
monotone and multiplication by a positive number is strictly monotone.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- neg : R → R
- sub : R → R → R
- min : R → R → R
- max : R → R → R