(** 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. (Odd radix.) *)
Definition new_location_odd 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 + 1) nb_steps with
| Lt => Lt
| Eq => match l with loc_Inexact l => l | loc_Exact => Lt end
| Gt => Gt
end.

(* Specifications: *)
Theorem new_location_odd_correct :
Zeven nb_steps = false ->
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_odd k l).
Theorem new_location_odd_correct :
Zeven nb_steps = false ->
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_odd k l).