Ltac solve_perm :=
(* solves goals of the form (R ++ ?i = S) where R and S are lists, and ?i is a unification variable *)
try match goal with
| |-  Permutation (?A ++ ?B) _ =>
is_evar A; first [is_evar B; fail 1| idtac];
apply Permutation_app_comm_trans
end;
repeat first [ apply Permutation_refl
| apply perm_skip
| eapply perm_search
].
Goal exists e, Permutation ((1::2::nil)++e) (3::2::1::5::nil).
eexists.
solve_perm.
Qed.

(* Specifications: *)
Lemma range_pred_dec: forall (P: nat -> Prop),
(forall n, {P n} + {~ P n}) ->
forall m,
{forall n, (n < m)%nat -> P n} + {~ forall n, (n < m)%nat -> P n}.
Lemma Z2Nat_neg: forall i, i < 0 -> Z.to_nat i = 0%nat.
Lemma Zrange_pred_dec: forall (P: Z -> Prop),
(forall z, {P z} + {~ P z}) ->
forall l r,
{forall z, l <= z < r -> P z} + {~ forall z, l <= z < r -> P z}.