Canonically ordered rings and semirings. #
CanonicallyOrderedCommSemiring
CanonicallyOrderedAddCommMonoid
& multiplication &*
respects≤
& no zero divisorsCommSemiring
&a ≤ b ↔ ∃ c, b = a + c
& no zero divisors
TODO #
We're still missing some typeclasses, like
CanonicallyOrderedSemiring
They have yet to come up in practice.
A canonically ordered commutative semiring is an ordered, commutative semiring in which a ≤ b
iff there exists c
with b = a + c
. This is satisfied by the natural numbers, for example, but
not the integers or other ordered groups.
- add : α → α → α
- zero : α
- nsmul : ℕ → α → α
- nsmul_zero : ∀ (x : α), AddMonoid.nsmul 0 x = 0
- nsmul_succ : ∀ (n : ℕ) (x : α), AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
- le : α → α → Prop
- lt : α → α → Prop
- le_refl : ∀ (a : α), a ≤ a
- bot : α
- mul : α → α → α
Multiplication is left distributive over addition
Multiplication is right distributive over addition
Zero is a left absorbing element for multiplication
Zero is a right absorbing element for multiplication
Multiplication is associative
- one : α
One is a left neutral element for multiplication
One is a right neutral element for multiplication
- natCast : ℕ → α
- natCast_zero : NatCast.natCast 0 = 0
The canonical map
ℕ → R
sends0 : ℕ
to0 : R
. - natCast_succ : ∀ (n : ℕ), NatCast.natCast (n + 1) = NatCast.natCast n + 1
The canonical map
ℕ → R
is a homomorphism. - npow : ℕ → α → α
Raising to the power of a natural number.
- npow_zero : ∀ (x : α), CanonicallyOrderedCommSemiring.npow 0 x = 1
Raising to the power
(0 : ℕ)
gives1
. - npow_succ : ∀ (n : ℕ) (x : α), CanonicallyOrderedCommSemiring.npow (n + 1) x = CanonicallyOrderedCommSemiring.npow n x * x
Raising to the power
(n + 1 : ℕ)
behaves as expected. Multiplication is commutative in a commutative multiplicative magma.
No zero divisors.
Instances
No zero divisors.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- CanonicallyOrderedCommSemiring.toOrderedCommMonoid = OrderedCommMonoid.mk ⋯
Equations
- CanonicallyOrderedCommSemiring.toOrderedCommSemiring = OrderedCommSemiring.mk ⋯
The tsub
version of mul_self_sub_mul_self
. Notably, this holds for Nat
and NNReal
.
The tsub
version of sq_sub_sq
. Notably, this holds for Nat
and NNReal
.