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 in_elements:
forall x i,
In x i -> List.In x (elements i).