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

Theorem list_pred_app_both_if : forall (A B : Set) P (x y : list A)(z q : list B), length x = length z -> list_pred P (x ++ y) (z ++ q) -> list_pred P x z /\ list_pred P y q.