(*********************************************)
(* This file is part of the 'Higman' contrib *)
(* file : higman.v                           *)
(* contains : proof of higman's lemma        *)
(*  based upon a proof by M.Seisenberger     *)
(* author : W.Delobel                        *)
(*********************************************)
Set Implicit Arguments.
Require Export inductive_wqo.
Require Export tree.
Require Export higman_aux.
Section higman.
Variable A : Set.
Variable leA : A -> A -> Prop.
Hypothesis eqA_dec : forall a a' : A, {a = a'} + {a <> a'}.
Hypothesis leA_dec : forall a a', {leA a a'} + {~ leA a a'}.
Hypothesis leA_trans : forall a a' a'', leA a a' -> leA a' a'' -> leA a a''.
Definition embeds : list A -> list A -> Prop := (higman_aux.embeds leA).
Definition sublist : list (list A) -> list (list A) -> Prop := (higman_aux.sublist (A:=A)).
Definition Tree := (higman_aux.Tree A).
Definition is_forest := (higman_aux.is_forest leA leA_dec).
Definition is_insert_forest := (higman_aux.is_insert_forest leA).
Definition is_insert_tree := (higman_aux.is_insert_tree leA).
Definition sub_seq_in_lbl (ws : list (list A)) (t : Tree) : Prop :=
forall vs l ts, t = node (vs,l) ts -> sublist (merge_label vs l) ws.

Lemma sub_seq_in_forest : forall ws f,
is_forest ws f -> P_on_forest sub_seq_in_lbl ws f.