2

New to logic programming (Prolog). Come across a simple question but dont know how to code it in prolog.

Question is like you have several arguements: argument(a),argument(b)..., and several attack relations like attack(a,b) which means argument a attacks argument b. So given an argument I want to find out if it is a grounded one. "Grounded" for an argument a means if b attacks a, then there exists another argument, say c attacks b. If no argument attacks c then we say a and c are grounded.

Can you give an example how to implement this grounded/1 program to achieve this goal.

Not sure I make it clear....But welcome to give any advice (or code)!!

fred
  • 55
  • 7
  • in your example (b attacks a, c attacks b) all three are grounded ? What if you also have d attacks c, which of them would be grounded ? – gusbro Feb 08 '13 at 13:13
  • 1
    Example (b attacks a, c attacks b) gives a,c are grounded, b isn't. If d attacks c then a and d are grounded. c is no longer grounded because it is attacked by d and no argument protects c by attacking d. – fred Feb 08 '13 at 13:32
  • But in that last case (where d attacks b), shouldn't b be also grounded ? Because b is protected by d also... – gusbro Feb 08 '13 at 14:03
  • In my last comment I meant "where d attacks c" – gusbro Feb 08 '13 at 14:12
  • sorry i made a mistake. So if c attacks b, b attacks a, then c,a are grounded. If d attacks c, c attacks b, b attacks a, then d,b are grounded. Sorry for the confusion. – fred Feb 08 '13 at 14:20
  • Basically you can start off by the one that no one attacks is the first grounded argument. And then find the one, say b, that the first grounded attacks, clearly b is not grounded. The one that attacked by b is grounded because it is protected by the first grounded argument. Further grounded ones can be found this way. Besides if x attacks y, and y attacks x then none is grounded. Hope i made it clear – fred Feb 08 '13 at 14:28

2 Answers2

3

What I've understand from your explanation, an argument is grounded when there are no other grounded arguments attacking it.

You can define a procedure grounded/1 which obeys this rule straightforward in prolog:

grounded(A):-
  argument(A),    % A is an argument
  \+              % for which there does not exist
  (
    attack(B, A), % an attacker
    grounded(B)   % which is grounded
  ).

[Edit after comment by OP]: If you have to deal with cycles, then you will probably need to keep a list of visited "attacks", no forbid cycles:

grounded(A):-
  grounded(A, []).


grounded(A, L):-
  argument(A),
  \+
  (
    attack(B, A),
    \+ member(B, L),  % Here we forbid cycles
    grounded(B, [A|L])  % We add the current argument to the list of forbidden arguments
  ).
gusbro
  • 22,357
  • 35
  • 46
  • I found a bug: if a relation like argument a and b attack each other, then the program will loop forever. How to fix this? – fred Feb 08 '13 at 15:59
  • @user16125: If you need to deal with cycles you will probably need to keep track of the attacks (see edited answer) – gusbro Feb 08 '13 at 16:21
  • Depending of the cycle, the grounded semantics may be the empty set, leading the argumentation to different view points, or formally preferred extensions. It could be a good exercise finding out all preferred extensions, when the grounded semantics is empty. – daniel souza May 11 '17 at 01:39
  • @gusbro, consider my answer about the argument grounded semantics, as a guide for the prolog equivalent answer. It should be reformulated, there are more considerations to know. Maybe you are right or there's something missing yet. – daniel souza May 11 '17 at 03:25
0

I don't know how to write in Prolog but the grounded semantics are computed starting from arguments that weren't attacked, given the argument tree.

(Hope it guides @gusbro to find a proper answer to this thread.)

To explain how it's computed, I'll introduce the following function F(x) = {x defends y}, where:

  • If one defended argument is attacked by other deffended argument, then the attacked argument will be removed from the set.
  • And so on, until the function cannot be more extended with more arguments, which it reached the minimal fix point in F.

(Exemple 1) given the following argumentation graph, the grounded extension is Eg = {c, e, f, a}.

So, the first function begins with:

Now let consider computing of grounded extension with cycles.

(Example 2) In the given argumentation graph bellow, e defends b and d, but b is attacked by d, then it can't be included in the grounded semantics. From this point we have a conflict-free set {e, d}. From {e, d} we can apply agin the function F({e, d}) = {e, d, a}, where d defends a from b. Applying again the function F({e, d, a}) = {e, d, a}, showing that {e, d, a} is the minimal fix point in F. Therefore, {e, d, a} is the grounded extension.

(Example 3) In the argumentation tree below, the grounded extension , since There aren't arguments that weren't attacked. Otherwise, If the argument e did not attack itself, the grounded extension should be , which is not the case.

In this last example, the cycle rises to different preferred extensions, where you can use as support the equivalent concept of argument labeling defined elsewhere by Martin Caminada.

Community
  • 1
  • 1
daniel souza
  • 342
  • 3
  • 11