Instance CompSpecs : compspecs.Definition Vprog : varspecs.Definition flip_ends {A} lo hi (contents: list A) :=
  sublist 0 lo (rev contents)
  ++ sublist lo hi contents
  ++ sublist hi (Zlength contents) (rev contents).

Lemma flip_ends_map: forall A B (F: A -> B) lo hi (al: list A), flip_ends lo hi (map F al) = map F (flip_ends lo hi al).