(** [removelast l] remove the last element of [l] *)

  Fixpoint removelast (l:list A) : list A :=
    match l with
      | [] =>  []
      | [a] => []
      | a :: l' => a :: removelast l'
    end.

Lemma app_removelast_last : forall l d, l <> [] -> l = removelast l ++ [last l d].