induction 1; intuition; simpl in *.
repeat rewrite app_length.
f_equal.
trivial.
trivial.
Qed.

(* Specifications: *)
Lemma flatten_map_pair_eq :
forall (A B C : Set)(ls : list (list A * list B))(f : A * B -> C),
(forall ls1 ls2, In (ls1, ls2) ls -> length ls1 = length ls2) ->
flatten (map (fun p => [ls1, ls2] <-2 p; map f (zip ls1 ls2)) ls) =
map f (zip (flatten (fst (unzip ls))) (flatten (snd (unzip ls)))).