A semiring, i.e. a type equipped with addition, multiplication, and a map from the natural numbers, satisfying appropriate compatibilities.
Use Ring
instead if the type also has negation,
CommSemiring
if the multiplication is commutative,
or CommRing
if the type has negation and multiplication is commutative.
Instance Constructor
Lean.Grind.Semiring.mk.{u}
Extends
Methods
add : α → α → α
mul : α → α → α
natCast : NatCast α
In every semiring there is a canonical map from the natural numbers to the semiring,
providing the values of 0
and 1
. Note that this function need not be injective.
ofNat : (n : Nat) → OfNat α n
Natural number numerals in the semiring.
The field ofNat_eq_natCast
ensures that these are (propositionally) equal to the values of natCast
.
nsmul : HMul Nat α α
Scalar multiplication by natural numbers.
npow : HPow α Nat α
Exponentiation by a natural number.
add_zero : ∀ (a : α), a + 0 = a
Zero is the right identity for addition.
add_comm : ∀ (a b : α), a + b = b + a
Addition is commutative.
add_assoc : ∀ (a b c : α), a + b + c = a + (b + c)
Addition is associative.
mul_assoc : ∀ (a b c : α), a * b * c = a * (b * c)
Multiplication is associative.
mul_one : ∀ (a : α), a * 1 = a
One is the right identity for multiplication.
one_mul : ∀ (a : α), 1 * a = a
One is the left identity for multiplication.
left_distrib : ∀ (a b c : α), a * (b + c) = a * b + a * c
Left distributivity of multiplication over addition.
right_distrib : ∀ (a b c : α), (a + b) * c = a * c + b * c
Right distributivity of multiplication over addition.
zero_mul : ∀ (a : α), 0 * a = 0
Zero is right absorbing for multiplication.
mul_zero : ∀ (a : α), a * 0 = 0
Zero is left absorbing for multiplication.
pow_zero : ∀ (a : α), a ^ 0 = 1
The zeroth power of any element is one.
pow_succ : ∀ (a : α) (n : Nat), a ^ (n + 1) = a ^ n * a
The successor power law for exponentiation.
ofNat_succ : ∀ (a : Nat), OfNat.ofNat (a + 1) = OfNat.ofNat a + 1
Numerals are consistently defined with respect to addition.
ofNat_eq_natCast : ∀ (n : Nat), OfNat.ofNat n = ↑n
Numerals are consistently defined with respect to the canonical map from natural numbers.
nsmul_eq_natCast_mul : ∀ (n : Nat) (a : α), n * a = ↑n * a