%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Encoding for naive sets % Input: % arg(y) ... y is an argument % att(x, y)... attack with the name x attacks argument y % mem(x, y)... argument y is part of the attack x % % Output: % in(y) ... argument y is in the extension %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Guess some set in(Y) :- arg(Y), not out(Y). out(Y) :- arg(Y), not in(Y). % See which attacks are blocked, i.e. not possible as some member is out blocked(X) :- mem(X, Y), out(Y). % Eliminate all sets that do not block every attack that attacks one of its elements :- in(Y), att(X, Y), not blocked(X). % List all arguments that are currently attacked attackedArgument(Y) :- arg(Y), att(X, Y), not blocked(X). % List all arguments that, when added, would cause some conflict conflArg(Y) :- out(Y), in(X), att(R, X), blocked(R), mem(R, Y), #count{Z : mem(R, Z), out(Z)} = 1. conflArg(X) :- arg(X), att(R, X), mem(R, X), #count{Z : mem(R, Z), out(Z)} = 1. % Eliminate all guesses that spare at least some additional argument :- out(Y), not conflArg(Y), not attackedArgument(Y).