Proof using.
intros l1 l2 H; unfold all_permutations in |- *;
apply permutation_all_permutations_aux; auto.
Qed.
(* Permutation is decidable *)
Definition permutation_dec :
(forall a b : A, {a = b} + {a <> b}) ->
forall l1 l2 : list A, {permutation l1 l2} + {~ permutation l1 l2}.
intros H l1 l2.
case (In_dec (list_eq_dec H) l1 (all_permutations l2)).
intros i; left; apply all_permutations_permutation; auto.
intros i; right; Contradict i; apply permutation_all_permutations; auto.
Defined.
End permutation.
(* Hints *)
Hint Constructors permutation : core.
Hint Resolve permutation_refl : core.
Hint Resolve permutation_app_comp : core.
Hint Resolve permutation_app_swap : core.
(* Implicits *)
Arguments permutation [A].
Arguments split_one [A].
Arguments all_permutations [A].
Arguments permutation_dec [A].

(* Specifications: *)
(* Permutation is compatible with map *)
Theorem permutation_map :
forall (A B : Type) (f : A -> B) l1 l2,
permutation l1 l2 -> permutation (map f l1) (map f l2).