(*********************************************)
(* This file is part of the 'Higman' contrib *)
(* file : list_embeding.v                    *)
(* contains : definition  of the embeding    *)
(*  relation on lists and basic lemmas       *)
(* author : W.Delobel                        *)
(*********************************************)
Set Implicit Arguments.
Require Export List.
Require Export inductive_wqo.
Section definitions.
Variable A : Set.
Variable leA : A -> A -> Prop.
Hypothesis leA_dec : forall a a', {leA a a'} + {~ leA a a'}.
Inductive Embeds : list A -> list A -> Prop :=
| emb0 : Embeds nil nil
| emb1 : forall v w a, Embeds v w -> Embeds v (a::w)
| emb2 : forall v w a b, Embeds v w -> leA a b -> Embeds (a::v) (b::w).
Inductive sorted : list A -> Prop :=
|srt0 : sorted nil
|srt1 : forall a, sorted (a::nil)
|srt2 : forall a a' l, leA a' a -> sorted (a'::l) -> sorted (a::(a'::l)).
End definitions.
Section list_embeding.
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 := Embeds leA.
Definition sublist : list (list A) -> list (list A) -> Prop := Embeds (eq (A:= list A)).

Lemma good_remove_letter : forall a w ws,
good embeds (w::ws) -> good embeds ((a::w)::ws).