Section ELEMENTS.
Variable lo: Z.
Function elements_rec (hi: Z) {wf (Zwf lo) hi} : list Z :=
if zlt lo hi then (hi-1) :: elements_rec (hi-1) else nil.
End ELEMENTS.
Definition elements (i: interv) : list Z :=
elements_rec (fst i) (snd i).

Lemma elements_in:
forall x i,
List.In x (elements i) -> In x i.