(* [replicate n a] is a list of [n] elements, all of which are
   equal to [a]. *)

Fixpoint replicate (A : Type) (n : nat) (a : A) : list A :=
  match n with
  | 0 =>
      @nil _
  | S n =>
      cons a (replicate n a)
  end.

Lemma length_concat_replicate: forall A (a : A) (e1 : env A) n1 n2 n, length e1 <= n1 -> n1 + n2 = n -> length (concat e1 (replicate n2 a)) <= n.