(** ** Multiplication of polynomials

  - [pmult p1 p2] is the multiplication of the polynomials [p1] and [p2].

  - [pmultl pl] is the multiplication of the polynomials in the list [pl].
*)

Definition pmult_mon (m12:mon*mon) : mon :=
  (fst (fst m12) * fst (snd m12), snd (fst m12) ++  snd (snd m12)).Definition pmult (p1 p2:pol) : pol :=
  (max (fst p1) (fst p2), map pmult_mon (list_prod (snd p1) (snd p2))).

(* Specifications: *)
Lemma parity_pmult : forall p1 p2, parity (pmult p1 p2) = max (parity p1) (parity p2).
Lemma pWF_pmult_mon : forall ar1 m1 ar2 m2, pWF_mon ar1 m1 -> pWF_mon ar2 m2 -> pWF_mon (max ar1 ar2) (pmult_mon (m1, m2)).
Lemma pWF_pmult : forall p1 p2, pWF p1 -> pWF p2 -> pWF (pmult p1 p2).
Lemma pmult_mon_correct : forall m12 l, peval_mon (pmult_mon m12) l = peval_mon (fst m12) l * peval_mon (snd m12) l.
Lemma map_pmult_mon : forall m1 ml2 l, map (fun m2 => peval_mon (pmult_mon (m1, m2)) l) ml2 = map (fun m2 => peval_mon m1 l * peval_mon m2 l) ml2.
Lemma pmult_correct : forall p1 p2 l, peval (pmult p1 p2) l = peval p1 l * peval p2 l.