NB: This Coq documentation contains a revised version of the Coq implementation of these papers [1], [2], [3], [4], and is also the support for ongoing research. A partial archive (14/01/2001) is available at here. Drop us a line if you are interested in a complete, up-to-date archive.

Library ssrnat_ext

Require Import ssreflect ssrbool ssrnat.
Export ssrnat.

Lemma leq_and_ltn' : forall l l', l <= l' < l = false.

Lemma leq_and_ltn'' : forall l l', l <= l' < l.+1 -> l = l'.

Lemma ltn_total : forall l l', l < l' \/ l' <= l.

Lemma ltn_leq_trans : forall n m p, m < n -> n <= p -> m < p.

Lemma eq_succ : forall l, ~ l = l.+1.

Ltac arith_hypo_ssrnat2coqnat :=
  match goal with
    | H : context [?L < ?R] |- _ => move/ltP: H => H
    | H : context [?L <= ?R] |- _ => move/leP: H => H
    | H : context [?L < ?M < ?R] |- _ => let H1 := fresh in case/andP: H => H H1
    | H : context [?L <= ?M < ?R] |- _ => let H1 := fresh in case/andP: H => H H1
  end.


Ltac arith_goal_ssrnat2coqnat :=
  rewrite -?plusE ;
  match goal with
    | |- is_true (_ < _)%nat => apply/ltP
    | |- _ => idtac
  end.

Require Import Omega.

Ltac ssrnat_omega :=
  repeat arith_hypo_ssrnat2coqnat ;
  arith_goal_ssrnat2coqnat ;
  omega.