(* 
  Find the list of booleans associated with an element,
  return the empty list if the element does not exists
*)
Fixpoint find_code (a : A) (l : code) {struct l} : list bool :=
  match l with
  | nil => nil
  | (b, c) :: l1 =>
      match eqA_dec a b with
      | left _ => c
      | right _ => find_code a l1
      end
  end.

Theorem find_code_app : forall a l1 l2, not_null l1 -> find_code a (l1 ++ l2) = match find_code a l1 with | nil => find_code a l2 | b1 :: l3 => b1 :: l3 end.