(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU Lesser General Public License for more details.                *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(********************************************************************** Proof of Huffman algorithm: CoverMin.v  Definition of a minimal tree for a cover  Defintion: cover_min Laurent.Thery@inria.fr (2003) **********************************************************************)
From Huffman Require Export Cover.
From Huffman Require Export WeightTree.
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).

(* Specifications: *)
(* Minimum tree for a singleton cover *)
Theorem cover_min_one : forall t : btree A, cover_min (t :: nil) t.
Proof using.