CoqEAL seqpoly, ported to Lean — List R refines the coefficient function #
CoqEAL's seqpoly refines MathComp polynomials {poly R} to lists seq R. Here
we port the data-refinement core of that example into the ReprTransfer
framework: a coefficient list List R refines the abstract coefficient function
ℕ → R, and the concrete list addition addSeq refines the abstract
coefficient-wise addition — the CoqEAL Radd_seqpoly refinement square.
The refinement mechanism — a relation between an abstract and a concrete
representation, plus transfer of operations — is the ReprTransfer layer; this
file is one worked instance over the seqpoly representation. The CoqEAL
aggregator records the suite's frontier (the general-size algorithms and the
normal-form theory).
The CoqEAL seqpoly refinement relation: a coefficient list denotes the
abstract coefficient function (absent coefficients are 0).
Equations
- Transfer.Examples.CoqEAL.SeqPoly.coeff l i = l.getD i 0
Instances For
The concrete (computational) polynomial addition on coefficient lists.
Equations
- Transfer.Examples.CoqEAL.SeqPoly.addSeq [] x✝ = x✝
- Transfer.Examples.CoqEAL.SeqPoly.addSeq x✝ [] = x✝
- Transfer.Examples.CoqEAL.SeqPoly.addSeq (a :: p) (b :: q) = (a + b) :: Transfer.Examples.CoqEAL.SeqPoly.addSeq p q
Instances For
Functional form of the refinement square — the commuting square the
ReprTransfer registry consumes (concrete add ↦ abstract pointwise add).