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).