%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Encoding for semi-stable extensions
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% an argument x defeats an argument y if x attacks y
defeat(X,Y) :- att(X,Y),
not vaf.
%% Guess a set S \subseteq A
in(X) :- not out(X), arg(X).
out(X) :- not in(X), arg(X).
%% S has to be conflict-free
:- in(X), in(Y), defeat(X,Y).
%% All arguments x \in S need to be defended by S (admissibility)
defeated(X) :- in(Y), defeat(Y,X).
:- in(X), defeat(Y,X), not defeated(Y).
%% Compute range of S
in_range(X) :- in(X).
in_range(X) :- in(Y), defeat(Y,X).
not_in_range(X) :- arg(X), not in_range(X).
%% Minimize not_in_range to get the subset-maximal sets wrt range (needs metasp)
#minimize [ not_in_range(X) ].