(** * 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 permmod_drop_rev :
forall (p : nat) (l0 l1 : Zlist) (x0 x1 : Z),
Mod x0 x1 p ->
inlist Z x0 l0 ->
inlist Z x1 l1 -> permmod p l0 l1 -> permmod p (zdrop x0 l0) (zdrop x1 l1).