(** Computes a new location when the interval containing a real number is split into nb_steps subintervals and the real is in the k-th one. (Even radix.) *)
Definition new_location_even k l :=
if Zeq_bool k 0 then
match l with loc_Exact => l | _ => loc_Inexact Lt end
else
loc_Inexact
match Zcompare (2 * k) nb_steps with
| Lt => Lt
| Eq => match l with loc_Exact => Eq | _ => Gt end
| Gt => Gt
end.

(* Specifications: *)
Theorem new_location_even_correct :
Zeven nb_steps = true ->
forall x k l, (0 <= k < nb_steps)%Z ->
inbetween (start + Z2R k * step) (start + Z2R (k + 1) * step) x l ->
inbetween start (start + Z2R nb_steps * step) x (new_location_even k l).