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).

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}.