(* 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: OrderedCover.v  Definition of ordered cover and some properties  Definition: ordered_cover  Laurent.Thery@inria.fr (2003) **********************************************************************)
From Huffman Require Export Cover.
Section OrderedCover.
Variable A : Type.
(* An ordered cover is a cover where the positions of the elements in the list are fixed *)
Inductive ordered_cover : list (btree A) -> btree A -> Prop :=
| ordered_cover_one :
forall (t : btree A) (l : list (btree A)), ordered_cover (t :: nil) t
| ordered_cover_node :
forall (t1 t2 : btree A) (l1 l2 l3 : list (btree A)),
ordered_cover l1 t1 ->
ordered_cover l2 t2 -> ordered_cover (l1 ++ l2) (node t1 t2).
Hint Resolve ordered_cover_one ordered_cover_node : core.

(* Specifications: *)
(* Ordered covers are special cases of covers *)
Theorem ordered_cover_cover :
forall (l : list (btree A)) (t : btree A), ordered_cover l t -> cover l t.