(** * Permutations modulo p. *)
Fixpoint permmod (p : nat) (l1 : Zlist) {struct l1} :
Zlist -> Prop :=
fun l2 : Zlist =>
match l1 with
| Nil => l2 = Nil Z
| Cons x t =>
exists y : Z, inlist Z y l2 /\ Mod x y p /\ permmod p t (zdrop y l2)
end.

Lemma nodoubles_allex_permmod1 :
forall (n p : nat) (l0 l1 : Zlist),
n = length Z l0 ->
n = length Z l1 ->
Prime p ->
length Z l0 = length Z l1 ->
nodoubles p l0 -> allex p l0 l1 -> permmod p l0 l1.