(* *********************************************************************)
(*                                                                     *)
(*              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.

Lemma range_disjoint:
forall i j,
disjoint i j ->
empty i \/ empty j \/ snd i <= fst j \/ snd j <= fst i.