Section Forall2.
(** [Forall2]: stating that elements of two lists are pairwise related. *)
Variables A B : Type.
Variable R : A -> B -> Prop.
Inductive Forall2 : list A -> list B -> Prop :=
| Forall2_nil : Forall2 [] []
| Forall2_cons : forall x y l l',
R x y -> Forall2 l l' -> Forall2 (x::l) (y::l').
#[local]
Hint Constructors Forall2 : core.
(* NB: when deprecation phase ends, instead of removing prove "Reflexive R -> Reflexive Forall2" and close #6131 *)
#[deprecated(since = "8.18", use = Forall2_nil)]

(* Specifications: *)
Theorem Forall2_refl : Forall2 [] [].
Theorem Forall2_length : forall l l',
Forall2 l l' -> length l = length l'.
Theorem Forall2_app_inv_l : forall l1 l2 l',
Forall2 (l1 ++ l2) l' ->
exists l1' l2', Forall2 l1 l1' /\ Forall2 l2 l2' /\ l' = l1' ++ l2'.
Theorem Forall2_app_inv_r : forall l1' l2' l,
Forall2 l (l1' ++ l2') ->
exists l1 l2, Forall2 l1 l1' /\ Forall2 l2 l2' /\ l = l1 ++ l2.
Theorem Forall2_app : forall l1 l2 l1' l2',
Forall2 l1 l1' -> Forall2 l2 l2' -> Forall2 (l1 ++ l2) (l1' ++ l2').
Theorem Forall_Exists_exists_Forall2 l1 l2 :
Forall (fun a => Exists (R a) l2) l1 ->
exists l2', Forall2 l1 l2' /\ incl l2' l2.