Fixpoint replicate {X} (n : nat) (m : X) : list X :=
  match n with
  | O => []
  | S n' => cons m (replicate n' m)
  end.

Lemma Forall_replicate : forall {X Y} (l : list X) (f : X -> Y) (y : Y), Forall (fun x => f x = y) l -> List.map f l = replicate (List.length l) y.