induction ls; intuition; simpl in *.
intuition; subst.
destruct (in_dec (EqDec_dec eqd) a0 ls).
eauto.
simpl.
intuition.
destruct (in_dec (EqDec_dec eqd) a ls).
eauto.
simpl.
right.
eauto.
Qed.
End RemoveDups.
(* ListReplace -- replace a single element in a list. *)
Section ListReplace.
Variable A : Set.
Fixpoint listReplace (ls : list A)(i : nat)(a def : A) :=
match i with
| O =>
match ls with
| nil => a :: nil
| a' :: ls' => a :: ls'
end
| S i' =>
match ls with
| nil => def :: (listReplace nil i' a def)
| a' :: ls' =>
a' :: (listReplace ls' i' a def)
end
end.
End ListReplace.
Section SumList.
Variable A : Set.
Definition sumList(ls : list A)(f : A -> Rat) := fold_left (fun a b => a + (f b)) ls 0.
(* Facts about sumList *)

(* Specifications: *)
Theorem sumList_ne_0 : forall (ls : list A)(f : A -> Rat),
~ (sumList ls f) == 0 ->
exists b : _,
In b ls /\
~ ((f b) == 0).