%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% badf.lp
%%
%% (C) Thomas Linsbichler, Jörg Pührer, Hannes Strass, 2015
%%
%% Deciding realisability of sets of three-valued interpretations
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BADF realisability
% if a statement sometimes attacks, it cannot be supporting, therefore must be attacking
att(R, S) :- ac(S, I, t), ac(S, J, f), diffFT(I, J, R).
% if a statement sometimes supports, it cannot be attacking, therefore it must be supporting
sup(R, S) :- ac(S, I, f), ac(S, J, t), diffFT(I, J, R).
% diffFT(I, J, S) means that I and J are exactly the same except that
% S is false in I and true in J
member(T, (T, I), I) :- int((T, I)).
member(T, (X, I), (X, R)) :- int((X, I)), member(T, I, R), X != T.
diffFT(I, J, S) :-
int2(I),
int2(J),
member(f(S), I, R),
member(t(S), J, R).
% if a statement is supporting/attacking for another, then this information can be propagated
ac(S, J, f) :- att(R, S), ac(S, I, f), diffFT(I, J, R).
ac(S, J, t) :- sup(R, S), ac(S, I, t), diffFT(I, J, R).
% output atoms for designating polarities
%#show sup/2. #show att/2.