Idris2Doc : Algebra.Solver.Product

Algebra.Solver.Product

(source)

Reexports

importpublic Data.List.Elem

Definitions

dataProd : (a : Type) ->Lista->Type
  A product of variables each represented by the exponent,
to which it is raised.

When normalizing commutative arithmetic expressions, they often
get converted to (sums of) products of variables
(listed in index `as`), each raised to a certain
exponent. This is the case for commutative monoids
(a single product) as well as commutative (semi)rings
(a sum of products).

Example: Assume the monoid in question is `(Bits8,(+),0)` (addition
of 8-bit numbers). Assume further, that we have variables
`[x,y,z]`. The expression `(x + x) + y + (z + z + z + z)` would
then be represented as `[2,1,4]`

Totality: total
Visibility: public export
Constructors:
Nil : Proda []
(::) : Nat->Prodaxs->Proda (x::xs)
mult : Prodaas->Prodaas->Prodaas
  Multiplying two products means adding all
expontents pairwise.

Totality: total
Visibility: public export
compProd : Prodaas->Prodaas->Ordering
  We sort products by lexicographically comparing
the exponents.

Totality: total
Visibility: public export
one : Prodaas
  The neutral product where all exponents are zero.

Totality: total
Visibility: public export
fromVar : Elemxas->Prodaas
  Convert a single variable to a product of variables.

Totality: total
Visibility: public export
recordTerm : (a : Type) ->Lista->Type
  A single term in a normalized arithmetic expressions.

This is a product of all variables each raised to
a given power, multiplied with a constant factor (which is supposed
to reduce during elaboration).

Example: Assume the monoid in question is `(Bits8,(+),0)` (addition
of 8-bit numbers). Assume further, that we have variables
`[x,y,z]`. The expression `3 + (x + x) + y + (z + z + z + z)` would
then be represented as `T 3 [2,1,4]`

Totality: total
Visibility: public export
Constructor: 
T : a->Prodaas->Termaas

Projections:
.factor : Termaas->a
.prod : Termaas->Prodaas
.factor : Termaas->a
Totality: total
Visibility: public export
factor : Termaas->a
Totality: total
Visibility: public export
.prod : Termaas->Prodaas
Totality: total
Visibility: public export
prod : Termaas->Prodaas
Totality: total
Visibility: public export
negTerm : (a->a) ->Termaas->Termaas
  Negates the constant factor in a term using the given negation function.

Totality: total
Visibility: public export
mult : (a->a->a) ->Termaas->Termaas->Termaas
  Multiplies two terms using the given function to multiply the
constant factors.

Totality: total
Visibility: public export
times : (a->a->a) ->a->Nat->a->a
Totality: total
Visibility: public export
eprod : (a->a->a) ->a->Prodaas->a
Totality: total
Visibility: public export
eterm : (a->a->a) ->a->Termaas->a
  Evaluate a term using the given monoid.

Totality: total
Visibility: public export
0lemma1324 : CommutativeSemigroupap-> (k `p` l) `p` (m `p` n) = (k `p` m) `p` (l `p` n)
  A utility proof that is used several times internally

Totality: total
Visibility: export
0lemma213 : CommutativeSemigroupap->k `p` (m `p` n) =m `p` (k `p` n)
  A utility proof that is used several times internally

Totality: total
Visibility: export
0ptimes : CommutativeMonoidazp-> (m : Nat) -> (n : Nat) -> (x : a) ->timespzmx `p` timespznx=timespz (m+n) x
Totality: total
Visibility: export
0peprod : CommutativeMonoidazp-> (e1 : Prodaas) -> (e2 : Prodaas) ->eprodpze1 `p` eprodpze2=eprodpz (multe1e2)
Totality: total
Visibility: export
0pappend : CommutativeMonoidazp-> (e1 : Termaas) -> (e2 : Termaas) ->etermpze1 `p` etermpze2=etermpz (multpe1e2)
Totality: total
Visibility: export
0pone : CommutativeMonoidazp-> (as : Lista) ->eprodpzone=z
  Proof that `Prod.one` evaluates to `neutral`

Totality: total
Visibility: export
0pvar : CommutativeMonoidazp-> (as : Lista) -> (e : Elemxas) ->eprodpz (fromVare) =x
  Proof that for `e : Elem x as`, `fromVar e` evaluates to `x`.

Totality: total
Visibility: export
0pcompNat : (x : Nat) -> (y : Nat) ->comparexy=EQ->x=y
Totality: total
Visibility: export
0pcompProd : (x : Prodaas) -> (y : Prodaas) ->compProdxy=EQ->x=y
Totality: total
Visibility: export
0pmult : Rigazopm-> (x : Prodaas) -> (y : Prodaas) ->eprodmo (multxy) =eprodmox `m` eprodmoy
  Proof that evaluation of a multiplication of products
is the same as multiplying the results of evaluating each
of them.

Totality: total
Visibility: export