Proof using.
intros c; elim c; simpl; auto.
intros a; case a.
intros a1 l; case (list_eq_dec eq_bool_dec nil l); auto.
intros e l0 H H0; case (H0 a1); rewrite e; simpl in |- *; auto.
intros n l0 H H0; apply H.
unfold not_null in |- *; intros a2; red in |- *; intros H1.
case (H0 a2); simpl in |- *; auto.
Qed.
(* Encoding is done by iteratively applying find_code *)
Fixpoint encode (c : code) (m : list A) {struct m} : list bool :=
match m with
| nil => nil
| a :: b => find_code a c ++ encode c b
end.

(* Specifications: *)
(* Encoding can be splitted for appended lists *)
Theorem encode_app :
forall l1 l2 c, encode c (l1 ++ l2) = encode c l1 ++ encode c l2.