(** * Lists of natural numbers. *)
Definition natlist := list nat.
(** Multiply all elements of a natlist *)
Fixpoint product (qlist : natlist) : nat :=
match qlist with
| Nil => 1
| Cons m l => m * product l
end.
(** Drop the first occurance of q from qlist *)
Fixpoint drop (q : nat) (qlist : natlist) {struct qlist} : natlist :=
match qlist with
| Nil => Nil nat
| Cons q' l => if beq_nat q q' then l else Cons nat q' (drop q l)
end.
(** Multiply all elements of qlist, except for (first occurance of) q *)
Definition multDrop (q : nat) (l : natlist) := product (drop q l).

(* Specifications: *)
Lemma multdrop_cons_eq :
forall (q : nat) (l : natlist), multDrop q (Cons nat q l) = product l.
Lemma multdrop_cons_neq :
forall (p q : nat) (l : natlist),
p <> q -> multDrop p (Cons nat q l) = q * multDrop p l.
Lemma multdrop_mult :
forall (qlist : natlist) (q : nat),
inlist nat q qlist -> q * multDrop q qlist = product qlist.