% -----------------------------------------------------------------------------
%  (C) Altran Praxis Limited
% -----------------------------------------------------------------------------
% 
%  The SPARK toolset is free software; you can redistribute it and/or modify it
%  under terms of the GNU General Public License as published by the Free
%  Software Foundation; either version 3, or (at your option) any later
%  version. The SPARK toolset is distributed in the hope that it will be
%  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
%  Public License for more details. You should have received a copy of the GNU
%  General Public License distributed with the SPARK toolset; see file
%  COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
%  the license.
% 
% =============================================================================


%-------------------------------------------------------------------------------
% RULE FAMILY CONTAINED HEREIN :-
%
% inequals     : inequalities rules applicable to integers only
%-------------------------------------------------------------------------------
% MODEL DECLARATION FOR THIS FILE :-
%
% rule_family inequals:
%         X >= Y requires [ X:i, Y:i ] &
%         X <= Y requires [ X:i, Y:i ] &
%         X > Y  requires [ X:i, Y:i ] &
%         X = Y  requires [ X:i, Y:i ].
%-------------------------------------------------------------------------------


/*** INEQUALS Rules ***/

/*** Integer division basic properties ***/

inequals(86):   N*(A div N)>=A-N+1 may_be_deduced_from [ N>0, A>=0 ].
inequals(87):   (A div N)*N>=A-N+1 may_be_deduced_from [ N>0, A>=0 ].
inequals(88):   N*(A div N)<=A may_be_deduced_from [ N<>0, A>=0 ].
inequals(89):   (A div N)*N<=A may_be_deduced_from [ N<>0, A>=0 ].

inequals(90):   A div N>=0 may_be_deduced_from [ A>=0, N>0 ].
inequals(91):   A div N>0  may_be_deduced_from [ A>=N, N>0 ].
inequals(92):   A div N>0  may_be_deduced_from [ A<=N, N<0 ].

inequals(93):   I div N<=J div N may_be_deduced_from [ I<=J, N>0 ].
inequals(94):   I div N>=J div N may_be_deduced_from [ I>=J, N>0 ].
inequals(95):   I div M=J div N  may_be_deduced_from [ I=J, M=N ].

inequals(96):   N*(A div N)>=A+N+1 may_be_deduced_from [ N<0, A>=0 ].
inequals(97):   (A div N)*N>=A+N+1 may_be_deduced_from [ N<0, A>=0 ].

inequals(98):   A div B>=0 may_be_deduced_from [ A<=0, B<0 ].
inequals(99):   A div B<=0 may_be_deduced_from [ A>=0, B<0 ].
inequals(100):  A div B<=0 may_be_deduced_from [ A<=0, B>0 ].


/*** Other useful integers-only rules ***/

inequals(101):  X>=Y+1 may_be_deduced_from [ X>Y ].
inequals(102):  Y+1<=X may_be_deduced_from [ X>Y ].
inequals(103):  X>=1   may_be_deduced_from [ X>0 ].
