Fixpoint sigma (l1 : list E) : (E -> Z) -> Z :=
  fun f : E -> Z =>
  match l1 with
  | nil => 0%Z
  | e :: l2 => (f e + sigma l2 f)%Z
  end.

Lemma sigma_simpl : forall (l : list E) (f g : E -> Z), (forall x : E, In x l -> f x = g x) -> sigma l f = sigma l g.