Solving Advanced Argumentation Problems with Answer Set Programming

Powerful formalisms for abstract argumentation have been proposed, among them abstract dialectical frameworks (ADFs) that allow for a succinct and flexible specification of the relationship between arguments, and the GRAPPA framework which allows argumentation scenarios to be represented as arbitrary edge-labelled graphs. The complexity of ADFs and GRAPPA is located beyond NP and ranges up to the third level of the polynomial hierarchy. The combined complexity of Answer Set Programming (ASP) exactly matches this complexity when programs are restricted to predicates of bounded arity. In this paper, we exploit this coincidence and present novel efficient translations from ADFs and GRAPPA to ASP. More specifically, we provide reductions for the five main ADF semantics of admissible, complete, preferred, grounded, and stable interpretations, and exemplify how these reductions need to be adapted for GRAPPA for the admissible, complete and preferred semantics. Under consideration in Theory and Practice of Logic Programming (TPLP).

Argumentation is an active area of research with applications in legal reasoning (Bench-Capon and Dunne 2005), decision making (Amgoud and Prade 2009), e-governance (Cartwright and Atkinson 2009) and multi-agent systems (McBurney et al. 2012). Dung's argumentation frameworks (Dung 1995), AFs for short, are widely used in argumentation. They focus entirely on conflict resolution among arguments, treating the latter as abstract items without logical structure. Although AFs are quite popular, various generalizations aiming for easier and more natural representations have been proposed; see  for an overview. We focus on two such generalizations, namely ADFs (Brewka and Woltran 2010;Brewka et al. 2013) and GRAPPA , which are expressive enough to capture many of the other available frameworks; see also the recent handbook article  which surveys both formalisms. Reasoning in ADFs spans the first three levels of the polynomial hierarchy (Strass and Wallner 2015). These results carry over to GRAPPA . ADFs, in particular, have received increasing attention recently, see e.g. (Gaggl and Strass 2014;Booth 2015) including also practical applications in fields such as legal reasoning (Al-Abdulkarim et al. 2016;Atkinson and Bench-Capon 2018), text exploration (Cabrio and Villata 2016) or discourse analysis (Neugebauer 2018).
Two approaches to implement ADF reasoning have been proposed in the literature. QADF (Diller et al. 2014;Diller et al. 2015) encodes problems as quantified Boolean formulas (QBFs) such that a single call of a QBF solver delivers the result. The DIAMOND family of systems (Ellmauthaler and Strass 2014;Ellmauthaler and Strass 2016;Strass and Ellmauthaler 2017), on the other hand, employ Answer Set Programming (ASP). Since the DIAMOND systems rely on static encodings, i.e. the encoding does not change for different framework instances, this approach is limited by the data complexity of ASP (which only reaches the second level of the polynomial hierarchy (Eiter and Gottlob 1995;Eiter et al. 1997)). Therefore, the preferred semantics in particular (which comprise the hardest problems for ADFs and GRAPPA) needs a more complicated treatment involving two consecutive calls to ASP solvers with a possibly exponential blowup for the input of the second call. A GRAPPA interface has been added to DIAMOND (Berthold 2016), but we are not aware of any systems for GRAPPA not employing a translation to ADFs as an intermediate step.
In this paper, we introduce a new method for implementing reasoning tasks related to both ADFs and GRAPPA such that even the hardest among the problems are treated with a single call to an ASP solver (and avoiding any exponential blow-up in data or program size). The reason for choosing ASP is that the rich syntax of GRAPPA is captured much more easily by ASP than by other formalisms like QBFs. Our approach makes use of the fact that the combined complexity of ASP for programs with predicates of bounded arity (Eiter et al. 2007) exactly matches the complexity of ADFs and GRAPPA. This approach is called dynamic, because the encodings are generated individually for every instance. This allows to generate rules of arbitrary length that can take care of NP-hard subtasks themselves. This particular method has been advocated in (Bichler et al. 2016b) in combination with tools that decompose such long rules whenever possible in order to avoid huge groundings (Bichler et al. 2016a). To the best of our knowledge, our work is the first to apply this technique in the field of argumentation.
More specifically, we provide encodings for the admissible, complete, preferred, grounded and stable semantics for ADFs and discuss how such encodings can be adapted to GRAPPA. Depending on the semantics (and their complexity) the encodings yield normal or, in the case of preferred semantics, disjunctive programs. We specify the encodings in a modular way, which makes our approach amenable for extensions to other semantics. We further provide some details about the resulting system YADF ("Y" standing for dYnamic) which is publicly available at https://www.dbai.tuwien.ac.at/proj/adf/yadf/. Finally, we give an overview of recent empirical evaluations, including our own, comparing the performance of YADF with the other main existing ADF systems.
This paper is an extended version of ), which did not contain the encodings for the grounded and stable semantics. In addition, we provide some prototypical proofs for the correctness of the encodings. We also update the discussion on empirical evaluations. The paper is based on (Section 3.2 of) the second author's thesis (Diller 2019).

Background
ADFs. An ADF is a directed graph whose nodes represent statements. The links represent dependencies: the acceptance status of a node s only depends on the acceptance status of its parents (denoted par(s); often also with a subscript as in par D (s) to make the reference to the ADF D explicit), that is, the nodes with a direct link to s. In addition, each node s has an associated acceptance condition C s specifying the conditions under which s is acceptable.
It is convenient to represent the acceptance conditions as a collection C = {ϕ s } s∈S of propositional formulas. This leads to the logical representation of ADFs we will use in this paper where an ADF D is a pair (S,C) with the set of links L implicitly given as (a, b) ∈ L iff a appears in ϕ b .
Semantics assign to ADFs a collection of (3-valued) interpretations, i.e. mappings of the statements to truth values {1, 0, u}, denoting true, false and undecided, respectively. The three truth values are partially ordered by ≤ i according to their information content: we have u < i 1 and u < i 0 and no other pair in < i . The information ordering ≤ i extends in a straightforward way to interpretations v 1 , v 2 over S in that v 1 ≤ i v 2 iff v 1 (s) ≤ i v 2 (s) for all s ∈ S.
An interpretation v is 2-valued if all statements are mapped to 1 or 0. For interpretations v and w, we say that w extends v iff v ≤ i w. We denote by [v] 2 the set of all completions of v, i.e.

2-valued interpretations that extend v.
For an ADF D = (S,C), s ∈ S and an interpretation v, the characteristic function Γ D (v) = v is given by That is, the operator returns an interpretation mapping a statement s to 1 (resp. 0) iff all 2-valued interpretations extending v evaluate ϕ s to true (resp. false). Intuitively, Γ D checks which truth values can be justified based on the information in v and the acceptance conditions. Note that Γ D is defined on 3-valued interpretations, while we evaluate acceptance conditions under their 2-valued completions.
Given an ADF D = (S, {ϕ s } s∈S ), an interpretation v is admissible w.
adm v 4 1 1 u adm v 5 u 1 1 adm v 6 1 u u adm, com, grd v 7 1 0 u adm, com, prf v 8 1 1 1 adm, com, prf, mod Table 1. All admissible interpretations of the ADF from Figure 1. The right most column shows further semantics the interpretations belong to.
interpretation v is the (unique) grounded interpretation w.r.t. D if v is complete and there is no other complete interpretation w for which w < i v.
Turning to semantics returning 2-valued interpretations, a 2-valued interpretation v is a model of D if v(s) = v(ϕ s ) for every s ∈ S. The definition of the stable semantics for ADFs is inspired by the stable semantics for logic programs, its purpose being to disallow cyclic support within a model. First of all, in order to be a stable model of D v needs to be a model of D. Secondly, E v = {s ∈ S | v(s) = 1} must equal the statements set to true in the grounded interpretation of the and undefined otherwise, then the latter amounts to the fact that v E v be the grounded interpretation of D v .

Example 1
In Figure 1 we see an example ADF D = ({a, b, c},C) with the acceptance conditions C given by ϕ a = b ∨ ¬b, ϕ b = b and ϕ c = c → b. The acceptance conditions are shown below the statements in the figure.
The admissible interpretations of D are shown in Table 1. Moreover, the right-most column shows further semantics the interpretations belong to. For instance the interpretation v 8 mapping each statement to true is admissible, complete and preferred in D and a model of D. The only model of D is v 8 , with the reduct of this model being D v 8 = D. The grounded interpretation of D is v 6 , which is different from v 8 . Therefore v 8 is not a stable model. In fact, D does not have a stable model.

GRAPPA.
ADFs are particularly useful as target formalism of translations from graph-based approaches. This raises the question whether an ADF style semantics can be directly defined for arbitrary labelled graphs, thus circumventing the need for any translations. GRAPPA  fulfills exactly that goal.
GRAPPA allows argumentation scenarios to be defined using arbitrary directed edge-labelled graphs. The nodes in S represent statements, as before. Labels of links, which may be chosen as needed, describe the type of relationship between a node and its parents. As for ADFs, each node has its own acceptance condition, and the semantics of a graph is defined in terms of 3valued interpretations. The major difference is that acceptance conditions are no longer specified in terms of the acceptance status of the parents of a node, but on the labels of its active incoming links, where a link is active if its source node is true and a label is active if it is the label of an active link. More precisely, since it can make an important difference whether a specific label appears once or more often on active links, the acceptance condition depends on the multiset of active labels of a node, that is, an acceptance condition is a function of the form (L → N) → {1, 0}, where L is the set of all labels.
GRAPPA acceptance functions are specified using acceptance patterns over a set of labels L defined as follows: • A term over L is of the form #(l), # t (l) (with l ∈ L), or min, min t , max, max t , sum, sum t , count, count t . • A basic acceptance pattern (over L) is of the form a 1 t 1 + · · · + a n t n R a, where the t i are terms over L, the a i s and a are integers and R ∈ {<, ≤, =, =, ≥, >}. • An acceptance pattern (over L) is a basic acceptance pattern or a Boolean combination of acceptance patterns.
A GRAPPA instance is a tuple G = (S, E, L, λ , α) where S is a set of statements, E a set of edges, L a set of labels, λ an assignment of labels to edges, and α an assignment of acceptance patterns over L to nodes.
For a multiset of labels m : L → N and s ∈ S the value function val m s is: sum (t) are undefined in case of non-numerical labels. For / 0 they yield the neutral element of the corresponding operation, i.e. val m s (sum) = val m s (sum t ) = 0, val m s (min) = val m s (min t ) = ∞, and val m s (max) = val m s (max t ) = −∞. Let m and s be as before. For a basic acceptance pattern α = a 1 t 1 + · · · + a n t n R we define α(m, s) = 1 if ∑ n i=1 a i val m s (t i ) R a, while α(m, s) = 0 otherwise. The extension to the evaluation of Boolean combinations is as usual.
The characteristic function Γ G for a GRAPPA instance G, as is the case for the characteristic function for ADFs, takes a 3-valued interpretation v and produces a new one v . Again v is constructed by considering all 2-valued completions w of v, picking a classical truth value only if all extensions produce the same result. But this time an intermediate step is needed to determine the truth value of a node s: one first has to determine the multiset of active labels of s generated by w. The acceptance function then takes this multiset as argument and produces the truth value induced by w.
Let v be a two valued interpretation. The multi-set of active labels of s ∈ S in G under v, m v s , is defined as With this new characteristic function the semantics of a graph G can be defined as for ADFs, that is, an interpretation all edges being labelled with + except (b, b) with -, and the acceptance condition # t (+) − #(+) = 0∧#(-) = 0 (i.e. all +-links must be active and no --link is active) for each statement. The following interpretations are admissible w.r.t.
ASP. In Answer Set Programming (Leone et al. 2006;Brewka et al. 2011) problems are described using logic programs, which are sets of rules of the form Here each a i (1 ≤ i ≤ n) and b j (1 ≤ j ≤ m) is a ground atom. The symbol not stands for default negation. We call a rule a fact if n = 0. An (input) database is a set of facts. A rule r is normal if n ≤ 1 and a constraint if n = 0. B(r) denotes the body of a rule and H(r) the head. A program is a finite set of disjunctive rules. If each rule in a program is normal we call the program normal, otherwise the program is disjunctive.
Each logic program π induces a collection of so-called answer sets, denoted as AS(π), which are distinguished models of the program determined by the answer set semantics. The answer sets of a program π are the subset-minimal models satisfying the Gelfond-Lifschitz reduct π I of π; see (Gelfond and Lifschitz 1991) for details.
For non-ground programs, which we use here, rules with variables are viewed as shorthand for the set of their ground instances. We denote by Gr(π) the ground instance of a program π. Modern ASP solvers offer further additional language features such as built-in arithmetics and aggregates which we make use of in our encodings (we refer to (Gebser et al. 2015) for an explanation).
Complexity. The complexity results that are central for our work are given in Table 2. Here credulous reasoning means deciding whether a statement (resp. atom) is true in at least one interpretation (resp. answer set) of the respective type, skeptical reasoning whether it is true in all such interpretations (resp. answer sets).
The results for ADFs (Strass and Wallner 2015) carry over to GRAPPA, as argued in . The results for normal and disjunctive ASP-programs we use here refer to the combined complexity for non-ground programs of bounded predicate arity (i.e. there exists a constant n ∈ N such that the arity of every predicate occurring in the program is smaller than n) and are due to (Eiter et al. 2007). We recall that the combined complexity of arbitrary programs is much higher (NEXP-hard, see e.g. (Eiter et al. 1997)) while data complexity (i.e. the ASPprogram is assumed to be static and only the database of the program is changing) is one level lower in the polynomial hierarchy (follows from (Eiter and Gottlob 1995)).
These results indicate that there exist efficient translations to non-ground normal programs of bounded arity for credulous reasoning w.r.t. the admissible, complete, preferred, and stable semantics; skeptical reasoning for the stable semantics can be reduced to skeptical reasoning for normal programs. Skeptical preferred reasoning needs to be treated with disjunctive programs. We provide such reductions in what follows.

ADF encodings
We construct ASP encodings π σ for the semantics σ ∈ {adm, com, prf, grd, stb} such that there is a correspondence between the σ interpretations of an ADF D = (S,C) and the answer sets of π σ (D) (the encoding function π σ applied to D). More precisely, we will use atoms asg(s, x) with s ∈ S, x ∈ {1, 0, u} to represent ADF interpretations in our encodings. An interpretation v of D and a set of ground atoms (interpretation of an ASP program) I correspond to each other, v ∼ = I, whenever for every s ∈ S, v(s) = x iff asg(s, x) ∈ I. We overload ∼ = to get the correspondence between sets of interpretations and sets of answer sets we aim for.

Definition 1
Given a set of (ADF) interpretations V and a collection of sets of ground atoms (ASP interpretations) I , we say that V and I correspond, Having encodings π σ for σ ∈ {adm, com, prf, grd, stb} for which σ (D) ∼ = AS(π σ (D)) for any ADF D allows to enumerate the σ interpretations of an ADF D by reading the ADF interpretations that correspond (via ∼ =) to each I ∈ AS(π σ (D)) off the predicates asg(s, x) ∈ I (s ∈ S, x ∈ {1, 0, u}). Results for credulous and skeptical reasoning for each of the semantics are obtained via the homonymous ASP reasoning tasks applied on our encodings.

Encoding for the admissible semantics
In the course of presenting our dynamic ASP encodings for the admissible semantics we introduce several elements we will make use of throughout Section 3. Among these is that all encodings will assume a simple set of facts indicating the statements of the input ADF D = (S, {ϕ S } s∈S ): Also, several of the encodings will need facts for encoding the possible truth values that can be assigned to a statement s by a completion of an interpretation mapping s to u, 1, and 0, respectively: Here, for instance the atoms lt(u, 0) and lt(u, 1) together express that if an ADF interpretation maps a statement to the truth value u then a completion (of the interpretation in question) can map the same statement to the truth values 0 or 1. Note in particular that lt(u, u) ∈ π lt since completions can map a statement only to the truth value 0 or 1.
All of our encodings, including the one for the admissible semantics, follow the guess & check methodology that is at the heart of the ASP paradigm (Janhunen and Niemelä 2016). Here parts of a program delineate candidates for a solution to a problem. These are often referred to as "guesses". Other parts of the program, the "constraints", then check whether the guessed candidates are indeed solutions. In the case of the encodings for ADFs the guessing part of the programs outline possible assignments of truth values to the statements, i.e. an ADF interpretation. For the three valued semantics, as the admissible semantics, the rules are as follows: π guess := {asg(S, 0):-not asg(S, 1), not asg(S, u), arg(S). asg(S, 1):-not asg(S, u), not asg(S, 0), arg(S).
We follow (Bichler et al. 2016b) in encoding NP-checks in large non-ground rules having bodies with predicates of bounded arity. In particular, in all our encodings we will need rules encoding the semantic evaluation of propositional formulas; e.g. the evaluation of the acceptance conditions by completions of an interpretation. Given a propositional formula φ , for this we introduce the function Ω. For assignments of truth values (1 and 0) to the propositional variables in φ , Ω(φ ) gives us a set of atoms corresponding to the propagation of the truth values to the subformulas of φ in accordance with the semantics of classical propositional logic. The atoms make use of ASP variables V ψ where ψ is a subformula of φ . The variables V p , where p is a propositional variable occurring in φ , can be used by other parts of ASP rules employing the atoms in Ω(φ ) for purposes of assigning intended truth values to the propositional variables in φ .
For the definition of the atoms Ω(φ ) we rely on the ASP built in arithmetic functions & (bitwise AND), ? (bitwise OR), and -(subtraction). We also use the built in comparison predicate =. Let φ be a propositional formula over a set of propositional variables P; then the set of atoms in question is defined as Our encoding for the admissible semantics, π adm , is based on the fact that an interpretation v for an ADF D is admissible iff for every s ∈ S it is the case that This is a simple consequence of the definition of the admissible semantics. Any w ∈ [v] 2 which contradicts this simple observation (e.g. v(s) = 1 and w(ϕ s ) = 0) is a "counter-model" to v being an admissible interpretation. The constraining part of our encoding for the admissible semantics essentially disallows guessed assignments of truth values to the statements of an ADF corresponding to ADF interpretations which have counter-models to them being admissible.
To encode the constraints of our encoding we need auxiliary rules firing when the guessed assignments have counter-models to them being admissible. These rules, two for each s ∈ S, make use of bodies ω s where Ω(ϕ s ) is employed to evaluate the acceptance conditions by the completions. The latter are obtained by setting variables V t for t ∈ par D (s) with the adequate truth values by using the predicates asg and lt defined in π guess and π lt : The two rules for every statement s ∈ S have heads sat(s) and inv(s) that fire in case there is some completion of the interpretation corresponding to the assignments guessed in the program fragment π guess such that the acceptance condition ϕ s evaluates to 1 and 0, respectively: Here for an ADF interpretation v "guessed" via the fragment π guess (and encoded using the predicate "asg") and a s ∈ S, sat(s) is derived whenever v(s) = 0 and there is a w ∈ [v] 2 for which w(φ s ) = 1. On the other hand, inv(s) is derived whenever v(s) = 1 and there is a w ∈ [v] 2 for which w(φ s ) = 0. The atoms using predicates "asg" and "lt" in ω s are used to encode possible assignments a completion w ∈ [v] 2 can take, while the atoms in Ω(ϕ s ) propagate such assignments to ϕ s in accordance with the semantics of classical propositional logic by making use of ASP built-ins and auxiliary variables V ψ for every subformula ψ of ϕ s . The encoding for the admissible semantics now results from compounding the program fragments π arg (D), π lt , π guess , and π sat (D) together with ASP constraints which filter out guessed assignments of statements to truth values (via π guess ) corresponding to interpretations of D having counter-models to being admissible: π adm (D) := π arg (D) ∪ π lt ∪ π guess ∪ π sat (D) ∪ {:-arg(S), asg(S, 1), inv(S). :-arg(S), asg(S, 0), sat(S).}.
For instance the last constraint in π adm (D) disallows guessed interpretations v for which there is a s ∈ S and w ∈ [v] 2 such that v(s) = 0 and w(ϕ s ) = 1.
Proposition 1 formally states that π adm is an adequate encoding function. For the proof, which is prototypical for most of the proofs of correctness in this work, we use the notation For an ASP interpretation I (set of ground atoms), I p represents I projected onto the predicate p (with arity n).

Proof
Let D = (S, {ϕ S } s∈S ) be an ADF and v ∈ adm(D). Let also be a set of ground atoms (such that v ∼ = I). We prove now that I ∈ AS(π adm (D)).
We start by proving that I satisfies π adm (D) I . First note that I satisfies π arg (D) I = π arg (D) as well as π I lt = π lt since all the atoms making up the facts in these two modules are in I (first two lines of the definition of I). I also satisfies since, first of all, arg(s) ∈ I iff s ∈ S by the first line of the definition of I (and the fact that the predicate arg does not appear in the head of any rules other than π arg (D) I = π arg (D)). Secondly, for any s ∈ S, asg(s, x) ∈ I whenever asg(s, y) ∈ I and asg(s, z) ∈ I for x ∈ {1, 0, u} and y, z ∈ ({1, 0, u} \ {x}) by the fact that v ∼ = I (third line of the definition of I). Now consider the rule r ∈ π sat (D) with H(r) = sat(S) and a substitution θ s.t. θ r ∈ π sat (D) I . This means that θ r is of the form for t ∈ par D (s) and θ Ω(ϕ s ) ∈ I. Now it should be easy for the reader to see that from the fact that {asg(t, y t ), lt(y t , v t ) | t ∈ par D (s)} ⊆ I and v ∼ = I it is the case that w ∈ [v] 2 for the ADF interpretation w defined as w(t) = v t for every t ∈ par D (s). It is also simple to establish that θ Ω(ϕ s ) ∈ I and θ (V ϕ s = 1) ∈ I imply that w(ϕ s ) = 1. Hence, by the fourth line of the definition of I we have sat(s) ∈ I, i.e. I satsifies θ r. In the same manner, by the fifth line of the definition of I it follows that I satisfies any grounding θ r ∈ π sat (D) I for the rule r s.t. H(r) = inv(S). In conclusion, I satisfies π sat (D) I .
∈ π adm (D). By the fourth line of the definition of I, sat(s) But then by the fact that v ∈ adm(D) and v ∼ = I, asg(s, 0) ∈ I, i.e. r can not be satisfied by I. In the same manner also any ground instance in π adm (D) I of the constraint :-arg(S), asg(S, 1), inv(S).
can not be satisfied by I.
We have established that I satisfies π adm (D) I . We continue our proof of I ∈ AS(π adm (D)) by now showing that there is no I ⊂ I that satisfies π adm (D) I .
In effect, consider any other I that satisfies π adm (D) I . Note first of all that then I arg ⊇ I arg and I lt ⊇ I lt because both I and I satisfy π arg (D) I as well as π I lt . Hence also I asg ⊇ I asg because I satisfies π I guess (see the proof of I satisfies π adm (D) I for the structure of π I guess ) and I arg ⊇ I arg , i.e. B(r) ⊆ I for every r ∈ π I guess . But then, since I arg ⊇ I arg and I asg ⊇ I asg , and I satisfies all the comparison predicates with arithmetic functions that I does by definition, I satisfies all the rules in π sat (D) I that I does (see again the proof of I satisfies π adm (D) I for the form of such rules). Hence, also I sat ⊇ I sat and I inv ⊇ I inv . In conclusion, I ⊇ I.
Since I was general we derive that there is no I ⊂ I that satisfies π adm (D) I . Together with the fact that I satisfies π adm (D) I we have that I ∈ AS(π adm (D)).
We now turn to proving that for any I ∈ AS(π adm (D)) it holds that v ∈ adm(D) for v ∼ = I. Note first that for such an I, since I satisfies π arg (D) I = π arg (D) as well as for every s ∈ S there is a x ∈ {1, 0, u} such that asg(s, x) ∈ I. Also, asg(s, x) ∈ I whenever asg(s, y) ∈ I and asg(s, z) ∈ I for y, z ∈ ({1, 0, u} \ {x}). I.e. v s.t. v ∼ = I is well defined. Now assume that v ∈ adm(D). Then there are s ∈ S, w ∈ [v] 2 for which either i) v(s) = 1 and w(ϕ s ) = 0 or ii) v(s) = 0 and w(ϕ s ) = 1. Let us consider the case i). In that case consider a substitution θ for the rule r ∈ π sat (D) where lt . Now, by definition θ Ω(ϕ s ) ⊆ I and from w(ϕ s ) = 0 it is easy to see that it follows that also θ (V ϕ s = 0) ∈ I, i.e. θ r ∈ π sat (D) I and B(θ r) ⊆ I. This means that also inv(s) ∈ I. As a consequence we have that B(r ) ⊆ I for the constraint r :-arg(s), asg(s, 1), inv(s).
in π adm (D) I . This is a contradiction to I ∈ AS(π adm (D)). From the case ii) v(s) = 0 and w(ϕ s ) = 1 a contradiction can be derived in analogous manner. Hence, v ∈ adm(D) must be the case.
A possible output of an ASP solver (the current one is the simplified output of clingo version 4.5.4) given this instance looks as follows (only showing asg, sat, and inv predicates): The encoding π adm allows to enumerate the admissible interpretations of an ADF D from the answer sets of π adm (D) (as explained in the opening paragraphs of Section 3). Skeptical reasoning for the admissible semantics is trivial (as the interpretation mapping every statement to u is always admissible), but note that via credulous reasoning for ASP programs we directly obtain results for credulous reasoning w.r.t. the admissible semantics from π adm (D) (for any ADF D). The latter translation and thus the encoding π adm is adequate from the point of view of the complexity (see Table 2) as π adm (D) is a normal logic program for any ADF D. Also, given our recursive definition of the evaluation of the acceptance conditions within ASP rules, the arity of predicates in our encodings are bounded (in fact, the maximum arity of predicates is two).

Encoding for the complete semantics
For the ASP encoding of the complete semantics we only need to add two constraints to the encoding of the admissible semantics. These express a further condition that an interpretation v for an ADF D = (S, {ϕ S } s∈S ) has to fulfill to be complete, in addition to not having counter-models for being an admissible interpretation as expressed in Section 3.1. The condition in question is that for every s ∈ S: :-arg(S), asg(S, u), not sat(S).}.

Proposition 2
For every ADF D it holds that com(D) ∼ = AS(π com (D)).

Proof
(sketch) The proof extends that of Proposition 1. Only the additional constraints used in the encoding for the complete semantics (w.r.t. the encoding for the admissible semantics) need to be accounted for.
The encoding π com allows to enumerate the complete interpretations of an ADF D by applying the encoding on D (π com (D)) and considering AS(π com (D)). Since credulous acceptance for the complete semantics is equivalent to credulous acceptance for the admissible semantics, we obtain a complexity adequate means of computing credulous acceptance for the complete semantics via applying credulous (ASP) reasoning on π adm (D) (π adm being the encoding presented in Section 3.1). Applying credulous reasoning on π com (D) is nevertheless also an option 1 .

Saturation encoding for the preferred semantics
For the encoding of the preferred semantics we make use of the saturation technique (Eiter and Gottlob 1995); see (Charwat et al. 2015) for its use in computing the preferred extensions of Dung AFs. The saturation technique allows checking that a property holds for a set of guesses within a disjunctive ASP program, by generating a unique "saturated" guess that "verifies" the property for any such guess. Existence of a non-saturated guess hence implies that the property of interest does not hold for the guess in question.
In the encoding of the preferred semantics for an ADF D we extend π adm (D) by making use of the saturation technique to verify that all interpretations of D that are greater w.r.t. ≤ i than the interpretation determined by the assignments guessed in the program fragment π guess are either identical to the interpretation in question or not admissible. As a consequence, the relevant interpretation must be preferred according to the definition of this semantics for ADFs.
Note that the first two rules express that if an ADF interpretation v corresponding to the "first guess" (captured via the predicate asg) maps a statement to either 0 or 1 then so does a interpretation v corresponding to the "second guess" (captured via the predicate asg2). The last rule, on the other hand, indicates that if the first guess maps a statement to u then the second guess can map the statement to either of the truth values u, 0, or 1. Thus v ≥ i v is guaranteed. The fragment π sat2 (D) will allow us to check whether the second guess obtained from π guess2 is admissible: The only difference between the fragment π sat2 (D) and the fragment π sat (D) that we introduced in Section 3.1 is that we now evaluate acceptance conditions w.r.t. completions of the second guess given via the predicate asg2.
The following program fragment guarantees that the atom saturate is derived whenever the second guess (computed via π guess2 ) is either identical (first rule of π check (D)) to the first guess (computed via the module π guess ) or is not admissible (last two rules of π check (D)). We will say that in this case the second guess is not a counter-example to the first guess corresponding to a preferred interpretation of D. We here assume that the statements S of D are numbered, i.e. S = {s 1 , . . . , s k } for a k ≥ 1: saturate:-asg2(S, 1), inv2(S).
The module π saturate now assures that whenever the atom saturate is derived, first of all asg2(s, 0), asg2(s, 1), and asg2(s, u) are derived for every s ∈ S for which asg(s, u) has been derived. Also, sat2(s) and inv2(s) are derived for every s ∈ S: The effect of this fragment is that whenever all the "second guesses" (computed via π guess2 ) are not counter-examples to the first guess (computed via π guess ) corresponding to a preferred interpretation of D, then all the answer sets will be saturated on the predicates asg2, sat2, and inv2, i.e. the same ground instances of these predicates will be included in any answer set. Thus, all answer sets (corresponding to the ADF interpretation determined by the first guess) will be indistinguishable on the new predicates used for the encoding of the preferred interpretation; meaning: those not in π adm (D). On the other hand, were there to be a counter-example to the first guess corresponding to a preferred interpretation of D, then a non-saturated and hence smaller (w.r.t ⊆) answer set could be derived. We disallow the latter by adding to the program fragments π adm (D), π guess2 , π sat2 (D), π check (D), π saturate , a constraint filtering out precisely such answer sets. The latter being those for which the atom saturate is not derived. We thus arrive at the following encoding for the preferred semantics:

Proof
Let D = (S, {ϕ S } s∈S ) be an ADF and v ∈ prf(D). Let also be a set of ground atoms where I is defined as in the "only if" direction of the proof of Proposition 1 (hence, v ∼ = I ). Moreover, I is the set of ground atoms forming the "saturation" of the predicates asg2, sat2, inv2, saturate (asg2 is saturated only for s ∈ S s.t. v(s) = u) defined as Note first that since none of the predicates occurring in I \ I appear in π adm (D), we have that π adm (D) I = π adm (D) I . As thus also all of the atoms appearing in π adm (D) I that are in I are those which are in I, we have that I and I satisfy the bodies and heads of the same rules in π adm (D) I . By the proof of the "only if" direction of Proposition 1 (i.e. that I satisfies π adm (D) I = π adm (D) I ) it then follows that I satisfies π adm (D) I .
I also satisfies each of π sat2 (D) I = Gr(π sat2 (D)), π check (D) I = Gr(π check (D)) as the heads of all possible ground instances of the rules of each of the modules π sat2 (D) and π check (D) are contained in I ⊂ I . Moreover, I satisfies all groundings of the first two rules of π guess2 (that are in π I guess2 = Gr(π guess2 )) as both asg(s, x) ∈ I and asg2(s, x) ∈ I whenever v(s) = x for x ∈ {1, 0}. I also satisfies all groundings of the third rule of π guess2 as whenever asg(s, u) ∈ I this means that v(s) = u and then asg2(s, x) ∈ I ⊂ I for every x ∈ {1, 0, u}. For the same reason I also satisfies all possible groundings of the first three rules of π saturate (contained in π I saturate = Gr(π saturate )). Furthermore, I satisfies all possible groundings of the last two rules of π saturate since whenever arg(s) ∈ I this means that s ∈ S and then sat2(s) ∈ I ⊂ I as well as inv2(s) ∈ I ⊂ I . Finally, since saturate ∈ I ⊂ I the constraint :-not saturate.
is deleted from π prf (D) when forming the reduct π prf (D) I . We thus have that I satisfies all of the rules in π prf (D) I ; hence, I satisfies π prf (D) I .
Consider now that there is a I ⊂ I that satisfies π prf (D) I . Since I satisfies π adm (D) I = π adm (D) I , we have by the argument in the "only if" direction of the proof of Proposition 1 that I ⊆ I . Note that then asg(s, x) ∈ I for every s ∈ S s.t. v(s) = x for x ∈ {1, 0}. On the other hand, I satisfies the groundings of the first two rules in π guess2 (since π I guess2 = Gr(π guess2 )). It hence follows that also asg2(s, x) ∈ I for every s ∈ S s.t. v(s) = x for x ∈ {1, 0}. Moreover, since I satisfies the groundings of the last rule in π guess2 and {asg(s, u) | s ∈ S, v(s) = u} ⊂ I ⊂ I it must be the case that there is some x ∈ {u, 1, 0} s.t. asg2(s, x) ∈ I for every s ∈ S s.t. v(s) = u. We thus have that there is an ADF interpretation v ≥ i v s.t. there is an atom asg2(s, x) ∈ I whenever v (s) = x.
for every s ∈ S. This amounts to (since I satisfies π sat2 (D) I = Gr(π sat2 (D)); see proof of Proposition 1) there not being any s ∈ S and w ∈ [v ] 2 for which v (s) = 1 and w(s) = 0. In the same manner the fact that B(r) ⊂ I for the rule r saturate:-asg2(s, 0), sat2(s).
for every s ∈ S, means that there is no s ∈ S and w ∈ [v ] 2 for which v (s) = 0 and w(s) = 1. But then v ∈ adm(D) which, together with the fact that v < i v , is a contradiction to v ∈ prf(D).
On the other hand if saturate ∈ I , since I satisfies all possible groundings of the first three rules of π saturate (as π I saturate = Gr(π saturate )), it would be the case that whenever asg(s, u) ∈ I and hence v(s) = u (since I ⊂ I ) also asg2(s, x) ∈ I for every x ∈ {u, 0, 1}. Moreover, if saturate ∈ I , since I satisfies all possible groundings of the last two rules of π saturate , it would also follow that sat(s) ∈ I as well as inv(s) ∈ I for every s ∈ S. This means that if saturate ∈ I , then I ⊆ I . This is a contradiction to our assumption that I ⊂ I . In conclusion, there is no I ⊂ I that satisfies π prf (D) I . Therefore I ∈ AS(π prf (D)).
We turn now to proving that for any I ∈ AS(π prf (D)) it holds that v ∈ prf(D) for v ∼ = I. Note first of all that since I satisfies π adm (D) I by the proof of the "if" direction of Proposition 1 we obtain that v is well defined and, moreover, v ∈ adm(D).
Since v ∈ adm(D), v ∈ prf(D) would mean that there is a v ∈ adm(D) s.t. v > i v. Now, notice first of all that since I ∈ AS(π prf (D)), saturate ∈ I since otherwise the constraint :-not saturate.
would not be deleted from π prf (D) (as must be the case) when forming the reduct π prf (D) I and hence π prf (D) would have no answer set. We know from the proof of the "only if" direction of Proposition 3 that from saturate ∈ I it then follows that I ⊆ I where

Now let us define
for which by construction (and v > i v) I ⊂ I holds. Notice first of all that since all negative atoms of π prf (D) occur in π adm (D) ∪ {:-not saturate.} we have that π prf (D) I = π adm (D) I ∪ Gr(π guess2 ) ∪ Gr(π sat2 (D)) ∪ Gr(π check (D)) ∪ Gr(π saturate ). Now, since I and I are the same when considering the atoms occurring in π adm (D) I (meaning: ∪ p∈{arg,lt,asg,sat,inv} I p ⊂ I ) and I satisfies π adm (D) I so does I . Moreover, since v > i v by construction asg2(s, x) ∈ I whenever asg(s, x) ∈ I for x ∈ {1, 0} and there is a y ∈ {u, 1, 0} s.t. asg2(s, y) ∈ I whenever asg(s, u) ∈ I. Hence I also satisfies π I guess2 = Gr(π guess2 ). Using analogous arguments as in the "only if" direction of the proof of Proposition 1, from the fact that asg2(s, x) ∈ I iff v (s) = x (for s ∈ S and x ∈ {1, 0, u}) and the definition for when sat2(s) and inv2(s) are in I , it follows that v satisfies π I sat2 = Gr(π sat2 ). We have also seen in the proof of the "only if" direction of Proposition 3 that v = v and v ∈ adm(D) implies that I does not satisfy the body of any of the rules in π check (D) I = Gr(π check (D)). Finally, since saturate ∈ I it is also the case that I satisfies π I saturate = Gr(π saturate ). In conclusion, we have that I satisfies π prf (D) I and I ⊂ I which contradicts I ∈ AS(π prf (D))). Hence, there cannot be a v > i v s.t. v ∈ adm(D) and therefore v ∈ prf(D) must be the case.

Example 4
The encoding π prf (D) for the ADF D from Example 1 as implemented by our system YADF looks as follows: leq(u,0). leq(u,1). leq(0,0). leq(1,1). arg An output of an ASP solver given this instance looks as follows (only showing asg and saturate predicates): Answer: 1 asg(c,u) asg(b,0) asg(a,1) saturate Answer: 2 asg(c,1) asg(b,1) asg(a,1) saturate SATISFIABLE Note that π prf , in addition to providing a means of enumerating the preferred interpretations of any ADF, also gives us a complexity adequate means of deciding skeptical acceptance problems. The latter via skeptical reasoning of ASP disjunctive programs with predicates of bounded arity (see Table 2). Credulous reasoning for the preferred semantics is equivalent to credulous reasoning for the admissible semantics; applying credulous reasoning on the encoding given in Section 3.1 hence provides a means of computation at the right level of complexity for this reasoning task.

Encoding for the grounded semantics
Our encoding for the grounded semantics is based on the fact that (see (Strass and Wallner 2015)) v ∈ grd(D) for an interpretation v and an ADF D = (S, {φ s } s∈S ) iff v is the (unique) ≤ i -minimal interpretation satisfying • for each s ∈ S such that v(s) = 1 there exists an interpretation w ∈ [v] 2 for which w(φ s ) = 1, • for each s ∈ S such that v(s) = 0 there exists an interpretation w ∈ [v] 2 for which w(φ s ) = 0, and • for each s ∈ S such that v(s) = u there exist interpretations w 1 ∈ [v] 2 and w 2 ∈ [v] 2 such that w 1 (φ s ) = 1 and w 2 (φ s ) = 0.
We say that an interpretation v for the ADF D that satisfies exactly one of the above for a specific s ∈ S (e.g. v(s) = 1 and there exists an interpretation w ∈ [v] 2 for which w(φ s ) = 1), that it satisfies the properties for being a candidate for being the grounded interpretation w.r.t. s. The completion w, or alternatively the completions w 1 and w 2 , verify this fact for v and s. If v satisfies the properties w.r.t. every s ∈ S then v is a candidate for being the grounded interpretation of D. An interpretation v < i v that is also a candidate for being the grounded interpretation is a counter-model (alternatively, counter-example) to v being the right candidate (for being the grounded interpretation).
Our encoding for the grounded semantics essentially consists first of all, once more in the guessing part π guess where we guess assignments of truth values to the statements of the ADF of interest D. This corresponds to guessing an interpretation v for D. Constraints in our encoding filter out guessed interpretations which either are not candidates to being the grounded interpretation or which have counter-models to being the right candidate. These constraints rely on the rules in π sat (D) defined in Section 3.1 and rules defining when an interpretation has a countermodel to being the right candidate respectively.
We start with a few facts needed for our encoding. First of all, we use facts analogous to those in π lt defined in Section 3.1 for encoding the truth values a possible counter-model to the interpretation guessed via π guess (being the right candidate for the grounded interpretation) can assign to the statements. Here we also need an additional argument (the first argument of the predicate lne) allowing us to check whether the interpretation in question is distinct from the one determined by the predicate asg: π lne :={lne(1, u, 1). lne(1, u, 0).} ∪ {lne(0, 1, 1). lne(0, 0, 0). lne(0, u, u).}.
Given a candidate for the grounded interpretation v determined by the atoms asg, for instance the two first facts in π lne express (using the last two arguments of the predicate lne) that if for a statement s, v(s) = x with x ∈ {1, 0}, then a counter-model v to v being the right candidate (for the grounded interpretation) can map s to the truth value u. Moreover, the first argument of the alluded to facts indicates that in this case v (s) = v(s). Secondly, we need a set of facts for checking whether an interpretation satisfies the properties required for candidates to being the grounded interpretation mentioned at the beginning of this section. Specifically, given a statement s of the ADF D, prop(z 1 , z 2 , z 3 ) can be used to check whether the correct relationship between z 1 = v(s), z 2 = w 1 (ϕ s ), and z 3 = w 2 (ϕ s ) holds for an interpretation v for D, and w 1 , w 2 ∈ [v] 2 (e.g. that if v(s) = u then there must be w 1 ∈ [v] 2 , w 2 ∈ [v] 2 s.t. w 1 (ϕ s ) = 1 and w 2 (ϕ s ) = 0). In particular, note that w 1 = w 2 is possible and hence prop(x, y, z) can also be used to check the properties for when v(s) = x and x ∈ {1, 0} (first two facts in π prop ): π prop :={prop(1, 1, 1). prop(0, 0, 0). prop(u, 0, 1).}.
The following module consists of constraints checking whether the interpretation corresponding to the assignments guessed via π guess is a candidate (hence the use of the identifier "ca") for being the grounded interpretation: The module π ca (D) assumes, as we stated earlier, that the rules in π sat (D) (and thus the facts in π lt ) defined in Section 3.1 are also part of the encoding for the grounded semantics. For instance the first constraint then checks that there be no s ∈ S for which it holds that v(s) = 1 but there is no w ∈ [v] 2 for which w(ϕ s ) = 1 for the interpretation v guessed via the atoms constructed with the predicate asg. Now, note that, since, as we explained before, the grounded interpretation is the minimal (w.r.t. ≤ i ) of the interpretations that are candidates for being the grounded interpretation, this interpretation can be obtained via choosing the minimal interpretation w.r.t. ≤ i from all interpretations that correspond to some answer set of the encoding π ca-grd (D) := π arg (D) ∪ π lt ∪ π guess ∪ π sat (D) ∪ π ca (D); i.e. what essentially boils down to a skeptical acceptance problem for π ca-grd (D).
In order to obtain an encoding not requiring (in the worst case) processing of all answer sets we need a rule defining when an interpretation is a counter-model to the interpretation determined via the predicate asg being the right candidate. For this we will need to make repeated use of the function Ω defined in Section 3.1 within a single rule. We therefore first of all make the symbol ranging over the ASP-variables representing subformulas of a propositional formula φ within Ω(φ ) an explicit parameter of the function. This is straightforward, but for completeness we give the full definition of our parametrised version of the function Ω. Here φ is once more a propositional formula built from propositional variables in a set P, while now V is an arbitrary (meta-) symbol used to refer to the variables introduced by the function: Again, V φ , V φ 1 V φ 2 and V ψ are variables representing the subformulas of φ . From now on, whenever we introduce sets Ω V 1 (φ 1 ) and Ω V 2 (φ 2 ) for possibly identical formulas φ 1 and φ 2 but distinct symbols V 1 and V 2 , we implicitly also assume that then Ω V 1 (φ 1 ) ∩ Ω V 2 (φ 2 ) = / 0.
Our rule for defining counter-models to an interpretation being the right candidate for the grounded interpretation requires first of all a part for "generating" an interpretation less informative (w.r.t ≤ i ) and distinct from the interpretation determined by π guess ; i.e. a candidate countermodel. For this we use the atoms Here, given an interpretation v determined by the atoms asg(s, X s ) (s ∈ S), the atoms lne(E s ,Y s , X s ) are used to generate an assignment of truth values to the statements (via argument Y s ) corresponding to an interpretation v ≤ i v.
Then Ω E (∨ s∈S s) ∪ {E ∨ s∈S s = 1} are used (via the arguments E s of the atoms lne(E s ,Y s , X s )) to check that there is a s ∈ S for which v (s) = v(s) and hence in fact v < i v. Thus, if v is a candidate for the grounded interpretation, then v is a candidate countermodel for v being the grounded interpretation.
We now introduce the following set of atoms to check whether the candidate counter-model is indeed a counter-model to the interpretation determined by asg being the grounded interpretation. We need to check the properties candidates for being the grounded interpretation need to satisfy for each of the statements s of the ADF of interest D; therefore the need for having sets of atoms κ s,D defined for every statement s: Note here the use of the predicate lt (defined via the module π lt from Section 3.1) for generating assignments to statements corresponding to completions. The first two lines of the definition of κ s,D are used for generating completions w 1 , w 2 ∈ [v ] 2 of an interpretation v and the outcome of the evaluation of ϕ s by the completions. Then the third line is used to check that w 1 , w 2 verify that v is a candidate for being the grounded interpretation (and hence a counter-model for a v > i v being the right candidate for the grounded interpretation).
Putting all the above together we have quite a large rule defining when a candidate countermodel is indeed a counter-model to the interpretation determined by π guess being the right candidate for the grounded interpretation: The following is then an encoding allowing to compute the grounded interpretation for the ADF D in one go: π grd (D) := π arg (D) ∪ π lt ∪ π lne ∪ π prop ∪ π guess ∪ π sat (D) ∪ π ca (D) ∪ π cm (D) ∪ {:-cm.}.
Note, in particular, the constraint {:-cm.} disallowing interpretations having a counter-model to them being the right candidate for the grounded interpretation.

Proposition 4
For every ADF D it holds that grd(D) ∼ = AS(π grd (D)), Proof (sketch) The proof is similar to that of Proposition 5. Indeed note that π stb (D) (defined in Section 3.5) essentially builds on π grd (D), the main difference being the slightly more complex versions of π lt , π lne , π prop , π cm (D) and the use of π model (D) (see Section 3.5) rather than π ca (D) (and π sat (D)).
We do not obtain complexity sensitive means of deciding credulous and skeptical reasoning w.r.t. the grounded semantics via the encoding π grd . Nevertheless, the encoding offers an alternative strategy to deriving the grounded interpretation of an ADF to that of the static encodings at the basis of the DIAMOND family of systems mentioned in the introduction to this work. Also, the encoding forms the basis of the complexity adequate (w.r.t. the reasoning problems) encoding for the stable semantics we present in Section 3.5.

Encoding for the stable semantics
As already indicated and is to be expected given the definition of this semantics, our encoding for the stable semantics is based on the encoding for the grounded semantics. Nevertheless, some modifications are required. First of all we need to guess assignments to statements of an ADF D corresponding to a two valued rather than a three valued interpretation v for D. Secondly, we need to check that v is a model of D. Third, we need to ensure that v assigns the truth value 1 to the same statements as the grounded interpretation of the reduct of D v (i.e. v E v = grd(D v )) rather than D simpliciter.
To start we slightly modify some facts used in previous encodings. Our encoding once more follows the guess & check methodology and there will therefore be a part used to guess a candidate v for being the stable interpretation of our ADF of interest D. We will then need a modified version of π lt (defined in Section 3.1) to set the right truth values for completions of a candidate counter-model v to v (actually v E v ) being the right candidate for the grounded interpretation (as explained in Section 3.4) of the reduct D v : π lt :={lt2(1, u, 0). lt2(1, u, 1). lt2(1, 0, 0). lt2(1, 1, 1).} ∪ {lt2(0, u, 0). lt2(0, 0, 0). lt2(0, 1, 0).}.
The first four facts in π lt are as to those in π lt . The only difference is in the first argument which we use to encode the assignment of a truth value to a statement s by a guessed candidate for the grounded interpretation v of the reduct D v . The other two values express possible values a completion w of a a candidate counter-model v to v (being the right candidate for the grounded interpretation of D v ) can assign to the statement s. For instance, lt2(1, u, 0) expresses that if v(s) = 1 and v (s) = u then one of the two possible assignments of a truth value to s by w ∈ [v ] 2 is w(s) = 0. The three last facts in π lt now indicate possible assignments of truth values to a statement s by a w ∈ [v ] 2 when v(s) = 0. In order to simulate the evaluation of the acceptance conditions of the reduct D v by the completions of v in other parts of our encoding we enforce that in this case w(s) = 0 whatever the value of v (s). This amounts to replacing each statement s for which v(s) = 0 within an acceptance condition ϕ s in which the statement s occurs by ⊥ as is required by the definition of the reduct.
The module π lne defined in Section 3.4 also needs to be modified (by one fact) to account for the fact that a counter-model v to an interpretation v being the right candidate for satisfying Gerhard Brewka et. al. v E v = grd(D v ) must be distinct from v on the statements assigned the truth value 1 (i.e. there must be at least one statement s to which v assigns the truth value 1 and v the truth value u): π lne :={lne(1, u, 1). lne(0, u, 0).} ∪ {lne(0, 1, 1). lne(0, 0, 0). lne(0, u, u).}.
The difference of π lne w.r.t π lne is thus in the second fact "lne(0, u, 0)." where the first argument in the corresponding fact in π lne is 1 rather than 0.
Here for an ADF of interest (in our encoding, the reduct D v of the interpretation v guessed to be stable) we list all possible combinations of truth values of v(s), w 1 (ϕ s ), w 2 (ϕ s ) for w 1 , w 2 ∈ [v] 2 (three last arguments in the facts) and indicate (first argument in the facts) whether the combination in question makes w 1 , w 2 witnesses of v being a candidate for the grounded interpretation w.r.t. the statement s (as explained in Section 3.4). For instance prop2(1, 0, 0, 0) indicates that w 1 (φ s ) = w 2 (φ s ) = 0 makes w 1 , w 2 witnesses of v being a candidate (w.r.t. s) when v(s) = 0.
As already indicated, also our encoding for the stable semantics builds on a module guessing possible assignments to the statements of the ADF D. We only need to slightly modify π guess as defined in Section 3.1 to obtain a conjecture for the stable interpretation corresponding to a two valued rather than three valued interpretation for D: π guess := {asg(S, 0):-not asg(S, 1), arg(S). asg(S, 1):-not asg(S, 0), arg(S).}.
In order to check that the guessed interpretation is a model of D we again need to evaluate the acceptance conditions of D but this time by the guessed interpretation. For this we make use of the following sets of atoms per statement s of D: Here, we again make use of the function Ω defined in Section 3.1 but this time to evaluate the acceptance condition ϕ s by the interpretation guessed to be stable (and thus a model) of D via π guess . The following are then constraints, one per statement, filtering out guesses that are not models of D: More to the point, the constraints filter out any guessed interpretation v (via π guess ), for which v(s) = v(φ s ) for some statement s. Now, note that for any v ∈ mod(D), v E v is a candidate to being the grounded interpretation of the reduct D v . The reason is first of all that In effect, the latter is the case by virtue of v ∈ mod(D) and hence v(ϕ s ) = v E v (ϕ s ) = x whenever v(s) = x. Also, there are no statements for which v E v (s) = u. The consequence for our encoding for the stable semantics is that π model (D) suffices for checking whether our guessed interpretation, when projected on the statements to which it assigns the truth value 1, is a candidate for being the grounded interpretation of D v .
All that remains for our encoding of the stable semantics is therefore, as we have for the encoding of the grounded semantics, a constraint filtering out guessed interpretations which have counter-models to being the right candidate for being the grounded interpretation of D v . For this we introduce a slightly modified version of π cm (D) (defined in Section 3.4) accounting for the fact that we need to check for counter-models to v E v being the right candidate for the reduct D v rather than v and D. This means that completions of potential counter-models need to set any statement set to the truth value 0 by v also to 0. To encode this we use the predicate lt2 rather than lt in our modified version κ s,D of the set of atoms κ s,D (from Section 3.4). Also, we need to check the properties that candidates of the grounded interpretation need to satisfy only for statements s for which v(s) = 1. To encode this we make use of the predicate prop2 rather than prop and add a corresponding check using ASP built in boolean arithmetic functions: Our modified module π cm (D) of π cm (D) is then as follows: Note that we here make use of the set of atoms λ D as defined in Section 3.4, yet relying on the definition of the predicate lne as given by the module π lne rather than π lne . Putting everything together the encoding for the stable semantics has the following form:

Proof
Let ADF be an ADF and v ∈ stb(D). Let also be a set of ground atoms (such that v ∼ = I). (We slightly abuse the notation here by using e.g. π arg (D) to refer to the set of atoms rather than the facts in the module.) We prove now that I ∈ AS(π stb (D)).
We start by proving that I satisfies π stb (D) I . Note first that I satisfies each of π arg (D) I = π arg (D), π I lt = π lt , π I lne = π lne , π I prop = π prop since all of the facts in each of these modules are in I. I also satisfies π I guess = {asg(s, x):-arg(s). | s ∈ S, asg(s, y) ∈ I, x ∈ {1, 0}, y ∈ ({1, 0} {x})} by the fact that v ∼ = I. Assume now that I satisfies the body of some constraint in π model (D) I , i.e. there is a s ∈ S and a substitution θ s.t. asg(s, θ (V s )) ∈ I, asg(t, θ (V t )) ∈ I for each t ∈ par D (s), θ (Ω(ϕ s )) ∈ I, and θ (V s = V ϕ s ) ∈ I. This translates to v(s) = v(ϕ s ) which means v ∈ mod(D) and contradicts v ∈ stb(D). Therefore I does not satisfy any of the constraints in π model (D) I .
Consider on the other hand that I satisfies the body of some rule in π cm (D) I . This means that there is a substitution θ such that first of all asg(s, θ (X s )) ∈ I as well as lne(θ (E s ), θ (Y s ), θ (X s )) ∈ I for every s ∈ S. Also θ (Ω E (∨ s∈S s)) ∈ I and θ (E ∨ s∈S s = 1) ∈ I. All of this together means that v (s) < i v(s) for the interpretation v defined as v (s) := θ (Y s ). Moreover, since I satisfies π lt , there is an s ∈ S s.t. v(s) = 1 and v (s) = u. This means that also Secondly, for every s ∈ S we have that lt2(θ (X t ), θ (Y t ), θ (V (t,s),1 )) ∈ I and it is also the case that lt2(θ (X t ), θ (Y t ), θ (V (t,s),2 )) ∈ I for every t ∈ par D (s). Consider the interpretations w i for i ∈ {1, 2} defined as w i (t) = θ (V (t,s),i ) for every t ∈ par D (s).
In other words, whenever s ∈ E v (remember: E v = / 0) there are completions that verify that v E v satisfies the properties for being a candidate for the grounded interpretation of D v w.r.t. s. This means that v E v is a counter-model to v E v being the grounded interpretation of D v . This is a contradiction to v ∈ stb(D). Therefore, I does not satisfy the body of any rule in π cm (D) I and, hence, satisfies π cm (D) I . Finally, since cm ∈ I, I does not satisfy the body of the constraint {:-cm.} ∈ π stb (D) I . In conclusion, I satisfies π stb (D) I . Now consider any other I that satisfies π stb (D) I . Clearly, since I satisfies all of the facts in π stb (D) I , we have that π arg (D) ∪ π lt ∪ π lne ∪ π prop ⊆ I . But also because of the form of π I guess (see above) and the fact that I satisfies π arg (D) I it must be the case that {asg(s, x) | s ∈ S, v(s) = x} ⊂ I . This means that in addition to I satisfying π stb (D) I there is also no I ⊂ I that satisfies π stb (D) I ; i.e. we have that I ∈ AS(π stb (D)).
We now turn to proving that for any I ∈ AS(π stb (D)) it holds that v ∈ stb(D) for v ∼ = I. Note first that for any such I, since I satisfies π arg (D) I = π arg (D) and π I guess , v s.t. v ∼ = I is well defined. Now assume that v ∈ stb(D).
In the first case i) there must be a s ∈ S s.t. v(s) = v(ϕ s ). Consider hence the substitution θ defined as θ (V s ) = v(s) and θ (V t ) = v(t) for t ∈ par D (s). This substitution is s.t. θ (B(r)) ⊆ I for the constraint in π model (D) corresponding to s. This would mean that I does not satisfy π stb (D) I which is a contradiction. Therefore v ∈ mod(D) which also means that v E v is a candidate for the grounded interpretation of D v (as we argued in detail while explaining our encoding π stb (D)).
Consider now the case ii).
Since v E v is a candidate for the grounded interpretation of We thus have that θ (Ω E (∨ s∈S s)) ∈ I and E ∨ s∈S s = 1 ∈ I. Hence, θ (λ D ) ∈ I. Now, since v E v is a counter-model to v E v being the right candidate for the grounded interpretation of D v we have that for every s ∈ E v there are completions w s,1 and w s,2 of v E v that are witnesses for v E v satisfying the properties candidates for the grounded interpretation neeed to satisfy w.r.t. s. Hence, we continue defining the substitution θ s.t. θ (V (t,s),i ) = w s,i (t) for every s ∈ E v and t ∈ par D (s) ∩ E v . On the other hand θ (V (t,s) For s ∈ E v we on the other hand define θ (V (t,s),i ) = w(t) (i ∈ {1, 2}), t ∈ par D (s) ∩ E v for some arbitrary w ∈ [v ] 2 . On the other hand θ (V (t,s),i ) = 0 for t ∈ par D (s) \ E v . Also, θ (P s ) = 1 whenever v (s) = w(ϕ s ) (ϕ s = φ s [b/⊥ : v(b) = 0]) and θ (P s ) = 0 otherwise. Then we have that θ (Ω V (t,s),i (ϕ s )) ∈ I for s ∈ S, t ∈ par D (s), (i ∈ {1, 2}). Also, θ (CX s = 1 − X s ) ∈ I, θ (O s = P s ?CX s ) ∈ I, and O s = 1 ∈ I for every s ∈ S (θ (P s ) = 1 for s ∈ E v , while θ (CX s ) = 1 for s ∈ E v ). I.e. θ (κ s,D ) ∈ I for every s ∈ S. Hence, since also θ (λ D ) ∈ I, we have that the body of a rule in π cm (D) I is satisfied by I and, therefore, cm ∈ I. This means that the constraint :-cm. ∈ π stb (D) I is satisfied by I which contradicts I ∈ AS(π stb (D)). Therefore, the case ii) is also not possible and v ∈ stb(D) must be the case.

Grappa encodings
We now illustrate how to extend the methodology used in our construction of dynamic encodings for ADFs to GRAPPA. For this purpose we give ASP encodings for the admissible, complete, and preferred semantics. Reflecting the relationship between ADFs and GRAPPA, structurally the encodings are very similar to those for ADFs; the main difference being in the encoding of the evaluation of the acceptance patterns.
Also for our encodings for GRAPPA we make use of the correspondence ∼ = between 3-valued interpretations (now for GRAPPA instances) and sets of ground atoms (interpretations of ASP programs) defined via ASP atoms asg(s, x) for statements s and x ∈ {1, 0, u}. Hence, we now strive for encodings π σ for σ ∈ {adm, com, prf} s.t. for every GRAPPA instance G we get σ (G) ∼ = AS(π σ (G)) (see Definition 1 for the formal meaning of the latter overloaded use of ∼ =). We will reuse several of the ASP fragments we defined for ADFs. Formally this amounts to extending the corresponding encoding functions to also admit GRAPPA instances as arguments.
As already hinted at, the main difference between the encodings for GRAPPA and ADFs is in the definition of the set of atoms Ω(φ ) (first defined for ADFs in Section 3.1) corresponding to the semantic evaluation of the acceptance conditions (now patterns) associated to the statements. The recursive function representing the evaluation of patterns needs a statement s as an additional parameter and for the encoding of the basic patterns is defined as Ω s (φ ) := The difference between Ω s and Ω (note the missing subscript s) as defined in Section 3 is in the last line where P s (τ) ∪ {V φ = #sum{1 : V τR a}} encodes the evaluation of a basic pattern φ = τRa. Here we make use of the ASP aggregate #sum as well as the simple functionR := <= (resp. >=, !=) if R = ≤ (resp. ≥, =) andR = R otherwise, relating GRAPPA and ASP syntax for relational operators.
The function P s (τ) on the other hand gives us a set of atoms corresponding to the evaluation of a sum τ of terms: The definition of P s in turn makes use of the function T s (t) that returns an atom representing a term t. Here let s ∈ S be fixed and par(s) = {r 1 , . . . , r q }, l r = λ (r, s) for r ∈ par(s), and par(s, l) = {r ∈ par(s) | l r = l}. In order to define atoms corresponding to the evaluation of terms depending on the active labels (those without subscript t) we use the ASP aggregates #sum, #min, #max, and #count, as well as variables Z r corresponding to completions of the guessed assignment of statements r ∈ S. Atoms corresponding to terms whose evaluation is independent of the active labels, on the other hand, can be constructed based on the instance G only. We define T s (t) as par(s, l) if t = #l and par(s, l) = / 0 if t = #l and par(s, l) = / 0 or t = sum,t = count and par(s) = / 0.
For instance the first atom V t = #sum{Z r i 1 , r i 1 ; . . . ;Z r iw , r i w } corresponds to the computation of val s o (#l) when par(s, l) = {r i 1 , . . . , r i w } = / 0. Here o = m z s is the multi-set of active labels of s under z and the assignments of truth values to statements of the ADF interpretation z is captured via the variables Z r i j (1 ≤ j ≤ z). An assumption of the encoding is that such variables Z r i j take only values 1 or 0, thus corresponding to two valued interpretations (e.g. completions). This, as in the encodings for ADFs, is taken care of in the rules in which the atoms Ω s occur (see the re-definition of the modules π sat and π sat2 defined in Section 3 for GRAPPA instances below).
Here, the difference to the encoding for ADF semantics is the use of the program fragments where we make use of the shortcuts ω s and ω2 s . In their definitions we in turn use the function Ω s (φ ) returning the atoms for evaluating a GRAPPA acceptance function: ω2 s :={asg2(r,Y r ), lt(Y r , Z r ) | r ∈ par(s)} ∪ Ω s (α(s)).

System & overview of experiments
We have implemented a system which, given an ADF, generates the encodings for the ADF presented in this work. The system, YADF ("Y" for "dynamic"), is publicly available (see the link provided in the introduction) and currently (version 0.1.1) supports the admissible, complete, preferred, and stable semantics. It is implemented in Scala and can, therefore, be run as a Java executable. The input format for YADF is the input format that has become the standard for ADF systems. Each statement x of the input ADF is encoded via the string s(x) (alternatively, for legacy reasons, also statement(x) can be used). The acceptance condition F of x is specified in prefix notation via ac(x, F). For example the acceptance conditions of the ADF from Example 1 are encoded as follows: s(a). s(b). s(c). ac(a,or(neg(b),b)). ac (b,b). ac (c,imp(c,b)).
Note the period at the end of each line. Here or, imp, neg stand for ∨, →, ¬ respectively. On the other hand and, c(v), and c( f ) can be used for ∧, , and ⊥.
A typical call of YADF (using a UNIX command line) looks as follows: java -jar yadf_0.1.1.jar -adm -cred a filename | \ ./path/to/lpopt | ./path/to/clingo Here we ask YADF for the encoding of credulous reasoning w.r.t. the admissible semantics for the ADF specified in the file specified via f ilename and the statement a. As hinted at in the introduction to this work, using the rule decomposition tool lpopt 2 (Bichler et al. 2016a) is recommended for larger ADF instances. We have tested YADF using the ASP solver clingo (Gebser et al. 2018 A generator for encodings for GRAPPA following the methodology outlined in this work are also available as part of the system GrappaVis 3 . The focus of this system is on providing graphical means of specifying and evaluating GRAPPA instances and it includes means of generating static as well as dynamic encodings to ASP. We reported on an empirical evaluation of the performance of YADF w.r.t. the main alternative ADF systems available at that time in . The other ADF systems we considered then are the static ASP-based system DIAMOND (Ellmauthaler and Strass 2014) (version 0.9) as well as the QBF-based system QADF (Diller et al. 2014) (version 0.3.2). In these refer to the studies on the (possibly) non-acyclic ADF instances since these can be compared to the study of  which does not consider acyclic ADFs (nevertheless, some comments on the performance of especially YADF on the acyclic instances follow). In the summary, when mentioning results for a particular solver, we use the best of the results for that solver obtained in the different studies. Also, as a reminder to the reader, in this discussion when we refer to the solvers k++ADF, goDIAMOND, YADF, and QADF, except if stated otherwise, these are versions 2018-07-06, 0.6.6, 0.1.0, and 0.3.2 respectively. In particular, we again note that YADF version 0.1.0 is identical to the newer version detailed in this work (0.1.1) for the encodings considered in the experiments we allude to 10 .
• For credulous reasoning w.r.t. the admissible semantics each of k++ADF (when using the link information sensitive variant ADM-K-BIP, rather than ADM-2), goDIAMOND, and YADF (making use of lpopt version 2.0 as in the experiments from Diller et al. 2018)), have rather acceptable performance on the "Traffic" and "Planning" data-sets. (The same holds for DIAMOND version 0.9 on a small set of ADFs generated from metro-networks Keshavarzi Zafarghandi 2017).) The order in which we mention the solvers reflects the improvement in performance, with k++ADF being the clear "winner". The system QADF (even in the more advantageous configuration with bloqqer version 035 and DepQBF version 4.0 from Diller et al. 2018)) on the other hand already has quite a few time-outs on the "Traffic" and "Planning" instances. We remind the reader that the "Traffic" and "Planning" data-sets include ADFs with 10 to 300 statements resulting from the underlying graphs obtained from representing transportation-networks as AFs  and encoding planning problems into AFs (Cerutti et al. 2017) respectively.
-Thus k++ADF (in the link-information-sensitive variant ADM-K-BIP) had 0 timeouts (1800 seconds) and 0.05 seconds mean running time, goDIAMOND 0 time-outs and 6.42 seconds mean running time in the experiments reported on in  on the "Traffic" data-set. YADF had 2 time-outs (600 seconds) and 5.68 seconds mean running time (disregarding time-outs) in the experiments reported on in . The system k++ADF (implementing ADM-K-BIP) had 0 time-outs and 0.14 seconds mean running time, goDIAMOND 0 time-outs and 6.72 seconds mean running time in the experiments reported on in  on the "Planning" data-set. YADF had 0 time-outs and 13.20 seconds mean running time in the experiments reported on in . QADF had 25 time-outs and 2.15 seconds mean running time on the "Traffic" instances and 59 time-outs and 14.63 seconds mean running time on the "Planning" instances .
• For credulous reasoning w.r.t. the admissible semantics, but now on the "ABA" data-set; here all ADF systems have some time-outs, yet again the results for k++ADF are the most promising. We remind the reader that the "ABA" data set consists in 100 very dense To conclude, while our experiments from ) (on the instances obtained via the grid-based generator first used in (Ellmauthaler 2012) and ADFs constructed from a limited set of traffic networks also used in subsequent experiments) suggested YADF to be the better performing of the then considered systems (including DIAMOND version 0.9 and QADF 0.3.2), this picture has changed with subsequent experiments Linsbichler et al. 2018) involving the new systems goDIAMOND and k++ADF as well as more (and larger) data-sets. In particular, the clearly overall best performing approach for ADF systems seems to be, at current moment, the incremental SAT-based approach implemented in the system k++ADF (despite the fact that even this system still has quite a few time-outs for the preferred semantics on the ABA data-set). But even just considering ASP-based systems, while competitive for the admissible semantics, YADF is clearly behind in performance w.r.t. goDIAMOND for the preferred semantics on the "Traffic" and "Planning" data-sets.
Some reason for nevertheless sticking to the dynamic ASP based approach presented in this work (vs. static encodings) is provided by the results on the performance of YADF on the ABA data-set (in the configurations from ). Here the constraint built into goDIAMOND of not supporting ADFs with statements having more than 31 parents is reflected in the constant number of time-outs (52; and similar mean running times: ca. 21 seconds for admissible, 27 seconds for preferred) on all reasoning tasks (admissible and preferred) and for acyclic as well as non-acyclic instances (the latter in the experiments from ). Indeed, the constraint built in to goDIAMOND of not supporting ADFs with statements having more than 31 parents is due to the fact that this system (as previous versions of DIAMOND) needs to convert acceptance conditions of ADFs into a boolean function representation (with a potential exponential explosion), which our dynamic encoding strategy allows to circumvent. Thus, while YADF still has many time-outs (in fact, a few more than goDIAMOND) there is some (slight) improvement on the acyclic instances: 54 time-outs with 7.38 seconds mean running time vs. 56 time-outs with 31.39 seconds mean running time for the admissible semantics and 54 time-outs with 16.77 seconds mean running time vs. 57 time-outs with 39.46 seconds mean running time for the preferred semantics. These results suggest room for improvement as well as, in accordance with the theoretical considerations motivating our dynamic ASP-based approach, a potential niche for the use of (a further optimised) YADF vs. e.g. goDIAMOND.

Discussion
In this work, we developed novel ASP encodings for advanced reasoning problems in argumentation that reach up to the third level of the polynomial hierarchy. Compared to previous work, we rely on translations that make a single call to an ASP-solver sufficient. The key idea is to reduce one dimension of complexity to "long" rule bodies, exploiting the fact that checking whether such a rule fires is already NP-complete (as witnessed by the respective complexity of conjunctive queries (Chandra and Merlin 1977)); see also (Bichler et al. 2016b) who advocated this idea as a programming technique in the world of ASP.
We implemented our approach for ADF and GRAPPA. Our experiments show the potential of our approach. Still, the number of statements we can handle is somewhat limited. Our encodings thus might also be interesting benchmarks for ASP competitions. Nontheless, there are certain aspects which have to be considered in future versions of our system. In fact, a crucial aspect for the programming technique due to (Bichler et al. 2016b) is the possible decomposition of long rules, since grounders have severe problem with such rules. As reported in a recent paper (Bichler et al. 2018) that also employs this technique, the actual design of long rules can strongly influence the runtime. We shall thus analyse our encodings in the light of the findings in (Bichler et al. 2018) in order to allow for better decomposition whenever possible.
Beyond boosting performance of our system, future work is to apply our approach to alternative ADF semantics (Polberg 2014) as well as more recent generalizations of ADFs and GRAPPA such as weighted ADFs  and multi-valued GRAPPA (Brewka et al. 2019); for dealing with possibly infinitly many values in this context, recent advances in ASP (Janhunen et al. 2017) might prove useful. Also the application of other recent ASP techniques (e.g. (Bogaerts et al. 2016;Redl 2017)) that allow for circumventing the problem of an exponential blow-up when problems beyond the second level of the polynomial are treated is of interest.