% -----------------------------------------------------------------------------
%  (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 FAMILIES CONTAINED HEREIN :-
%
% transitivity : transitivity of relational operators
% strengthen   : inequalities strengthening rules
% negation     : negation of inequalities rules
%-------------------------------------------------------------------------------
% MODEL DECLARATIONS FOR THIS FILE :-
%
% rule_family transitivity:
%         X <= Y requires [ X:ire, Y:ire ] &
%         X >= Y requires [ X:ire, Y:ire ] &
%         X < Y  requires [ X:ire, Y:ire ] &
%         X > Y  requires [ X:ire, Y:ire ] &
%         X = Y  requires [ X:any, Y:any ] &
%         X <> Y requires [ X:any, Y:any ].
%
% rule_family strengthen:
%         X > Y  requires [ X:ire, Y:ire ] &
%         X < Y  requires [ X:ire, Y:ire ] &
%         X = Y  requires [ X:ire, Y:ire ].
%
% rule_family negation:
%         not X  requires [ X:any        ] &
%         X <> Y requires [ X:any, Y:any ] &
%         X = Y  requires [ X:any, Y:any ] &
%         X <= Y requires [ X:ire, Y:ire ] &
%         X > Y  requires [ X:ire, Y:ire ] &
%         X >= Y requires [ X:ire, Y:ire ] &
%         X < Y  requires [ X:ire, Y:ire ].
%-------------------------------------------------------------------------------


/*** TRANSITIVITY Rules ***/

transitivity(1):        I<=K may_be_deduced_from [ I<=J, J<=K ].
transitivity(2):        I<=K may_be_deduced_from [ I<=J, J<K  ].
transitivity(3):        I<=K may_be_deduced_from [ I<=J, J=K  ].
transitivity(4):        I<=K may_be_deduced_from [ I<J,  J<=K ].
transitivity(5):        I<=K may_be_deduced_from [ I<J,  J<K  ].
transitivity(6):        I<=K may_be_deduced_from [ I<J,  J=K  ].
transitivity(7):        I<=K may_be_deduced_from [ I=J,  J<=K ].
transitivity(8):        I<=K may_be_deduced_from [ I=J,  J<K  ].
transitivity(9):        I<=K may_be_deduced_from [ I=J,  J=K  ].

transitivity(10):       K>=I may_be_deduced_from [ I<=J, J<=K ].
transitivity(11):       K>=I may_be_deduced_from [ I<=J, J<K  ].
transitivity(12):       K>=I may_be_deduced_from [ I<=J, J=K  ].
transitivity(13):       K>=I may_be_deduced_from [ I<J,  J<=K ].
transitivity(14):       K>=I may_be_deduced_from [ I<J,  J<K  ].
transitivity(15):       K>=I may_be_deduced_from [ I<J,  J=K  ].
transitivity(16):       K>=I may_be_deduced_from [ I=J,  J<=K ].
transitivity(17):       K>=I may_be_deduced_from [ I=J,  J<K  ].
transitivity(18):       K>=I may_be_deduced_from [ I=J,  J=K  ].

transitivity(19):       I<K  may_be_deduced_from [ I<=J, J<K  ].
transitivity(20):       I<K  may_be_deduced_from [ I<J,  J<=K ].
transitivity(21):       I<K  may_be_deduced_from [ I<J,  J<K  ].
transitivity(22):       I<K  may_be_deduced_from [ I<J,  J=K  ].
transitivity(23):       I<K  may_be_deduced_from [ I=J,  J<K  ].


transitivity(24):       K>I  may_be_deduced_from [ I<=J, J<K  ].
transitivity(25):       K>I  may_be_deduced_from [ I<J,  J<=K ].
transitivity(26):       K>I  may_be_deduced_from [ I<J,  J<K  ].
transitivity(27):       K>I  may_be_deduced_from [ I<J,  J=K  ].
transitivity(28):       K>I  may_be_deduced_from [ I=J,  J<K  ].

transitivity(29):       I=K  may_be_deduced_from [ I=J,  J=K  ].

transitivity(30):       I<>K may_be_deduced_from [ I<>J, J=K  ].



/*** STRENGTHEN Rules ***/

strengthen(1):  I>J may_be_deduced_from [ I>=J, I<>J ].
strengthen(2):  J<I may_be_deduced_from [ I>=J, I<>J ].
strengthen(3):  I=J may_be_deduced_from [ I>=J, I<=J ].



/*** Rules for manipulation of logical NOT operator ***/

negation(1):    not(A=B) & A<>B are_interchangeable.
negation(2):    not(A<>B) & A=B are_interchangeable.
negation(3):    not(A>B) & A<=B are_interchangeable.
negation(4):    not(A<=B) & A>B are_interchangeable.
negation(5):    not(A<B) & A>=B are_interchangeable.
negation(6):    not(A>=B) & A<B are_interchangeable.
negation(7):    not(A=B) & B<>A are_interchangeable.
negation(8):    not(A<>B) & B=A are_interchangeable.
negation(9):    not(A>B) & B>=A are_interchangeable.
negation(10):   not(A<=B) & B<A are_interchangeable.
negation(11):   not(A<B) & B<=A are_interchangeable.
negation(12):   not(A>=B) & B>A are_interchangeable.
