(*
  Fact is_cipher_of_u1 : l+1 < q -> is_cipher_of (fun _ => 1) (∑ l (fun i => power (power (S (S i)) 2) r)).
  Proof.
    intros H; split; auto; split.
    + intros; apply (@power_mono_l 1 _ 2); omega.
    + apply msum_ext; intros; omega.
  Qed.
 *)

  Definition the_cipher f : l+1 < q -> (forall i, i < l -> f i < power q 2) -> { c | is_cipher_of f c }.Definition Code a := exists f, is_cipher_of f a.Definition Const c v := exists f, is_cipher_of f v /\ forall i, i < l -> f i = c.

Lemma Const_dio c v : Const c v <-> l = 0 /\ 1 < q /\ v = 0 \/ 0 < l /\ l+1 < q /\ exists p u u1, p = power q 2 /\ c < p /\ seqs_of_ones u u1 /\ v = c*u.