Proof using.
intros l; elim l.
intros a H; elim H; simpl in |- *; auto.
simpl in |- *; intros (a1, l1) l0; case l0.
case l1; simpl in |- *; auto.
intros p l2 H a H0.
rewrite H; auto.
red in |- *; intros H1; discriminate.
Qed.
(* Turn a code into a tree *)
Definition pbbuild (l : code A) : pbtree :=
fold_right (fun a c => pbadd (fst a) c (snd a)) (pbleaf empty) l.

(* All the path that are not prefix in the code are free in the corresponding tree *)
Theorem pbfree_pbbuild_prop1 :
forall a l1 l2,
l2 <> nil -> unique_prefix ((a, l1) :: l2) -> pbfree l1 (pbbuild l2).