Im trying to implement the logic of AA grounded extension in prolog logic but I can't figure out how to do it. I have some arguments "argument(a)", "argument(b), and some attacks attacks(a,b). I wan't to check if an argument belongs to the grounded extensions or not. The definition is a grounded extension is:
- A set of arguments S is admissible if it doesn't attack itself and attacks all arguments that attack S.
- S is complete if it is admissible and contains all the arguments it is defending. (attacking the attacker)
- Grounded set is the minimal set of the complete sets.
So for example argument(a), argument(b), argument(c), attacks(a,b), attacks(b,c) should give
admissible: (a), (a,c) () complete: (a,c) grounded: (a,c)
So far I tried:
%noone is attacking you
admissible(X) :-
argument(X),
\+ attacks(_,X).
%Y is attacking you and you are attacking Y
admissible(X) :-
argument(X),
attacks(Y,X),
attacks(X,Y).
%Y is attacking you and Z is defending you
admissible(X) :-
argument(X),
attacks(Y,X),
attacks(Z,Y),
\+ attacks(Z,X),
\+ attacks(X,Z).
%If someone attacks you then you must be defended by someone of your set
complete(X) :-
admissible(X),
attacks(Y,X),
attacks(Z,Y),
\+ attacks(Z,X),
\+ attacks(X,Z).
%TO-DO: I attack Y, check if all Y attacks belong to my set
complete(X) :-
admissible(X),
attacks(X,Y),
attacks(Y,Z),
\+ attacks(Z,X),
\+ attacks(X,Z).
%TO-DO: How do you find the minimum set of complete?
grounded(X) :-
argument(X).