Idris2Doc : Algebra.Ring

Algebra.Ring

(source)

Definitions

neg : Nega=>a->a
Totality: total
Visibility: public export
interfaceRing : Type->Type
  This interface is a witness that for a (primitive)
integral type `a` the axioms of a commutative ring hold:

1. `a` is an abelian group 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`.
4. `neg n` is the additive inverse of `n`:
`n + neg n = 0` 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`.

4. Subtraction syntax: `m - n = m + neg n` for all `m,n : a`.

Parameters: a
Constraints: Neg 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.
0plusNegLeftZero : negn+n=0
  `neg n` is the additive inverse of `n`.
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.
0minusIsPlusNeg : m-n=m+negn
  `m - n` is just "syntactic sugar" for `m + neg n`.

Implementations:
RingBits8
RingBits16
RingBits32
RingBits64
RingInt8
RingInt16
RingInt32
RingInt64
RingInt
RingInteger
0plusAssociative : {auto__con : Ringa} ->k+ (m+n) = (k+m) +n
  Addition is associative.

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

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

Totality: total
Visibility: public export
0plusNegLeftZero : {auto__con : Ringa} ->negn+n=0
  `neg n` is the additive inverse of `n`.

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

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

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

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

Totality: total
Visibility: public export
0minusIsPlusNeg : {auto__con : Ringa} ->m-n=m+negn
  `m - n` is just "syntactic sugar" for `m + neg n`.

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

Totality: total
Visibility: export
0plusNegRightZero : {auto{conArg:1661} : Ringa} ->n+negn=0
  `n + neg n === 0` for all `n : a`.

Totality: total
Visibility: export
0minusSelfZero : {auto{conArg:1757} : Ringa} ->n-n=0
  `n - n === 0` for all `n : a`.

Totality: total
Visibility: export
0plusMinusAssociative : {auto{conArg:1841} : Ringa} ->k+ (m-n) = (k+m) -n
  Law of associativity for subtraction.

Totality: total
Visibility: export
0solvePlusRight : {auto{conArg:2012} : Ringa} ->k+m=n->k=n-m
  We can solve equations involving addition.

Totality: total
Visibility: export
0solvePlusLeft : {auto{conArg:2180} : Ringa} ->k+m=n->m=n-k
  We can solve equations involving addition.

Totality: total
Visibility: export
0plusLeftInjective : {auto{conArg:2279} : Ringa} ->k+n=m+n->k=m
  Addition from the left is injective.

Totality: total
Visibility: export
0plusRightInjective : {auto{conArg:2441} : Ringa} ->n+k=n+m->k=m
  Addition from the right is injective.

Totality: total
Visibility: export
0solvePlusNegRight : {auto{conArg:2569} : Ringa} ->m+n=0->n=negm
  From `m + n === 0` follows that `n` is the
additive inverse of `m`.

Totality: total
Visibility: export
0solvePlusNegLeft : {auto{conArg:2634} : Ringa} ->m+n=0->m=negn
  From `m + n === 0` follows that `m` is the
additive inverse of `n`.

Totality: total
Visibility: export
0solvePlusZeroRight : {auto{conArg:2738} : Ringa} ->m+n=m->n=0
  From `m + n === m` follows `n === 0`.

Totality: total
Visibility: export
0solvePlusZeroLeft : {auto{conArg:2828} : Ringa} ->n+m=m->n=0
  From `n + m === m` follows `n === 0`.

Totality: total
Visibility: export
0negInvolutory : {auto{conArg:2921} : Ringa} ->neg (negn) =n
  Negation is involutory.

Totality: total
Visibility: export
0solveNegZero : {auto{conArg:2960} : Ringa} ->negn=0->n=0
  From `neg n === 0` follows `n === 0`.

Totality: total
Visibility: export
0negZero : {auto{conArg:3085} : Ringa} ->neg0=0
  `neg 0 === 0`

Totality: total
Visibility: export
0negDistributes : {auto{conArg:3120} : Ringa} ->neg (m+n) =negm+negn
Totality: total
Visibility: export
0multOneRightNeutral : {auto{conArg:3495} : Ringa} ->n*1=n
  `n * 1 === n` for all `n : a`.

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

Totality: total
Visibility: export
0multZeroLeftAbsorbs : {auto{conArg:3743} : Ringa} ->0*n=0
  Zero is an absorbing element of multiplication.

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

Totality: total
Visibility: export
0multNegRight : {auto{conArg:4055} : Ringa} ->m*negn=neg (m*n)
  `m * (-n) = - (m * n)`.

Totality: total
Visibility: export
0negMultNegRight : {auto{conArg:4225} : Ringa} ->neg (m*negn) =m*n
  `- (m * (-n)) = m * n`.

Totality: total
Visibility: export
0multNegLeft : {auto{conArg:4348} : Ringa} ->negm*n=neg (m*n)
  `(- m) * n = - (m * n)`.

Totality: total
Visibility: export
0negMultNegLeft : {auto{conArg:4496} : Ringa} ->neg (negm*n) =m*n
  `- ((-m) * n) = m * n`.

Totality: total
Visibility: export
0multMinusOneRight : {auto{conArg:4619} : Ringa} ->n*neg1=negn
  Multiplication with `(-1)` is negation.

Totality: total
Visibility: export
0multMinusOneLeft : {auto{conArg:4740} : Ringa} ->neg1*n=negn
  Multiplication with `(-1)` is negation.

Totality: total
Visibility: export
0negMultNeg : {auto{conArg:4861} : Ringa} ->negm*negn=m*n
  Multiplication of two negations removes negations.

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

Totality: total
Visibility: export
0multPlusSelf : {auto{conArg:5262} : Ringa} -> (m*n) +m=m* (n+1)
Totality: total
Visibility: export