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_fact_3: forall A (al: list A) j size, size = Zlength al -> 0 <= j < size - j - 1 -> sublist 0 j (flip_ends j (size - j) al) ++ sublist (size - j - 1) (size - j) al ++ sublist (j + 1) size (sublist 0 (size - j - 1) (flip_ends j (size - j) al) ++ sublist j (j + 1) (flip_ends j (size - j) al) ++ sublist (size - j) size (flip_ends j (size - j) al)) = flip_ends (j + 1) (size - (j + 1)) al.