(* Search in the list for the min with respect to a valuation function f *)
Fixpoint find_min (l : list A) : option (nat * A) :=
  match l with
  | nil => None
  | a :: l1 =>
      match find_min l1 with
      | None => Some (f a, a)
      | Some (n1, b) =>
          let n2 := f a in
          match le_lt_dec n1 n2 with
          | left _ => Some (n1, b)
          | right _ => Some (n2, a)
          end
      end
  end.

(* Specifications: *)
Theorem find_min_correct : forall l : list A, match find_min l with | None => l = nil | Some (a, b) => (In b l /\ a = f b) /\ (forall c : A, In c l -> f b <= f c) end.