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 Zlength_flip_ends: forall A i j (al: list A), 0 <= i -> i<=j -> j <= Zlength al -> Zlength (flip_ends i j al) = Zlength al.