A Paraconsistent ASP-like Language with Tractable Model Generation

by   Andrzej Szałas, et al.

Answer Set Programming (ASP) is nowadays a dominant rule-based knowledge representation tool. Though existing ASP variants enjoy efficient implementations, generating an answer set remains intractable. The goal of this research is to define a new -like rule language, 4SP, with tractable model generation. The language combines ideas of ASP and a paraconsistent rule language 4QL. Though 4SP shares the syntax of and for each program all its answer sets are among 4SP models, the new language differs from ASP in its logical foundations, the intended methodology of its use and complexity of computing models. As we show in the paper, 4QL can be seen as a paraconsistent counterpart of ASP programs stratified with respect to default negation. Although model generation of well-supported models for 4QL programs is tractable, dropping stratification makes both 4QL and ASP intractable. To retain tractability while allowing non-stratified programs, in 4SP we introduce trial expressions interlacing programs with hypotheses as to the truth values of default negations. This allows us to develop a model generation algorithm with deterministic polynomial time complexity. We also show relationships among 4SP, ASP and 4QL.


page 1

page 2

page 3

page 4


Possibilistic Answer Set Programming Revisited

Possibilistic answer set programming (PASP) extends answer set programmi...

Vicious Circle Principle and Logic Programs with Aggregates

The paper presents a knowledge representation language Alog which extend...

Translating LPOD and CR-Prolog2 into Standard Answer Set Programs

Logic Programs with Ordered Disjunction (LPOD) is an extension of standa...

Stepwise Debugging of Answer-Set Programs

We introduce a stepping methodology for answer-set programming (ASP) tha...

Almost Sure Productivity

We define Almost Sure Productivity (ASP), a probabilistic generalization...

Computing H-Partitions in ASP and Datalog

A H-partition of a finite undirected simple graph G is a labeling of G's...

Towards Dynamic Consistency Checking in Goal-directed Predicate Answer Set Programming

Goal-directed evaluation of Answer Set Programs is gaining traction than...

1 Introduction and Motivations

Answer Set Programming (ASP) [5, 6, 16, 32, 33, 34, 37, 40, 41, 55]

is a knowledge representation framework based on the logic programming and nonmonotonic reasoning paradigms that uses an answer set/stable model semantics for logic programs. Generating answer sets is intractable which is both an ASP strength and a weakness. The strength arises from concise representations of NP-complete problems and the use of efficient ASP solvers to conquer these problems. The weakness stems from potential lack of scalability: one can hardly expect efficient performance over large datasets: even generating the first answer set may require time longer than could be allocated.

Another research line is represented by 4ql [42, 43, 44, 56], a four-valued paraconsistent rule language with tractable model generation and query answering. The language allows for disambiguating inconsistencies and reacting on ignorance in a nonmonotonic manner. For that purpose inspection operators for accessing truth values of literals have been introduced. However, tractability comes at a price of stratification over inspection operators. While the ASP semantics is basically three-valued with truth values (true), (false) and (unknown) [21, 49], 4ql uses the fourth truth value, , representing inconsistency.

Paraconsistent and paracoherent versions of logic programs and ASP have been investigated in the literature [4, 15, 19, 25, 29, 30]. However, to our best knowledge, no version of ASP enjoys tractable model generation. Many approaches use the logic  [7] as the base formalism. However, may be problematic when used in the contexts we consider. Therefore, in 4ql and 4sp we use the logic not sharing less intuitive features of .111For logics used in this paper see Table 2. The superscript ‘’ indicates that original logics are extended by introducing additional connectives.

In order to motivate the use of a paraconsistent approach and the choice of rather than , consider sample rules of an imaginary rescue scenario listed as Program 1, where resc abbreviates “rescuer” and one is primarily interested in checking who is going to be saved by the rescuer, as specified in Lines 22 of the program.

Program 1 Sample rules of the rescue scenario.

Program 1, derived from the barber paradox, has no consistent models. Indeed, the least set of its conclusions contains, among others,

(1) (2) (3)

Despite the inconsistency in (1), conclusions in (2)–(3) provide useful information about eve and jack. Of course, there may be more victims for whom conclusions are consistent. In fact, given that is consistent, is consistent for all other than resc. Importantly, inconsistent conclusions may be useful as well. First, they may indicate problematic situations calling for further attention. Second, when a generated plan makes a given goal inconsistent, executing the plan may be a better choice than doing nothing. E.g., if the goal is important, like helping victims, a plan with inconsistent goal may be better than having no plan. For many further arguments towards paraconsistency see [1, 3, 10, 11, 12, 13, 14, 20, 17, 24, 57, 61] and numerous references there.

To illustrate the questionable features of , assume that is unknown and is inconsistent. In such a case, in we have:


The results (4)–(5) may be misleading to users sharing the classical understanding of and , where one expects disjunction to be true (respectively, conjunction to be false) only when at least one of its arguments is true (respectively, false). In , the disjunction in (4) is inconsistent and the conjunction in (5) is unknown. Consequently, we chose and 4ql, adjusting the related algorithms to our needs.

The original contributions of the paper include:

  • a synthesis of ASP and 4ql: to design a new language, 4sp, with tractable model generation and capturing all queries computable in deterministic polynomial time;

  • a generalized concept of stratification: to achieve the uniformity of presentation and comparability of ASP and 4ql programs;

  • a concept of trial expressions allowing for setting hypotheses: to accomplish tractability of 4sp model generation;

  • Algorithm 11: for generating well-supported 4sp models;

  • Theorems 5.2, 7.17.4: to show relationships among ASP, 4ql and 4sp as well as properties of 4sp.

The paper is structured as follows. In Section 2 we outline the methodology behind 4sp and discuss selected use cases of 4sp. In Sections 35 we recall the three- and four-valued logics considered in the paper as well as the ASP and 4ql languages. In Section 6 we introduce trial expressions and the 4sp language, and present an algorithm for 4sp model generation. Section 7 is devoted to properties of 4sp and its relations to ASP and 4ql. Finally, Section 8 discusses related work and concludes the paper.

2 Methodology and Selected Use-Cases

Many application examples of paraconsistent reasoning are discussed, e.g., in [1, 3, 10, 11, 17, 57, 61]. 4sp can serve as a pragmatic tool for paraconsistent reasoning in most application domains and scenarios addressed there. Below we outline the intended methodology of its use and present some further selected use cases.

2.1 The Intended Methodology

As we will show in Section 7, every 4sp program may have an exponential number of models. However, computing each model is tractable. We therefore replace the ASP “generate-and-test” methodology, particularly suitable for solving NP-complete problems, by the “generate-choose-and-use” methodology, where one:

  • generates as many 4sp models as possible given particular time restrictions;

  • selects the best models with respect to some externally defined criteria.

Model generation may be “blind” if no further information is available. With additional external knowledge it may be better directed. For example, generating literals in models may be directed by suitable probability distributions when available. Given a nonmonotonic reasoning support, one may tend to avoid

abnormal literals, use defaults or results obtained from other nonmonotonic techniques.222For a review of tractable versions of such forms of reasoning, compatible with our approach, see [42].

The criteria of selecting “the best” models are dependent on the particular goals to be achieved. E.g., one may choose models:

  • minimizing the number of inconsistent literals for specific ’s;

  • minimizing the number of unknown literals for specific ’s;

  • minimizing the resource consumption, cost, risks involved, etc.;

  • maximizing the probability of success or preferences’ satisfaction;

  • etc.

Note that 4sp does not provide specific means for expressing such criteria. It is meant to generate models specified by programs and then to supply them for evaluation, choice and use to other systems’ components.

Remark 1

Let us emphasize that in 4sp generating a model is tractable. This contrasts with ASP, where generating each model is intractable. Generating an 4sp model depends on first generating a set hypotheses (being tractable) and then using the set hypotheses to generate a model. For each set of hypotheses there is a 4sp model. Even though iterating through all sets of hypotheses is infeasible (requiring an exponential time), the intended methodology assumes generation of as many models as possible with the guarantee that the assumed (feasible) number of models will be generated. This is not the case in ASP. One may generate candidate answer sets and, assuming PNP, finding even the first answer set may require an exponential number of iterations.

2.2 Selected Use-Cases

2.2.1 Big Data Analytics

When big data is involved, e.g., collected from sensor networks, cyber-physical systems, IoT, health care systems, social media, smart cities, agriculture, finance, education, etc., uncertainty involving inconsistencies, noise, ambiguities and incompleteness, is inevitable [35]. The aim of big data analytics is to discover hidden knowledge, e.g., leading to early detection of destructive diseases or simulating risky business decisions. When rule languages are used as analytic tools, they typically use big data aggregates where inconsistencies may or have to be inherited. Enforcing consistency usually leads to loss of perhaps valuable information. For example, “in health care systems, inconsistent information may be required to provide a full clinical perspective where no information loss is desirable” [36]. Of course, when the involved facts or conclusions of rules are contradictory, the ASP consistency requirement filters out all potentially useful models.

2.2.2 Ontology Fusion

Fusing ontologies or belief bases may result in inconsistencies difficult or undesirable to recover [36, 38, 52]. Program 2 reflects the scenario discussed in [36, 52], where two ontologies are fused and b, cns, ns, bp stand for brain, central nervous system, nervous system and body part, respectively.

      /* shared by the 1st and the 2nd ontology  */        /* shared by the 1st and the 2nd ontology  */     /* from the 1st ontology  */      /* from the 2nd ontology  */ .
Program 2 Sample rules resulting from fusing ontologies.

The set gathers conclusions of Program 2. Though not an answer set, it is a 4sp model which can be used for further reasoning. While the ontology may be huge, the inconsistency affects only literals involving .

Some Further Use-Cases

Due to a limited space let us only indicate some further use cases being directly relevant to the current paper:333Please consult also references in the indicated papers.

  • actions in potentially inconsistent/incomplete environments [14];

  • belief fusion and shadowing [13, 22];

  • argumentation [23, 24];

  • approximate reasoning [59].

3 Many-valued Logics Used in the Paper

In the rest of the paper we will focus on propositional rule languages. Of course, first-order variables are valuable as means to concisely express rule schemata. As we consider finite domains only, our results can be lifted to the case where first-order variables are present.

We will use three- and four-valued logics using (suitable subsets of) truth values: (false), (unknown), (inconsistent), (true).444According to the standard convention we will not distinguish between truth values and constants denoting them. To keep the presentation uniform, the syntax of all considered logics is the same: we use a set of propositional variables (propositions, for short) and define formulas to be closed under unary connectives (classical and default negation), and binary ones (conjunction, disjunction, implication).

Let be a logic. Its set of truth values is denoted by . We will assume that . For the purpose of defining models, we have to designate a set of truth values to act as being true [50, 58]. The set of designated truth values is denoted by ().

To define the semantics of we first need to provide the semantics of connectives applied to truth values. Truth tables of negations and implication are shown in Table 1.

Table 1: The semantics of negations and implication.
Remark 2

  • Intuitively, the default negation as a four-valued connective stands for “ is not true” while the traditional ASP meaning is “ is not in the interpretation” (when is inconsistent, both and are in the interpretation).

  • The implication on as well as on is the implication of [54]. It has been generalized to in [45].

The semantics of and is standard:


where and are respectively the least upper and the greatest lower bound with respect to ordering chosen from Figure 1.

Figure 1: Truth orderings used in the paper where stands for Kleene, - Priest, - linearity, and - Belnap.

To define the semantics of formulas of we assume a mapping assigning truth values to propositions:


Assignments (8) are extended to all formulas:


Logics used in the paper are listed in Table 2, where are three-valued logics of [39] and [48], are four-valued logics of [7] and [45], respectively.

Logic Extends Truth values Ordering
, , in Figure 1(a)
, , in Figure 1(b)
, , , in Figure 1(c)
, , , in Figure 1(d)
Table 2: Logics used in the paper with underlined designated truth values.
Definition 1 (Literals)

Let be a proposition. By a classical literal (literal, for short) we mean an expression of the form (positive literal) or (negative literal). The set of classical literals is denoted by . When , is identified with . By a default literal we understand an expression of the form , where . The set of default literals is denoted by .

Definition 2 (Interpretations, consistency)

By an interpretation we mean a finite set . An interpretation is consistent if, for every , or .

In what follows, the considered set of propositions, , will always be finite. In such cases there is a one-to-one mapping between assignments (8) and interpretations allowing us to freely switch between them. Namely, given an interpretation , the corresponding assignment is:

Of course, can be extended to all formulas using Equations (9) and (10). To simplify notation we will write to stand for . Conversely, given , the corresponding interpretation is defined by:

Definition 3 (Models)

Given a logic with the set of designated values , we say that an interpretation  is a model of a formula , , when .

4 Answer Set Programming

We will focus on normal ASP programs.555The results can be extended to disjunctive programs where disjunctions correspond to choice rules but due to the space limit, we do not consider this extension here.

Definition 4 (Syntax of normal ASP programs)

Let and . A normal ASP rule (ASP rule, for short) is an expression of the form:


It is further assumed that and when then .666Default literals have to be “guarded” by a classical literal. Literal is called the conclusion (head) and the part after ‘:–  ’ is called the premises (body) of rule (11). A rule with the empty premises is called a fact and is written as ‘’. A rule without default literals is called pure.

normal ASP program (ASP program, for short) is a finite set of normal rules. A program is pure if it contains pure rules only.

Remark 3

Note that we require a nonempty conclusion, so ASP constraints are excluded. With ASP-like constraints, tractability could be lost. Indeed, iterating through the set of hypotheses could take superpolynomial time when models could be rejected by constraints.

Note also that the empty conjunction, thus the empty body, is assumed to be .

The basic rule-based reasoning principle of ASP is:

– if premises of rule (11) evaluate to ,    add to the set of conclusions. (12)

The semantics of ASP programs is given by answer sets.

Definition 5 (Models of ASP programs; Answer Sets)

By a model of an ASP program we mean a consistent interpretation satisfying all rules of understood as implications:

If is pure then an answer set of is the least (with respect to ) model of , if exists. If contains   then is an answer set of iff is the least model of , where is obtained from by substituting each default literal occurring in by its truth value .

Let us now provide a simple (naive) algorithm for generating an answer set for an ASP program. We first need Algorithm 3 generating minimal interpretations for pure programs. To keep presentation simple, it is based on the naive bottom up evaluation - see [2]. Each literal of the form is treated as a fresh propositional variable, say , so pure ASP programs can be seen as Datalog programs to which the original naive bottom up evaluation applies. Generating an answer set can be done nondeterministically, as in Algorithm 4.

1  /* returns the least model of a pure ASP program  */ set ; while there is a rule such that
2         and do
3       set ;
return .
Algorithm 3 function generateLeast();
1  /* returns an answer set of an ASP program if exists  */ set a nondeterministically generated consistent interpretation; set = generateLeast;  /*  is defined in Def. 5  */ if = then
2      return .
Algorithm 4 function generateAnswerSet();

The following theorem is well known (see, e.g., [6, 16, 46]).

Theorem 4.1

Given an ASP program , generating an answer set for is an NP-complete problem with respect to the number of propositions in .

5 The 4ql Language

The 4ql language has been introduced in [42, 43]. In this paper we shall use its extended version of [44].777

An open source interpreter of

4ql and its doxastic extensions (see [13] and references there) is available via 4ql.org. 4ql allows for paraconsistent reasoning, using the logic. Rather than default negation , inspection operators are used as defined below.

Definition 6 (Inspection operators)

By an inspection operator we understand any expression of the form , where and . The meaning of inspection operators depends on the actual interpretation :


The set of inspection operators is denoted by .

When truth values are restricted to three values of , default negation of ASP can be defined by:


The original version of 4ql uses modules but, for the sake of uniformity, we skip them here. In order to compare 4ql, ASP, and 4sp as well as to achieve the full power of 4ql without using modules, let us introduce a general form of stratification with respect to a set of arbitrary expressions , e.g., consisting of default literals or expressions involving inspection operators.

Definition 7 (Stratification)

Given a finite set of 4ql (or ASP) rules and a set of expressions , we say that is stratifiable with respect to when such that for ,  and:

  • for every conclusion of a rule in , there is such that all rules with conclusions are in ( is fully defined in );

  • whenever an expression appears in premises of a rule in , for , classical literals appearing in are fully defined in for some ;

  • whenever an expression appears in premises of a rule in for , classical literals occurring in are fully defined in for some .

Remark 4

Stratification of Definition 7 generalizes stratification used in Datalog  [2]. To verify whether a set of 4ql rules is stratifiable, one can easily adapt the deterministic polynomial time algorithm checking stratification for Datalog programs. Finding a stratification, if exists, is also tractable.

Definition 8 (Syntax of 4ql programs)

Let , , . A 4ql rule is an expression of the following form, where semicolon ‘;’ stands for disjunction, with conjunction ‘,’ binding stronger:


A rule without occurrences of inspection operators is called pure. A 4ql program is a finite set of 4ql rules stratifiable with respect to . A program is pure if it contains pure rules only.

Rule (15) is interpreted as the following implication of :


The reasoning principles of 4ql are (12) together with:

– if premises of rule (15) evaluate to , add to the set of conclusions. (17)
Remark 5

Though Principles (12) and (17) are natural, they appear problematic when disjunction is concerned. As an example, consider Program 5.

Program 5 Program illustrating a disjunction issue.

When one of premises of rules in Lines 55 of Program 5 evaluates to with the other one being , according to Principles (12), (17), becomes . On the other hand, the disjunction should intuitively be true, so one would rather expect a rule like:


In such circumstances, using rule (18) one indeed concludes that is in each logic listed in Table 2.

Accordingly, disjunction is explicit in rules. Due to its nonmonotonic behavior, it requires a nonstandard computation engine.888Datalog-like evaluation applied to reducts in ASP is far from being sufficient here. For details see [42, 44] and further parts of the current paper.

The semantics of 4ql is defined by well-supported models, where well-supportedness guarantees that all conclusions are derived using reasoning starting from facts [42, 43, 44]. For a definition of well supported models see [43]. To put well-supportedness into perspective, below we provide a new, equivalent definition generalizing the concept of loops [41].

Definition 9 (Dependency graph)

Let be a pure 4ql program. By a dependency graph of we understand a directed graph with vertices labeled by classical literals occurring in . There is an arc from to if there is a rule in whose head is and appears in the rule’s body.

Definition 10 (Loop)

A non-empty subset of literals occurring in a pure 4ql program is called a loop of if for any , there is a path of non-zero length from to in the dependency graph of , such that all the vertices in the path are in .

By we understand the set of rules:

Definition 11 (Well-supported model)

An interpretation is a well-supported model of a pure 4ql program iff is the least (with respect to ) model of ,999In the four-valued case, minimality substitutes the completion of [18] used together with loop formulas to characterize answer sets for ASP programs [41]. and for every loop of , if there is such that then:

  • iff there is a rule ‘’ in such that and there are no rules ‘ in such that or ;

  • iff there is a rule ‘’ or ‘’ in such that or there are rules ‘, in with and .

Algorithm 6 presents a high-level pseudocode for computing well-supported models for pure 4ql programs. It is further formalized as Algorithm 7 (implementing Line 6 of Algorithm 6), and Algorithm 8 (computing the well-supported model). Note that all conclusions inferred by Algorithm 6 are supported by facts and no conclusion is obtained using a proposition defeated later.

2       generate the least set of conclusions; retract conclusions based on defeated premises,i.e., premises at some point being true but later becoming inconsistent; correct (minimally) the obtained set of literals to make it a model (to satisfy rules with inconsistent premises and not inconsistent conclusions)
until no further retractions are needed.
Algorithm 6 A pseudocode for computing the well supported model for a given pure 4ql program.
Remark 6

To generalize Algorithm 8 to non-pure programs, one can find its stratification (without losing tractability – see Remark 4) and eliminate inspection operators stratum by stratum, starting from the lowest one.101010Here we understand stratification in the sense of Definition 7 with . Let be the lowest stratum where inspection operators occurs. Their truth values are determined in strata lower than . Substituting all inspection operators occurring in by the determined truth values makes a pure program for which Algorithm 8 applies. This procedure is to be iterated until all strata have been considered.

1  /* returns the correction of with respect to a pure 4ql program  */ set ; set ; while there is a rule such that and do
2       set ; set ;
return .
Algorithm 7 function findCorrection(, );
1  /* returns the well-supported model for a 4ql program  */ set ; /*  is the set of inconsistent literals detected so far  */ repeat
2       set = generateLeast;  /*  is the set of potentially true literals  */ set ;set = findCorrection; set ;
until ;return .
Algorithm 8 function generateWsm4ql()

The following theorem is proved in [43, 44].

Theorem 5.1

  • For every 4ql program there is exactly one well-supported model and it can be generated in deterministic polynomial time with respect to the number of propositions in .

  • 4ql captures deterministic polynomial time over linearly ordered domains. That is, every query computable in deterministic polynomial time can be expressed in 4ql whenever a linear ordering over the domain is available in the 4ql vocabulary.

When stratification is not required, like in the case of ASP, generating well supported models for 4ql programs becomes an NP-complete problem.

The following theorem shows a close correspondence between (stratified) ASP and 4ql programs.

Theorem 5.2

Let be an ASP program stratifiable with respect to the set of default literals and be a 4ql program obtained from by substituting default negations by inspection operators as in (14). Then the well supported model of is the answer set of iff is consistent. If is inconsistent then has no answer set.

6 The 4sp Language

The syntax of 4sp programs is very similar to ASP programs. We extend the language by allowing disjunctions and the truth constant to appear in rules’ bodies.

Definition 12 (Syntax of 4sp programs)

Let and . A 4sp rule is an expression of the following form, where semicolon ‘;’ stands for disjunction, with conjunction ‘,’ binding stronger:


A 4sp rule is pure if it does not involve default negation. A 4sp program is a finite set of 4sp rules. A 4sp program is pure if it contains pure rules only.

The key step towards tractable model generation is to use the four valued default negation, as defined in Table 1. To illustrate the idea, let us start with supportedness losing in the non-stratified case.

Example 1

When 4ql programs may be non-stratified, supportedness may be lost. To illustrate the issue, consider non-stratifiable 4ql rules in Program 9.111111Program 9 is a set of rules being neither a 4ql nor a 4sp program. The program has no well-supported models: the rule in Line 9 makes true so the second rule makes true, too. That way loses its support so cannot be derived. Consequently, cannot be derived, so its value becomes and so on.

  /* p:–  q. – when restricted to ASP  */
Program 9 Supportedness losing.

When Line 9 is replaced by ‘’, with the four-valued  , after applying the rules it would be natural to consider inconsistent. Now, Principle (17) together with the rule in Line 9 make inconsistent and the rule in Line 9 makes inconsistent. So the well-supported model would become .

In 4sp, rather than using two-valued inspection operators, we will use the four-valued default negation  . However, we encounter the next issue, illustrated in Example 2.

Example 2

Consider Program 10. It consists of two non-stratifiable rules.

Program 10 A further non-stratifiability effect.

Both and are its well-supported models. Their generation depends on the order of rules: when the rule in Line 10 is applied first, the result is , being otherwise.

Of course, the semantics should not depend on the order of rules’ application. We therefore consider programs in the context of trial expressions allowing one to select truth values of default negations.

Definition 13 (Trial expression)

By a trial expression we understand an expression of the form:


where is a program with ASP syntax in the sense of Definition 4 and , called a set of hypotheses for , is a finite set of expressions of the form or such that for every and only literal occurring in within an expression , the literal occurs (as a subexpression) in .

The set of trial expressions is denoted by .

Intuitively, amounts to assuming the truth values of default negations in and verifying whether the hypotheses have been consistent with the results of . For a particular default negation occurring in ,

  • first assume that the truth value is (respectively, );

  • if, during generating an answer set for , the value of appears not to be (respectively, not to be ), correct the truth value of assigning it the value .

Note that we do not allow expressions of the form . First, the role of trial expressions is to try to “guess” consistent solutions with inconsistency being an undesirable effect. Second, can be expressed by . This follows from the fact that is only when is .

Example 3

Let denote Program 10. Then:


is intended to mean that the value of is hypothesized to be true and the value of is hypothesized to be false. Hence, (22) results in , confirming the hypotheses.

On the other hand, consider:


The rules of Program 10 generate as conclusions, violating both hypotheses expressed in (23). Therefore, both and become and the answer set for (23) becomes .

Remark 7

Note that hypotheses of (21) may mutually affect knowledge bases represented by programs. For example, is inconsistent with the hypothesis that . If is a generated conclusion, together with makes inconsistent, what only happens when is . This calls for placing in the generated model, too. Such side-effects have to be reflected in the model generation algorithm.

In importing truth values from an interpretation to the set of hypotheses we deal with the situation when the imported truth values are not . Therefore, we are on the grounds of and can use the following rules:121212The rule (24) applies to being either positive or negative.


Of course, when is in , so the rule (24), applied twice, results in adding to both and .


Definition 14 (Semantics of 4sp)

Given an 4sp program , by a well-supported model of we mean any well-supported model for ‘’ where is an arbitrary set of hypotheses for .

For computing well-supported models of 4sp programs we still need the following definition.

Definition 15 (Interlace)

Let be an interpretation and be a set of hypotheses for a 4sp program. By an interlace of and , denoted by , we mean a minimal interpretation such that and is closed under application of rules (24)–(26).

Algorithm 11 computes the well-supported model for a 4sp program when a set of hypotheses is given. The function ‘generateWsmAux’ is obtained from Algorithm 8 by adding as a parameter and replacing Line 8 by:

 /* returns the well-supported model for ‘’  */ return generateWsmAux().
Algorithm 11 function generateWsm4sp()
Remark 8

Though Algorithm 11 may look simple, it actually substantially differs from the algorithms for generating well-supported models for 4ql programs due to the use of in (27) and related concepts.

7 Properties of 4sp

Let us now focus on the most important properties of 4sp.

Theorem 7.1

  • For every 4sp program and every set of hypotheses for provided as input to Algorithm 11, the unique well-supported model is computed in deterministic polynomial time in the number of propositions in and the size of .

  • 4sp captures deterministic polynomial time over linearly ordered domains.

To generate all well-supported models for a given 4sp program it suffices to iterate Algorithm 11 with sets reflecting different choices of truth values , assigned to default literals in .

Theorem 7.2

For every 4sp program there is at most an exponential number of well-supported models with respect to the number of default literals occurring in .

In the light of Theorem 7.2, the intended use of Algorithm 11 instantiates the methodology outlined in Section 2.1, where model generation depends on assigning truth values to hypotheses.

Theorem 7.3

For every ASP program , the set of all well-supported models of (being a 4sp program) contains all answer sets of .

When inspection operators are also allowed in premises of 4sp rules, we have the following theorem.

Theorem 7.4

When inspection operators are allowed,

  • model generation is tractable for 4sp programs stratifiable with respect to ;

  • model generation is NP-complete for 4sp programs without the stratifiability requirement.

8 Related Work and Conclusions

The paper combines two threads: ASP [5, 6, 16, 32, 34, 33, 40, 41, 55] and 4ql [42, 43, 44, 56]. A detailed comparison of the selected features of ASP, 4ql and 4sp as well as models used in these languages is provided in Tables 3 and 4.

Language Number Model Stratification Consistency
ASP Exp NP No Yes
4ql P Yes No
4sp , Exp P No No
Table 3: A comparison of ASP, 4ql and 4sp features.
Models Truth Consistency Minimality Supportedness
Stable models , Yes Yes Yes
Answer Sets , , Yes Yes Yes
Well-supported , , , No No Yes
Table 4: A comparison of the discussed models.

Paraconsistent logic programming has been studied by [15] who extended Kripke-Kleene semantics investigated in [29] to a four-valued framework founded on Belnap logic . The first paraconsistent approach to ASP has been proposed in [51], where a -based framework is used and extended to six- and nine-valued frameworks for reasoning with inconsistency. Unlike [51], we use  together with trial/inspection operators as uniform means for disambiguating inconsistencies and completing missing knowledge in a nonmonotonic manner. For a survey of paraconsistent approaches to logic programming see also [19].

Paracoherent ASP [25] aims at reasoning from ASP programs lacking answer sets due to cyclic dependencies of atoms and their default negations. Program 9 with Line 9 substituted by the equivalent (with respect to ) ASP rule ‘’ is an example of such a dependence. For paracoherent reasoning [25] consider semi-stable models of [51] and semi-equilibrium models. In 4sp, Program 9 has a single model with both and inconsistent, , the same no matter whether is assumed or . Both, for semi-stable and semi-equilibrium semantics, model generation is proved intractable.

A hierarchy of tractable classes of stable models (over ) has been reported in [8]. It reflects programs distance from their stratifiability. However, one of complexity factors considered there is, in the worst case, exponential with respect to number of propositional variables, what makes it intractable in the framework we consider.

Sufficient conditions for ASP guaranteeing tractability of answer set generation have been identified in the literature [27, 28]. Also, tractable default reasoning subsystems that can be translated into ASP have been considered in many sources, including [9, 26, 31, 53]. However, these approaches cover substantial subclasses of the general problem for which we have achieved tractability.

In summary, we have defined the 4sp language combining the ASP and 4ql ideas. We have gained tractability of model generation by relaxing the consistency requirement. To our best knowledge, tractability of model generation for ASP-like languages has not been achieved before. That way, a prevalent use of paraconsistency allowed us to achieve tractability of the, otherwise intractable, problem.

4sp is intended to serve as a tool complementary/parallel to ASP, being useful for paraconsistent reasoning and providing models when ASP model generation fails due to complexity reasons or inconsistencies involved.


  • [1] Abe, J. (ed.): Paraconsistent Intelligent-Based Systems. New Trends in Applications of Paraconsistency, ISRL, vol. 94. Springer (2015)
  • [2] Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison-Wesley Pub. Co., Boston, MA, USA (1996)
  • [3] Akama, S. (ed.): Towards Paraconsistent Engineering, Intelligent Systems Reference Library, vol. 110. Springer (2016)
  • [4] Alcântara, J., Damásio, C., Pereira, L.: An encompassing framework for paraconsistent logic programs. J. Applied Logic 3(1), 67–95 (2005)
  • [5] Alviano, M., Faber, W., Leone, N., Perri, S., Pfeifer, G., Terracina, G.: The disjunctive datalog system DLV. In: de Moor et al. [47], pp. 282–301
  • [6] Baral, C.: Knowledge Representation, Reasoning, and Declarative Problem Solving. Cambridge University Press (2003)
  • [7] Belnap, N.: A useful four-valued logic. In: Epstein, G., Dunn, J. (eds.) Modern Uses of Many Valued Logic. pp. 8–37. Reidel (1977)
  • [8] Ben-Eliyahu, R.: A hierarchy of tractable subsets for computing stable models. J. Artif. Intell. Res. 5, 27–52 (1996)
  • [9] Ben-Eliyahu, R., Dechter, R.: Default reasoning using classical logic. Artif. Intell. 84(1-2), 113–150 (1996)
  • [10] Bertossi, L., Hunter, A., Schaub, T. (eds.): Inconsistency Tolerance [result from a Dagstuhl seminar], LNCS, vol. 3300. Springer (2005)
  • [11] Béziau, J.Y.: The future of paraconsistent logic. Logical Studies 2, 1–23 (1999)
  • [12] Béziau, J.Y., Carnielli, W., Gabbay, D. (eds.): Handbook of Paraconsistency. College Publications (2007)
  • [13] Białek, Ł., Dunin-Kȩplicz, B., Szałas, A.: Belief shadowing. In: Mascardi, V., Ricci, A., Weyns, D. (eds.) Engineering Multi-Agent Systems. LNCS, vol. 11375, pp. 158–180. Springer (2019)
  • [14] Białek, Ł., Dunin-Kȩplicz, B., Szałas, A.: A paraconsistent approach to actions in informationally complex environments. Ann. Math. Artif. Intell. 86(4), 231–255 (2019)
  • [15] Blair, H., Subrahmanian, V.: Paraconsistent logic programming. Theor. Comput. Sci. 68(2), 135–154 (1989)
  • [16] Brewka, G., Eiter, T., Truszczynski, M.: Answer set programming at a glance. Comm. ACM 54(12), 92–103 (2011)
  • [17] de Carvalho, F., Abe, J. (eds.): A Paraconsistent Decision-Making Method, SIST, vol. 87. Springer (2018)
  • [18] Clark, K.: Negation as failure. In: Minker, J. (ed.) Logic and Data Bases, vol. 1, pp. 293–322. Plenum Press (1978)
  • [19] Damásio, C., Pereira, L.: A survey of paraconsistent semantics for logic programs. In: Gabbay, D.M., Smets, P. (eds.) Handbook of Defeasible Reasoning and Uncertainty Management Systems. vol. 2, pp. 241–320. Kluwer (1998)
  • [20] De Bona, G., Hunter, A.: Localising iceberg inconsistencies. Artif. Intell. 246, 118–151 (2017)
  • [21] Doherty, P., Szałas: Stability, supportedness, minimality and Kleene Answer Set Programs. In: Eiter, T., Strass, H., Truszczyński, M., Woltran, S. (eds.) Advances in KR, LP, and Abstract Argumentation - Essays Dedicated to G. Brewka. LNCS, vol. 9060, pp. 125–140. Springer (2015)
  • [22] Dunin-Kȩplicz, B., Rüb, I., Szałas, A.: Doxastic group reasoning via multiple belief shadowing. In: Baldoni et al., M. (ed.) Proc. PRIMA: Principles and Practice of MAS, LNCS, vol. 11873, pp. 271–288. Springer (2019)
  • [23] Dunin-Kȩplicz, B., Strachocka, A.: Tractable inquiry in information-rich environments. In: Yang and Wooldridge [60], pp. 53–60
  • [24] Dunin-Kȩplicz, B., Strachocka, A., Szałas, A., Verbrugge, R.: Paraconsistent semantics of speech acts. Neurocomputing 151, 943–952 (2015)
  • [25] Eiter, T., Fink, M., Moura, J.: Paracoherent answer set programming. In: Proc. 20th Int. Conf. KR’2010. pp. 486–496 (2010)
  • [26] Eiter, T., Lukasiewicz, T.: Default reasoning from conditional knowledge bases: Complexity and tractable cases. Artif. Intell. 124(2), 169–241 (2000)
  • [27] Fichte, J., Hecher, M., Morak, M., Woltran, S.: Answer set solving with bounded treewidth revisited. In: Balduccini, M., Janhunen, T. (eds.) Proc. 14th Int. Conf. LPNMR. LNCS, vol. 10377, pp. 132–145. Springer (2017)
  • [28] Fichte, J., Szeider, S.: Backdoors to tractable answer set programming. Artif. Intell. 220, 64–103 (2015)
  • [29] Fitting, M.: A Kripke-Kleene semantics for logic programs. J. Logic Programming 2(4), 295–312 (1985)
  • [30] Fitting, M.: The family of stable models. J. Logic Programming 17(2/3&4), 197–225 (1993)
  • [31] Garcia, B.: New tractable classes for default reasoning from conditional knowledge bases. Ann. Math. Artif. Intell. 45(3-4), 275–291 (2005)
  • [32] Gebser, M., Kaminski, R., Kaufmann, B., Schaub, T.: Answer Set Solving in Practice. Morgan and Claypool Pub. (2012)
  • [33] Gelfond, M., Kahl, Y.: Knowledge Representation, Reasoning, and the Design of Intelligent Agents - The Answer-Set Programming Approach. Cambridge University Press (2014)
  • [34] Gelfond, M., Lifschitz, V.: The stable model semantics for logic programming. In: Kowalski, R., Bowen, K. (eds.) Proc. Logic Prog. pp. 1070–1080. MIT Press (1988)
  • [35] Hariri, R., Fredericks, E., Bowers, K.: Uncertainty in big data analytics: survey, opportunities, and challenges. J. Big Data 6,  44 (2019)
  • [36] Imam, F., MacCaull, W.: Integrating healthcare ontologies: Inconsistency tolerance and case study. In: Ardagna, D., Mecella, M., Yang, J. (eds.) Business Process Management Workshops BPM’2008. LNBIP, vol. 17. Springer (2009)
  • [37] Janhunen, T.: Cross-translating answer set programs using the ASPTOOLS collection. KI 32(2-3), 183–184 (2018)
  • [38] Kaminski, T., Knorr, M., Leite, J.: Efficient paraconsistent reasoning with ontologies and rules. In: Yang and Wooldridge [60], pp. 3098–3105
  • [39]

    Kleene, S.: On notation for ordinal numbers. J. Symbolic Logic

    3, 150–155 (1938)
  • [40] Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM Trans. Comput. Logic 7(3), 499–562 (2006)
  • [41] Lin, F., Zhao, Y.: ASSAT: computing answer sets of a logic program by SAT solvers. Artif. Intell. 157(1-2), 115–137 (2004)
  • [42] Małuszyński, J., Szałas, A.: Living with inconsistency and taming nonmonotonicity. In: de Moor et al. [47], pp. 334–398
  • [43] Małuszyński, J., Szałas, A.: Logical foundations and complexity of 4QL, a query language with unrestricted negation. Journal of Applied Non-Classical Logics 21(2), 211–232 (2011)
  • [44] Małuszyński, J., Szałas, A.: Partiality and inconsistency in agents’ belief bases. In: Barbucha, D., Le, M., Howlett, R., Jain, L. (eds.) KES-AMSTA. Frontiers in AI and Applications, vol. 252, pp. 3–17. IOS Press, Amsterdam, The Netherlands (2013)
  • [45] Małuszyński, J., Szałas, A., Vitória, A.: Paraconsistent logic programs with four-valued rough sets. In: Chan, C.C., Grzymala-Busse, J., Ziarko, W. (eds.) Proc. 6th Int. Conf. on Rough Sets and Current Trends in Computing (RSCTC 2008). LNAI, vol. 5306, pp. 41–51 (2008)
  • [46] Marek, V., Subrahmanian, V.: The relationship between stable, supported, default and autoepistemic semantics for general logic programs. Theor. Comput. Sci. 103(22), 365–386 (1992)
  • [47] de Moor, O., Gottlob, G., Furche, T., Sellers, A. (eds.): Datalog Reloaded, LNCS, vol. 6702. Springer (2011)
  • [48] Priest, G.: The logic of paradox. Journal of Philosophical Logic 8(1), 219–241 (1979)
  • [49] Przymusinski, T.: The well-founded semantics coincides with the three-valued stable semantics. Fundam. Inform. 13(4), 445–463 (1990)
  • [50] Rescher, N.: Many-Valued Logic. McGraw Hill, New York (1969)
  • [51] Sakama, C., Inoue, K.: Paraconsistent stable semantics for extended disjunctive programs. J. Log. Comput. 5(3), 265–285 (1995)
  • [52] Schlobach, S., Cornet, R.: Non-standard reasoning services for the debugging of description logic terminologies. In: Gottlob, G., Walsh, T. (eds.) Proc 18th IJCAI. pp. 355–362. Morgan Kaufmann (2003)
  • [53] Selman, B.: Tractable Default Reasoning. Ph.D. thesis, University of Toronto, Canada (1990), uMI Order No. GAXNN-65936
  • [54] Shepherdson, J.: Negation in logic programming. In: Minker, J. (ed.) Foundations of Deductive Databases and Logic Programming, pp. 19–88. Morgan Kaufmann (1988)
  • [55] Simons, P., Niemelä, I., Soininen, T.: Extending and implementing the stable model semantics. Artif. Intell. 138(1-2), 181–234 (2002)
  • [56] Szałas, A.: How an agent might think. Logic Journal of the IGPL 21(3), 515–535 (2013)
  • [57] Tanaka, K., Berto, F., Mares, E., Paoli, F. (eds.): Paraconsistency: Logic and Applications, Logic, Epistemology and Unity of Science, vol. 26. Springer (2013)
  • [58] Urquhart, A.: Many-Valued Logic. In: Gabbay, D., Guenthner, F. (eds.) Handbook of Philosophical Logic. vol. 3, pp. 71–116. Reidel, Dordrecht (1986)
  • [59] Vitória, A., Małuszyński, J., Szałas, A.: Modeling and reasoning with paraconsistent rough sets. Fundamenta Informaticae 97(4), 405–438 (2009)
  • [60] Yang, Q., Wooldridge, M. (eds.): Proc, 24th Int. Joint Conf. IJCAI. AAAI Press (2015)
  • [61] Zamansky, A.: On recent applications of paraconsistent logic: an exploratory literature review. J. Applied Non-Classical Logics 29(4), 382–391 (2019)