Coeffs
as a wrapper for IntList
#
Currently omega
uses a dense representation for coefficients.
However, we can swap this out for a sparse representation.
This file sets up Coeffs
as a type synonym for IntList
,
and abbreviations for the functions in the IntList
namespace which we need to use in the
omega
algorithm.
There is an equivalent file setting up Coeffs
as a type synonym for AssocList Nat Int
,
currently in a private branch.
Not all the theorems about the algebraic operations on that representation have been proved yet.
When they are ready, we can replace the implementation in omega
simply by importing
Init.Omega.IntDict
instead of Init.Omega.IntList
.
For small problems, the sparse representation is actually slightly slower, so it is not urgent to make this replacement.
Identity, turning List Int
into Coeffs
.
Equations
- Lean.Omega.Coeffs.ofList xs = xs
Instances For
Are the coefficients all zero?
Instances For
Shim for IntList.set
.
Equations
- xs.set i y = Lean.Omega.IntList.set xs i y
Instances For
Shim for IntList.smul
.
Equations
- xs.smul g = Lean.Omega.IntList.smul xs g
Instances For
Shim for IntList.combo
.
Instances For
Shim for IntList.leading
.
Equations
- xs.leading = Lean.Omega.IntList.leading xs
Instances For
Shim for List.map
.
Equations
- Lean.Omega.Coeffs.map f xs = List.map f xs
Instances For
Shim for .enum.find?
.
Instances For
Shim for IntList.bmod
.
Equations
- x.bmod m = Lean.Omega.IntList.bmod x m