(* This code is copyrighted by its authors; it is distributed under  *)
(* the terms of the LGPL license (see LICENSE and description files) *)
Definition Pred (A : Set) := A -> Prop.
Definition Rel (A : Set) := A -> A -> Prop.
Inductive ExistsL (A : Set) (P : Pred A) : list A -> Set :=
| FoundE : forall (a : A) (l : list A), P a -> ExistsL A P (a :: l)
| SearchE :
forall (a : A) (l : list A), ExistsL A P l -> ExistsL A P (a :: l).
Hint Resolve FoundE SearchE.
intros A P xs; elim xs; simpl in |- *; auto.
Qed.
Hint Resolve monExistsL1.
intros A P xs; elim xs; simpl in |- *; auto.
intros a l H' bs cs H'0; inversion H'0; auto.
Qed.
Hint Resolve monExistsL.
Inductive GoodR (A : Set) (R : Rel A) : list A -> Set :=
| FoundG :
forall (a : A) (l : list A),
ExistsL A (fun x : A => R x a) l -> GoodR A R (a :: l)
| SearchG : forall (a : A) (l : list A), GoodR A R l -> GoodR A R (a :: l).
Hint Resolve FoundG SearchG.
intros A R xs; elim xs; simpl in |- *; auto.
Qed.
Hint Resolve monGoodR1.

Lemma monGoodR :
forall (A : Set) (R : Rel A) (xs bs cs : list A),
GoodR A R (xs ++ bs) -> GoodR A R (xs ++ cs ++ bs).