Global Instance Finite_prod {X Y} `{Finite X, Finite Y} : Finite (X * Y).
Definition indicate (b : bool) : Q :=
if b then 1 else 0.
Definition indicate_nat (b : bool) : nat :=
if b then 1 else O.

Lemma Qsum_scalar {X} (xs : list X) (f : X -> Q) (q : Q) :
Qsum (map (fun x => q * f x) xs) == q * Qsum (map f xs).