Proof using.
intros a l1 l m1; generalize a l1 l; elim m1; simpl in |- *; auto;
clear a l1 l m1.
intros a l H a0 l1 l0 H0; case (eqA_dec a a0); simpl in |- *; auto.
intros H1; case H0; auto.
intros e; rewrite H; auto.
Qed.

(* The encoding does not depend of permutation *)
Theorem encode_permutation :
forall (m : list A) (c1 c2 : code),
permutation c1 c2 -> unique_prefix c1 -> encode c1 m = encode c2 m.