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.
Definition sorted_in_label (t : Tree) : Prop :=
forall vs l ts, t = node (vs, l) ts -> sorted leA l.
Definition bad_seq_in_lbl (t : Tree) : Prop :=
forall vs l ts, t = node (vs,l) ts -> bad embeds vs.
Definition ltF : list Tree -> list Tree -> Prop := fun f' => fun f => exists w, exists a,
is_insert_forest f w a f'  /\ (forall t, tree_in_forest t f' -> bad_seq_in_lbl t) /\ f<>f'.
Fact acc_ltF_nil : Acc ltF nil.
constructor; intros f Hf.
elim Hf; clear Hf; intros w H; elim H; clear H; intros a H;
elim H; clear H; intros H1 H; elim H; clear H; intros H2 H3.
inversion H1; subst.
elim H3; trivial.
Qed.
Fact acc_ltF_cons : forall f t, Acc ltF f -> Acc ltF (t::nil) -> Acc ltF (t::f).

Lemma acc_ltF_single : forall ws, Acc (continues embeds) ws ->
forall l a bs, Acc (continues leA) bs ->
forall ts, Acc ltF ts ->
forall t, root t = (ws,a::l) /\ subtrees t = ts /\ Some bs = roots_labels ts ->
Acc ltF (t::nil).