Idris2Doc : Algebra.Solver.Ring

Algebra.Solver.Ring

(source)

Reexports

importpublic Data.List.Elem
importpublic Algebra.Group
importpublic Algebra.Ring
importpublic Algebra.Solver.Ops
importpublic Algebra.Solver.Product
importpublic Algebra.Solver.Sum

Definitions

dataExpr : (a : Type) ->Lista->Type
Totality: total
Visibility: public export
Constructors:
Lit : a->Expraas
  A literal. This should be a value known at compile time
so that it reduces during normalization.
Var : (x : a) ->Elemxas->Expraas
  A variabl. This is is for values not known at compile
time. In order to compare and merge variables, we need an
`Elem x as` proof.
(+) : Expraas->Expraas->Expraas
  Addition of two expressions.
(*) : Expraas->Expraas->Expraas
  Multiplication of two expressions.
(-) : Expraas->Expraas->Expraas
fromInteger : Numa=>Integer->Expraas
Totality: total
Visibility: public export
var : (x : a) ->Elemxas=>Expraas
  Like `Var` but takes the `Elem x as` as an auto implicit
argument.

Totality: total
Visibility: public export
(.+.) : (x : a) -> (y : a) ->Elemxas=>Elemyas=>Expraas
  Addition of variables. This is an alias for
`var x + var y`.

Totality: total
Visibility: public export
Fixity Declarations:
infixl operator, level 8
infixl operator, level 8
(+.) : Expraas-> (y : a) ->Elemyas=>Expraas
  Addition of variables. This is an alias for
`x + var y`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 8
(.+) : (x : a) ->Expraas->Elemxas=>Expraas
  Addition of variables. This is an alias for
`var x + y`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 8
(.-.) : (x : a) -> (y : a) ->Elemxas=>Elemyas=>Expraas
  Addition of variables. This is an alias for
`var x + var y`.

Totality: total
Visibility: public export
(-.) : Expraas-> (y : a) ->Elemyas=>Expraas
  Addition of variables. This is an alias for
`x + var y`.

Totality: total
Visibility: public export
(.-) : (x : a) ->Expraas->Elemxas=>Expraas
  Addition of variables. This is an alias for
`var x + y`.

Totality: total
Visibility: public export
(.*.) : (x : a) -> (y : a) ->Elemxas=>Elemyas=>Expraas
  Multiplication of variables. This is an alias for
`var x * var y`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 9
(*.) : Expraas-> (y : a) ->Elemyas=>Expraas
  Multiplication of variables. This is an alias for
`var x * y`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 9
(.*) : (x : a) ->Expraas->Elemxas=>Expraas
  Multiplication of variables. This is an alias for
`x * var y`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 9
(+) : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->a->a->a
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 8
(*) : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->a->a->a
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 9
negate : Negty=>ty->ty
  The underlying of unary minus. `-5` desugars to `negate (fromInteger 5)`.

Totality: total
Visibility: public export
Fixity Declaration: prefix operator, level 10
(-) : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->a->a->a
Totality: total
Visibility: public export
Fixity Declarations:
infixl operator, level 8
prefix operator, level 10
eval : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->Expraas->a
  Evaluation of expressions. This keeps the exact
structure of the expression tree. For instance
`eval $ x .*. (y .+. z)` evaluates to `x * (y + z)`.

Totality: total
Visibility: public export
negate : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->Sumaas->Sumaas
Totality: total
Visibility: public export
Fixity Declaration: prefix operator, level 10
norm : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->Expraas->Sumaas
  Normalizes an arithmetic expression to a sum of products.

Totality: total
Visibility: public export
normalize : (0_ : Ringazopmsub) -> ((v : a) ->Maybe (v=z)) ->Expraas->Sumaas
  Like `norm` but removes all `zero` terms.

Totality: total
Visibility: public export
0solve : (0r : Ringazopmsub) -> (isZ : ((v : a) ->Maybe (v=z))) -> (e1 : Expraas) -> (e2 : Expraas) ->normalizee1=normalizee2=>evale1=evale2
  Given a list `as` of variables and two arithmetic expressions
over these variables, if the expressions are converted
to the same normal form, evaluating them gives the same
result.

This simple fact allows us to conveniently and quickly
proof arithmetic equalities required in other parts of
our code. For instance:

```idris example
0 binom1 : {x,y : Bits8}
-> (x + y) * (x + y) === x * x + 2 * x * y + y * y
binom1 = solve [x,y]
((x .+. y) * (x .+. y))
(x .*. x + 2 *. x *. y + y .*. y)
```

Totality: total
Visibility: export