Inductive location := loc_Exact | loc_Inexact : comparison -> location.Inductive location := loc_Exact | loc_Inexact : comparison -> location.Inductive location := loc_Exact | loc_Inexact : comparison -> location.Definition inbetween_loc :=
  match Rcompare x d with
  | Gt => loc_Inexact (Rcompare x ((d + u) / 2))
  | _ => loc_Exact
  end.(** Locates a real number with respect to the middle of two other numbers. *)

Inductive inbetween : location -> Prop :=
  | inbetween_Exact : x = d -> inbetween loc_Exact
  | inbetween_Inexact l : (d < x < u)%R -> Rcompare x ((d + u) / 2)%R = l -> inbetween (loc_Inexact l).(** Locates a real number with respect to the middle of two other numbers. *)

Inductive inbetween : location -> Prop :=
  | inbetween_Exact : x = d -> inbetween loc_Exact
  | inbetween_Inexact l : (d < x < u)%R -> Rcompare x ((d + u) / 2)%R = l -> inbetween (loc_Inexact l).(** Locates a real number with respect to the middle of two other numbers. *)

Inductive inbetween : location -> Prop :=
  | inbetween_Exact : x = d -> inbetween loc_Exact
  | inbetween_Inexact l : (d < x < u)%R -> Rcompare x ((d + u) / 2)%R = l -> inbetween (loc_Inexact l).

Lemma inbetween_step_not_Eq : forall x k l l', inbetween (start + Z2R k * step) (start + Z2R (k + 1) * step) x l -> (0 < k < nb_steps)%Z -> Rcompare x (start + (Z2R nb_steps / 2 * step))%R = l' -> inbetween start (start + Z2R nb_steps * step) x (loc_Inexact l').