(* (c) Copyright 2006-2016 Microsoft Corporation and Inria.                  *)
(* Distributed under the terms of CeCILL-B.                                  *)
From mathcomp
(****************************************************************************)
(* This is a small library to do epsilon - N reasonning.                    *)
(* In order to use it, one only has to know the following tactics:          *)
(*                                                                          *)
(*      pose_big_enough i == pose a big enough natural number i             *)
(*   pose_big_modulus m F == pose a function m : F -> nat which should      *)
(*                           provide a big enough return value              *)
(* exists_big_modulus m F := pose_big_modulus m F; exists m                 *)
(*             big_enough == replaces a big enough constraint x <= i        *)
(*                           by true and implicity remembers that i should  *)
(*                           be bigger than x.                              *)
(*                close   == all "pose" tactics create a dummy subgoal to   *)
(*                           force the user to explictely indicate that all *)
(*                           constraints have been found                    *)
(****************************************************************************)
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Module BigEnough.
Record big_rel_class_of T (leq : rel T) :=
BigRelClass {
leq_big_internal_op : rel T;
bigger_than_op : seq T -> T;
_ : leq_big_internal_op = leq;
_ : forall i s, leq_big_internal_op i (bigger_than_op (i :: s));
_ : forall i j s, leq_big_internal_op i (bigger_than_op s) ->
leq_big_internal_op i (bigger_than_op (j :: s))
}.
Record big_rel_of T := BigRelOf {
leq_big :> rel T;
big_rel_class : big_rel_class_of leq_big
}.
Definition bigger_than_of T (b : big_rel_of T)
(phb : phantom (rel T) b) :=
bigger_than_op (big_rel_class b).
Notation bigger_than leq := (@bigger_than_of _ _ (Phantom (rel _) leq)).
Definition leq_big_internal_of T (b : big_rel_of T)
(phb : phantom (rel T) b) :=
leq_big_internal_op (big_rel_class b).
Notation leq_big_internal leq := (@leq_big_internal_of _ _ (Phantom (rel _) leq)).

(* Specifications: *)
Lemma next_bigger_than T (b : big_rel_of T) i j s :
leq_big_internal b i (bigger_than b s) ->
leq_big_internal b i (bigger_than b (j :: s)).