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

Theorem nth_listReplace_eq : forall (A : Set) i (ls : list A) a def1 def2, nth i (listReplace ls i a def1) def2 = a.