induction ls; intuition.
exists O.
econstructor.
destruct H0.
destruct (H a).
exists (S x).
econstructor; eauto.
exists x.
econstructor; eauto.
Qed.
Inductive rel_map(A B : Type)(r : A -> B -> Prop) : list A -> list B -> Prop :=
| rm_nil :
rel_map r nil nil
| rm_step :
forall lsa lsb a b,
rel_map r lsa lsb ->
r a b ->
rel_map r (a :: lsa) (b :: lsb).

Theorem rel_map_map2 : forall (A B C D : Type)(ls_c : list C)(ls_d: list D)(P : A -> B -> Prop)(f1 : C -> A)(f2 : D -> B),
rel_map (fun a b => P (f1 a) (f2 b)) ls_c ls_d ->
rel_map P (map f1 ls_c) (map f2 ls_d).