not_refusals(X,Y,_TrX,_TrY,RefusalTraceX,_RefusalTraceY,_YEnabled,_RefusalModel) :-
not_refusals_table(X,Y,RefusalTraceX),!,fail.
not_refusals(X,YList,_TrX,_TrY,RefusalTrace,_RefusalTraceY,_YEnabled,_RefusalModel) :-
assertz(not_refusals_table(X,YList,RefusalTrace)),
YList=[X|_],csp_mode,!,fail.
not_refusals(_X,YList,_TraceX,_TraceY,_RefusalTraceX,_RefusalTraceY,_YEnabled,_RefusalModel) :-
\+(spec_completely_explored),
spec_list_contains_unexplored_node(YList),!,
fail.
not_refusals(X,_YList,_TraceX,TraceY,_RefusalTraceX,RefusalTraceY,_YEnabledList,RefusalModel) :-
(RefusalModel == refusals_div ->
impl_diverges(X),
append(TraceY,[spec_cannot_diverge],RefusalTraceY)
; fail
).
not_refusals(X,YList,TraceX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,_RefusalModel) :-
impl_stable(X),
prefix(TraceX,TraceY),
\+impl_trans(X,_A,_X2), % we have a deadlock here
spec_does_not_deadlock(YList),
%print('Deadlock in SpecY does not occur => FAILURE!'),nl,
append(TraceX,[refuse('Sigma')],RefusalTraceX),
findall(AA,(spec_stable_par_trans(YList,AA,_),AA\=tau),YListChoices),
remove_dups(YListChoices,YEnabledList),
get_refused_set(YEnabledList,RefusedSetY),
append(TraceY,[refuse(RefusedSetY)],RefusalTraceY).
not_refusals(X,YList,TraceX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel) :-
impl_stable(X),
prefix(TraceX,TraceY),
impl_trans(X,A,X2),
impl_all_possible_actions(X,AllXActions),
get_refused_set(AllXActions,RefusedSet),
append(TraceX,[refuse(RefusedSet),go(A,X2)],NTX),
check_go_step_refusal(A,RefusedSet,X2,YList,NTX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel).
not_refusals(X,YList,TraceX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel) :-
unstable_state_with_enabled_visible_actions(X),
prefix(TraceX,TraceY),
%print(unstable_state_with_enabled_visible_actions),nl,
RefusedSet=bullet, % the bullet set
impl_non_tau_trans(X,A,X2),
append(TraceX,[refuse(RefusedSet),go(A,X2)],NTX),
check_go_step_refusal(A,RefusedSet,X2,YList,NTX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel).
not_refusals(X,YList,TraceX,TraceY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel) :-
impl_trans(X,tau,X2),
append(TraceX,[refuse(bullet),go(tau_direct,X2)],NTX),
append(TraceY,[refuse(bullet),go(tau_direct,_)],NTY),
not_refusals(X2,YList,NTX,NTY,RefusalTraceX,RefusalTraceY,YEnabledList,RefusalModel).