(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the GNU General Public License as published by  *)
(*  the Free Software Foundation, either version 2 of the License, or  *)
(*  (at your option) any later version.  This file is also distributed *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Definitions and theorems about semi-open integer intervals *)
Require Coq.Program.Wf.
Definition interv : Type := (Z * Z)%type.
(** * Membership *)
Definition In (x: Z) (i: interv) : Prop := fst i <= x < snd i.

(* Specifications: *)
Lemma In_dec:
forall x i, {In x i} + {~In x i}.
Lemma notin_range:
forall x i,
x < fst i \/ x >= snd i -> ~In x i.
Lemma range_notin:
forall x i,
~In x i -> fst i < snd i -> x < fst i \/ x >= snd i.
Lemma In_dec:
forall x i, {In x i} + {~In x i}.
Lemma notin_range:
forall x i,
x < fst i \/ x >= snd i -> ~In x i.
Lemma range_notin:
forall x i,
~In x i -> fst i < snd i -> x < fst i \/ x >= snd i.