
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%                Auxiliary Prolog predicates 
%     for using {log} for the Test Template Framework (TTF)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%           by Gianfranco Rossi and Maximiliano Cristia'
%                          August 2012 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


is_pfun({}) :- !.
is_pfun(S) :-
   S = (PFun with P), 
   is_pfun_cont(PFun,P),
   is_pfun(PFun).

is_pfun_cont({},_P1) :- !.
is_pfun_cont(S,P1) :- 
   S = (F1 with P2),
   nofork(P1,P2),
   is_pfun_cont(F1,P1).

nofork([X1,_Y1],[X2,_Y2]) :- 
   X1 \== X2, !.
nofork([X1,Y1],[X2,Y2]) :-  
   X1 = X2, Y1 = Y2.

dom_all_known({}) :- !.
dom_all_known(S) :-
   S = (PFun with [X,_]), 
   nonvar(X),
   dom_all_known(PFun).



    
