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

(* Specifications: *)
Theorem permutation_map : forall (A B : Type) (f : A -> B) l1 l2, permutation l1 l2 -> permutation (map f l1) (map f l2).
Lemma permutation_map_ex_aux : forall (A B : Type) (f : A -> B) l1 l2 l3, permutation l1 l2 -> l1 = map f l3 -> exists l4 : _, permutation l4 l3 /\ l2 = map f l4.
Theorem permutation_map_ex : forall (A B : Type) (f : A -> B) l1 l2, permutation (map f l1) l2 -> exists l3 : _, permutation l3 l1 /\ l2 = map f l3.
Theorem permutation_flat_map : forall (A B : Type) (f : A -> list B) l1 l2, permutation l1 l2 -> permutation (flat_map f l1) (flat_map f l2).
Theorem fold_left_permutation : forall (A B : Type) (f : A -> B -> A), (forall (a : A) (b1 b2 : B), f (f a b1) b2 = f (f a b2) b1) -> forall (a : A) (l1 l2 : list B), permutation l1 l2 -> fold_left f l1 a = fold_left f l2 a.