Polynomial arithmetic #
Addition, scaling and multiplication of coefficient lists, each with a theorem that evaluation
respects it (eval_add, eval_smul, eval_mul). These are the building blocks for the
vanishing polynomial used in the proof of perfect_secrecy.
Coefficient-wise sum of two polynomials (the shorter one is padded with zeros).
Equations
- QedShare.Poly.add [] x✝ = x✝
- x✝.add [] = x✝
- QedShare.Poly.add (a :: p) (b :: q) = (a + b) :: QedShare.Poly.add p q
Instances For
Multiply every coefficient by the scalar c.
Equations
- QedShare.Poly.smul c p = List.map (fun (x : QedShare.GF256) => c * x) p
Instances For
Product of two polynomials (schoolbook): (a + x·p)·q = a·q + x·(p·q).
Equations
- QedShare.Poly.mul [] x✝ = []
- QedShare.Poly.mul (a :: p) x✝ = (QedShare.Poly.smul a x✝).add (0 :: QedShare.Poly.mul p x✝)