%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Encoding for stage sets % Input: % arg(x, c) ...x is an argument with claim c % att(c, x) ...claim c attacks argument x % % Output: % in(c) ...claim c is in the extension %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Guess a set S of arguments inArg(X) :- not outArg(X), arg(X, _). outArg(X) :- not inArg(X), arg(X, _). in(C) :- inArg(X), arg(X, C). % S has to be conflict-free :- inArg(X), in(C), att(C, X). % compute the range of inArg inRange(X) :- inArg(X). inRange(X) :- in(C), att(C, X). % guess an extended range non_trivial :- arg(X, _), not inRange(X). eInRange(X) :- inRange(X), non_trivial. eInRange(X) : arg(X, _), not inRange(X) :- non_trivial. eIn(C) :- arg(X, C), baseSet(X), non_trivial. % try to find an admissible base set that witnesses the extended range % Each element of the extended range must either be in the set or must be attacked an element of it baseSet(X) | baseSet(Y) : att(C, X), arg(Y, C) :- eInRange(X), non_trivial. % The base set must be conflict-free fail :- baseSet(X), eIn(C), att(C, X), non_trivial. % Saturize failed guesses eInRange(X) :- fail, arg(X, _), non_trivial. baseSet(X) :- fail, arg(X, _), non_trivial. :- not fail, non_trivial. #show in/1.