Inductive Exists2 {A B} (R: A -> B -> Prop) : list A -> list B -> Prop :=
| Exists2_cons_hd : forall x xs y ys, R x y -> Exists2 R (x::xs) (y::ys)
| Exists2_cons_tl : forall x xs y ys, Exists2 R xs ys -> Exists2 R (x::xs) (y::ys).
Hint Constructors Exists2.

(* Specifications: *)
Lemma Exists2_exists A (d: A) (R: A -> A -> Prop) (xs ys: list A) :
Exists2 R xs ys ->
exists i, i < length xs /\ R (nth i xs d) (nth i ys d).
Lemma app_eq_compat_l {A: Type} (xs ys zs: list A) : ys = zs -> xs ++ ys = xs ++ zs.
Lemma In_prefix_suffix (A : Type) (a : A) l :
In a l -> exists l1 l2, l = l1 ++ a :: l2.
Lemma forall_exists_list (A B : Type) (P : A -> Prop) (Q : A -> B -> Prop) (l : list A) :
(forall a, In a l -> P a -> exists b, Q a b) ->
(Forall P l -> exists l', Forall2 Q l l').
Lemma forall_andl (A: Type) (P: A -> Prop) (l: list A):
Forall P l <-> andl (map P l).