induction n; intuition; simpl in *.
destruct ls; simpl in *.
eapply Permutation_refl.
subst.
eapply Permutation_refl.
destruct ls; simpl in *.
eapply (IHn nil).
eapply nth_nil.
destruct o.
eapply Permutation_sym.
eapply perm_trans.
eapply perm_swap.
eapply perm_skip.
eapply Permutation_sym.
eapply IHn.
trivial.
eapply IHn.
trivial.
Qed.

(* Specifications: *)
Theorem listReplace_getSomes_Permutation_h :
forall (A : Set) l1' l2,
Permutation l1' l2 ->
forall l1 n2 (y : A),
l1' = getSomes l1 ->
nth n2 l1 None = None ->
Permutation
(getSomes
(listReplace l1 n2
(Some y) None))
(y :: l2).