//A \emph{preferred extension} is a subset-maximal complete extension

? s: ? defended_by_s: ? attacked_by_s: 

    //One useful notion is the set of nodes that are **attacked by S**

    ( ! B: in_node(B) =>( attacked_by_s(B) <=> ( ? A: in_attack(A,B) & s(A) ) ) ) &

    // GRINGO:    -s(A) | attacked_by_s(B) :- in_node(B), in_attack(A,B)
    // GRINGO:    s(A): in_attack(A,B) | - attacked_by_s(B) :- in_node(B)

     //Similarly, we define the set of nodes that are **defended by S**

    ( ! B: in_node(B) =>( defended_by_s(B) <=> ( ! A: in_attack(A,B) => attacked_by_s(A) ) ) ) &

    // GRINGO:    defended_by_s(B) | -attacked_by_s(A):in_attack(A,B) :- in_node(B)
    // GRINGO:    -defended_by_s(B) | attacked_by_s(A) :- in_node(B), in_attack(A,B)



    //complete extension:
    ( !B: in_node(B) => ( s(B) <=> defended_by_s(B))) &
    ( ~ (? N: ? N': in_attack(N,N') & s(N) & s(N'))) & 
    //subset-maximal
    ~ ( ? s': ? defended_by_s': ? attacked_by_s': 
      (!B: in_node(B) => (s(B) => s'(B)) ) & 
      (?B: in_node(B) & s'(B) & ~ s(B)) & 
      ( !B: in_node(B) => ( s'(B) <=> defended_by_s'(B)) ) &
      ( ~ ( ? N: ? N': in_attack(N,N') & s'(N) & s'(N'))) &
      
      //Copy of previous definitions:
      ( ! B: in_node(B) =>( defended_by_s'(B) <=> (! A: in_attack(A,B) => attacked_by_s'(A)) ) ) &
      ( ! B: in_node(B) =>( attacked_by_s'(B) <=> (? A: in_attack(A,B) & s'(A)) ) )
    ).
      

      
