% -----------------------------------------------------------------------------
%  (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 :-
%
% quant        : rules for quantified expressions
%-------------------------------------------------------------------------------
% MODEL DECLARATION FOR THIS FILE :-
%
% rule_family quant:
%         for_all(X, Y)  requires [ X:any, Y:any ] &
%         not X          requires [ X:any        ] &
%         for_some(X, Y) requires [ X:any, Y:any ] &
%         X or Y         requires [ X:any, Y:any ].
%-------------------------------------------------------------------------------


/*** COMMON QUANTIFICATION TECHNIQUES ***/

/*** Rewriting of quantified terms ***/

quant(1):   for_all(X,Y) & (not for_some(X,not Y)) are_interchangeable.
quant(2):   for_all(X,not Y) & (not for_some(X,Y)) are_interchangeable.
quant(3):   for_some(X,Y) & (not for_all(X,not Y)) are_interchangeable.
quant(4):   for_some(X,not Y) & (not for_all(X,Y)) are_interchangeable.
quant(5):   for_all(X,for_all(Y,P)) & for_all(Y,for_all(X,P))
                  are_interchangeable.
quant(6):   for_some(X,for_some(Y,P)) & for_some(Y,for_some(X,P))
                  are_interchangeable.
quant(7):   for_some(Y,for_all(X,P)) may_be_replaced_by
             for_all(X,for_some(Y,P)).

/*** Simple inferences ***/

quant(8):   for_some(X,P) may_be_deduced_from [ for_all(X,P) ].


/*** Inferences involving 'AND' ***/

quant(9):   for_all(X,A) may_be_deduced_from [ for_all(X,A and B) ].
quant(10):  for_all(X,B) may_be_deduced_from [ for_all(X,A and B) ].
quant(11):  for_all(X,A and B) may_be_deduced_from
                  [ for_all(X,A), for_all(X,B) ].
quant(12):  for_some(X,A) may_be_deduced_from [ for_some(X,A and B) ].
quant(13):  for_some(X,B) may_be_deduced_from [ for_some(X,A and B) ].


/*** Inferences involving 'OR' ***/

quant(14):  for_some(X,A or B) may_be_deduced_from [ for_some(X,A) ].
quant(15):  for_some(X,A or B) may_be_deduced_from [ for_some(X,B) ].
quant(16):  for_some(X,A) or for_some(X,B) may_be_deduced_from
                  [ for_some(X,A or B) ].
quant(17):  for_all(X,A or B) may_be_deduced_from [ for_all(X,A) ].
quant(18):  for_all(X,A or B) may_be_deduced_from [ for_all(X,B) ].


/*** Inferences involving '->' ***/

quant(19):  for_some(X,A -> B) may_be_deduced_from [ for_some(X,not A) ].
quant(20):  for_some(X,A -> B) may_be_deduced_from [ for_some(X,B) ].
quant(21):  for_some(X,not A) or for_some(X,B) may_be_deduced_from
                  [ for_some(X,A -> B) ].
quant(22):  for_all(X,A -> B) may_be_deduced_from [ for_all(X,not A) ].
quant(23):  for_all(X,A -> B) may_be_deduced_from [ for_all(X,B) ].


/*** Inferences involving '<->' ***/

quant(24):  for_all(X,A -> B) may_be_deduced_from [ for_all(X,A <-> B) ].
quant(25):  for_all(X,B -> A) may_be_deduced_from [ for_all(X,A <-> B) ].
quant(26):  for_all(X,A <-> B) may_be_deduced_from
                  [ for_all(X,A -> B), for_all(X,B -> A) ].
quant(27):  for_some(X,A -> B) may_be_deduced_from [ for_some(X,A <-> B) ].
quant(28):  for_some(X,B -> A) may_be_deduced_from [ for_some(X,A <-> B) ].
