Proof using.
intros m1 c; elim m1; simpl in |- *; auto.
intros a l H H0.
apply f_equal2 with (f := app (A:=bool)); auto with datatypes.
apply restrict_code_in; auto with datatypes.
apply H; apply incl_tran with (2 := H0); auto with datatypes.
Qed.

(* The restriction does not change the encoding of the initial message *)
Theorem restrict_code_encode :
forall c : code A, encode eqA_dec c m = encode eqA_dec (restrict_code m c) m.