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 = x + AddMonoid.nsmul n 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 = x * CanonicallyOrderedCommSemiring.npow n x
Raising to the power
(n + 1 : ℕ)
behaves as expected. Multiplication is commutative in a commutative semigroup.
No zero divisors.
Instances
Equations
- (_ : NoZeroDivisors α) = (_ : NoZeroDivisors α)
Equations
- (_ : CovariantClass α α (fun (x x_1 : α) => x * x_1) fun (x x_1 : α) => x ≤ x_1) = (_ : CovariantClass α α (fun (x x_1 : α) => x * x_1) fun (x x_1 : α) => x ≤ x_1)
Equations
- CanonicallyOrderedCommSemiring.toOrderedCommSemiring = let src := inst; OrderedCommSemiring.mk (_ : ∀ (a b : α), a * b = b * a)