Definition optSwap (A : Set)(opt : option (A * A)) :=
  match opt with
    | None => None
    | Some (a1, a2) =>
      Some (a2, a1)
  end.

Lemma list_pred_flatten_both : forall (A B : Set)(P : A -> B -> Prop)(lsa : list (list A))(lsb : list (list B)), list_pred (list_pred P) lsa lsb -> list_pred P (flatten lsa) (flatten lsb).