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

Lemma listReplace_twice : forall (A : Set)(n : nat)(ls : list A) a1 a2 def, listReplace (listReplace ls n a1 def) n a2 def = listReplace ls n a2 def.