Section CoverMin.
Variable A : Type.
Variable f : A -> nat.
(* To be a tree of minimum weight for a cover *)
Definition cover_min (l : list (btree A)) (t1 : btree A) : Prop :=
cover l t1 /\
(forall t2 : btree A, cover l t2 -> weight_tree f t1 <= weight_tree f t2).
Proof using.
intros t; split; auto.
intros t2 H; inversion H; auto.
generalize (permutation_length _ _ _ H0); simpl in |- *; intros; discriminate.
Qed.
Hint Resolve cover_min_one : core.
Proof using.
intros t l1 l2 H H0; split.
apply cover_permutation with (2 := H0); auto.
inversion H; auto.
intros t2 H1.
assert (cover l1 t2).
inversion H; auto.
apply cover_permutation with (2 := permutation_sym _ _ _ H0); auto.
inversion H; auto.
Qed.

(* For all covers, there is a minimum tree *)
Theorem cover_min_ex :
forall l : list (btree A), l <> nil -> exists t : btree A, cover_min l t.