(*********************************************)
(* This file is part of the 'Higman' contrib *)
(* file : inductive_wqo.v                    *)
(* contains : inductive definition of a      *)
(*  well quasi ordering                      *)
(* author : W.Delobel                        *)
(*********************************************)
Set Implicit Arguments.
Require Export List.
Section Wrap.
Variable A : Set.
Variable leA : A -> A -> Prop.
Variable leA_dec : forall a a', {leA a a'} + {~ leA a a'}.
(* leA a' a for some a' in second arg *)
Inductive greater : A -> list A -> Prop :=
| Gr0 : forall a a' w, leA a' a -> greater a (a'::w)
| Gr1 : forall a a' w, greater a w -> greater a (a'::w).
(* good sequence - leA a' a, a occurs in arg earlier than a' *)
Inductive good : list A -> Prop :=
| Gd0 : forall a w, greater a w -> good (a::w)
| Gd1 : forall a w, good w -> good (a::w).
Definition bad (l : list A) : Prop := ~ good l.

Lemma greater_dec : forall a l, {greater a l} + {~ greater a l}.