Idris2Doc : Algebra.Semiring

Algebra.Semiring

(source)

Definitions

interfaceSemiring : Type->Type
  This interface is a witness that for a
numeric type `a` the axioms of a commutative semiring hold:

1. `a` is a commutative monoid under addition:
1. `+` is associative: `k + (m + n) = (k + m) + n` for all `k,m,n : a`.
2. `+` is commutative: `m + n = n + m` for all `m,n : a`.
3. 0 is the additive identity: `n + 0 = n` for all `n : a`.

2. `a` is a commutative monoid under multiplication:
1. `*` is associative: `k * (m * n) = (k * m) * n` for all `k,m,n : a`.
2. `*` is commutative: `m * n = n * m` for all `m,n : a`.
3. 1 is the multiplicative identity: `n * 1 = n` for all `n : a`.

3. Multiplication is distributive with respect to addition:
`k * (m + n) = (k * m) + (k * n)` for all `k,m,n : a`.

Parameters: a
Constraints: Num a
Methods:
0plusAssociative : k+ (m+n) = (k+m) +n
  Addition is associative.
0plusCommutative : m+n=n+m
  Addition is commutative.
0plusZeroLeftNeutral : 0+n=n
  0 is the additive identity.
0multAssociative : k* (m*n) = (k*m) *n
  Multiplication is associative.
0multCommutative : m*n=n*m
  Multiplication is commutative.
0multOneLeftNeutral : 1*n=n
  1 is the multiplicative identity.
0leftDistributive : k* (m+n) = (k*m) + (k*n)
  Multiplication is distributive with respect to addition.
0multZeroLeftAbsorbs : 0*n=0
  Zero is an absorbing element of multiplication.

Implementation: 
SemiringNat
0plusAssociative : {auto__con : Semiringa} ->k+ (m+n) = (k+m) +n
  Addition is associative.

Totality: total
Visibility: public export
0plusCommutative : {auto__con : Semiringa} ->m+n=n+m
  Addition is commutative.

Totality: total
Visibility: public export
0plusZeroLeftNeutral : {auto__con : Semiringa} ->0+n=n
  0 is the additive identity.

Totality: total
Visibility: public export
0multAssociative : {auto__con : Semiringa} ->k* (m*n) = (k*m) *n
  Multiplication is associative.

Totality: total
Visibility: public export
0multCommutative : {auto__con : Semiringa} ->m*n=n*m
  Multiplication is commutative.

Totality: total
Visibility: public export
0multOneLeftNeutral : {auto__con : Semiringa} ->1*n=n
  1 is the multiplicative identity.

Totality: total
Visibility: public export
0leftDistributive : {auto__con : Semiringa} ->k* (m+n) = (k*m) + (k*n)
  Multiplication is distributive with respect to addition.

Totality: total
Visibility: public export
0multZeroLeftAbsorbs : {auto__con : Semiringa} ->0*n=0
  Zero is an absorbing element of multiplication.

Totality: total
Visibility: public export
0plusZeroRightNeutral : {auto{conArg:1382} : Semiringa} ->n+0=n
  `n + 0 === n` for all `n : a`.

Totality: total
Visibility: export
0multOneRightNeutral : {auto{conArg:1462} : Semiringa} ->n*1=n
  `n * 1 === n` for all `n : a`.

Totality: total
Visibility: export
0multZeroRightAbsorbs : {auto{conArg:1542} : Semiringa} ->n*0=0
  Zero is an absorbing element of multiplication.

Totality: total
Visibility: export
multZeroAbsorbs : {auto{conArg:1629} : Semiringa} -> (m : a) -> (n : a) ->Either (m=0) (n=0) ->m*n=0
  Zero is an absorbing element of multiplication.

Totality: total
Visibility: export
0rightDistributive : {auto{conArg:1803} : Semiringa} -> (m+n) *k= (m*k) + (n*k)
  Multiplication is distributive with respect to addition.

Totality: total
Visibility: export