(* *********************************************************************)
(*                                                                     *)
(*              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.
(** * Emptyness *)
Definition empty (i: interv) : Prop := fst i >= snd i.
(** * Disjointness *)
Definition disjoint (i j: interv) : Prop :=
forall x, In x i -> ~In x j.
(** * Shifting an interval by some amount *)
Definition shift (i: interv) (delta: Z) : interv := (fst i + delta, snd i + delta).

Lemma in_shift:
forall x i delta,
In x i -> In (x + delta) (shift i delta).