% File 'macros.std', implicitly included at the beginning of
% every CCalc input file

% Abbreviations for static propositions

:- macros
  caused #1
	-> caused #1 if true ;
  constraint #1 			% formerly 'always'
	-> caused false if -(#1) ; 
  never #1
	-> caused false if #1 ;
  default #1 if #2
	-> caused #1 if #1 && #2 ;
  default #1
	-> caused #1 if #1 ;
  exogenous #1,#2
	-> (exogenous #1; exogenous #2) ;
  exogenous #1
	-> default #1 = var(sort(#1),a) .

% Abbreviations for dynamic propositions

:- macros
  caused #1 after #3 
	-> caused #1 if true after #3 ;
  possibly caused #1 if #2 after #3 
	-> caused #1 if #1 && #2 after #3 ;
  possibly caused #1 after #2
	-> caused #1 if #1 after #2 ;
  #1 causes #2 if #3
	-> caused #2 if true after #3 && #1 ;
  #1 causes #2
	-> caused #2 if true after #1 ;
  #1 may cause #2 if #3
	-> caused #2 if #2 after #3 && #1 ;
  #1 may cause #2
	-> caused #2 if #2 after o(#1) ;
  nonexecutable #1 if #2
	-> caused false after #2 && #1 ;
  nonexecutable #1
	-> caused false after #1 ;
  #1 describes #2
	-> caused false after #1 = na <-> #2 ;
  inertial #1,#2 if #3
		-> (inertial #1 if #3; inertial #2 if #3) ;
  inertial #1 if #2
	-> possibly caused #1 = var(sort(#1)) 
	             after #1 = var(sort(#1)) && #2 ;
  inertial #1,#2
	-> (inertial #1; inertial #2) ;
  inertial #1
	-> possibly caused #1 = var(sort(#1))
	             after #1 = var(sort(#1)) ;
  rigid #1,#2
	-> (rigid #1; rigid #2) ;
  rigid #1
	-> caused false if -(#1 = var(sort(#1))
	                after #1 = var(sort(#1) .

% Macros used in queries and in file 'history.std'

:- macros
 anyFluentValues
	-> var(step) : exogenous var(fluent(sort)) ;
 anyActions
	-> var(step) : exogenous var(action(sort))
				where var(step) < maxstep ;
 anyHistory
	-> ( anyFluentValues ; anyActions ) ;
 anyInitialState
	-> 0 : exogenous var(fluent(sort)) ;
 cwaActions
	-> default -(var(step) : var(action(boolean))) .


