A Syntactic Operator for Forgetting that Satisfies Strong Persistence

by   Matti Berthold, et al.

Whereas the operation of forgetting has recently seen a considerable amount of attention in the context of Answer Set Programming (ASP), most of it has focused on theoretical aspects, leaving the practical issues largely untouched. Recent studies include results about what sets of properties operators should satisfy, as well as the abstract characterization of several operators and their theoretical limits. However, no concrete operators have been investigated. In this paper, we address this issue by presenting the first concrete operator that satisfies strong persistence - a property that seems to best capture the essence of forgetting in the context of ASP - whenever this is possible, and many other important properties. The operator is syntactic, limiting the computation of the forgetting result to manipulating the rules in which the atoms to be forgotten occur, naturally yielding a forgetting result that is close to the original program. This paper is under consideration for acceptance in TPLP.



page 1

page 2

page 3

page 4


When You Must Forget: beyond strong persistence when forgetting in answer set programming

Among the myriad of desirable properties discussed in the context of for...

Forgetting in Answer Set Programming – A Survey

Forgetting - or variable elimination - is an operation that allows the r...

An Approach to Forgetting in Disjunctive Logic Programs that Preserves Strong Equivalence

In this paper we investigate forgetting in disjunctive logic programs, w...

Strong Equivalence for Epistemic Logic Programs Made Easy (Extended Version)

Epistemic Logic Programs (ELPs), that is, Answer Set Programming (ASP) e...

On the Foundations of Grounding in Answer Set Programming

We provide a comprehensive elaboration of the theoretical foundations of...

Relaxation-based revision operators in description logics

As ontologies and description logics (DLs) reach out to a broader audien...

On Sufficient and Necessary Conditions in Bounded CTL

Computation Tree Logic (CTL) is one of the central formalisms in formal ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Unlike belief change operations such as revision, update and contraction, which have deserved ample attention for over three decades now, only recently has the Knowledge Representation and Reasoning research community recognized the operation of forgetting or variable elimination – i.e., removing from a knowledge base information that is no longer needed – as a critical operation, as witnessed by the amount of work developed for different logical formalisms (cf. the survey [Eiter and Kern-Isberner (2019)]).

The operation of forgetting is most useful when we wish to eliminate (temporary) variables introduced to represent auxiliary concepts, with the goal of restoring the declarative nature of some knowledge base, or just to simplify it. Furthermore, it is becoming increasingly necessary to properly deal with legal and privacy issues, including, for example, to enforce the new EU General Data Protection Regulation which includes the Right to be Forgotten. The operation of forgetting has been applied in cognitive robotics [Lin and Reiter (1997), Liu and Wen (2011), Rajaratnam et al. (2014)], resolving conflicts [Lang et al. (2003), Zhang and Foo (2006), Eiter and Wang (2008), Lang and Marquis (2010)], ontology abstraction and comparison [Wang et al. (2010), Kontchakov et al. (2010)], among others [Zhang and Zhou (2009), Alferes et al. (2013)], which further witnesses its importance.

This has also triggered an increasing interest in the development of forgetting operators for Logic Programs (LP) in particular Answer Set Programming (ASP) 

[Gelfond and Lifschitz (1991)], see, e.g., [Zhang and Foo (2006), Eiter and Wang (2008), Wang et al. (2013), Knorr and Alferes (2014), Wang et al. (2014), Delgrande and Wang (2015), Gonçalves et al. (2016b), Gonçalves et al. (2017), Gonçalves et al. (2019)] or [Gonçalves et al. (2016a), Leite (2017)] for a recent survey.

Despite the significant amount of interest in forgetting in the context of ASP, most research has focused on theoretical aspects, such as semantically characterizing various operators and investigating their properties. We now have a rather good understanding of the landscape of properties and operators, and their theoretical limits. Notably, it is now well established that strong persistence [Knorr and Alferes (2014)] – a property inspired by strong equivalence, which requires that there be a correspondence between the answer sets of a program before and after forgetting a set of atoms, and that such correspondence be preserved in the presence of additional rules not containing the atoms to be forgotten – best captures the essence of forgetting in the context of ASP, even if it is not always possible to forget some atom from a program while obeying such property [Gonçalves et al. (2016b)]. Also, there exists a semantic characterisation of the class of forgetting operators that satisfy strong persistence whenever that is possible.

Most of these theoretical results, however, have not been accompanied by investigations into the practical aspects of these operators. The characterization of the operators found in the literature is usually provided through the set of HT-models of the result, usually appealing to some general method to generate a concrete program from those models, such as the method that relies on the notion of counter-models in HT [Cabalar and Ferraris (2007)] or one of its variations [Wang et al. (2013), Wang et al. (2014)]. Whereas relying on such methods to produce a concrete program is important in the sense of being a proof that such a program exists, it suffers from several severe drawbacks when used in practice:

  • In general, it produces programs with a very large number of rules. For example, if we use the counter-models method variation in [Wang et al. (2013), Wang et al. (2014)] to determine the result of forgetting about atom from the following program

    while satisfying strong persistence, the result would have 20 rules, even if strongly equivalent to the much simpler program

  • Even if we replace the resulting program with some equivalent canonical one at the expense of the considerable additional computational cost (cf., [Inoue and Sakama (1998), Inoue and Sakama (2004), Cabalar et al. (2007), Slota and Leite (2011)]), its syntactic form would most likely bear no real connection to the syntactic form of the original program, compromising its declarative nature. Even the syntactic form of rules that are not related to the atoms to be forgotten would likely be compromised by such method.

  • It requires the computation of HT-models, which does not come without a significant cost.

This naturally suggests the need to investigate syntactic forgetting operators, i.e., forgetting operators that produce the result through a syntactic manipulation of the original program, thus not requiring the computation of HT-models, with the aim to keep the result as close as possible to the original program.

Despite the fact that most research on forgetting has focused on its semantic characterisation, there are some exceptions in the literature, notably the syntactic forgetting operators described in [Zhang and Foo (2006), Eiter and Wang (2008), Knorr and Alferes (2014)]. However, for different reasons, the early approaches are too simplistic [Zhang and Foo (2006), Eiter and Wang (2008)], in that they hardly satisfy any of the desirable properties of forgetting in ASP [Gonçalves et al. (2016a)], while the recent one has a very restricted applicability [Knorr and Alferes (2014)] (cf. Sect. 4 for a detailed discussion). For example, the syntactic operators in [Zhang and Foo (2006)] lack the semantic underpinning and are too syntax-sensitive, not even preserving existing answer sets while forgetting. The purely syntactic operator in [Eiter and Wang (2008)], dubbed , designed to preserve the answer sets, falls short of adequately distinguishing programs that, though having the same answer sets, are not strongly equivalent, which prevents it from satisfying strong persistence even in very simple cases. Additionally, is defined for disjunctive logic programs, but may produce programs with double negation, hence preventing its iterative use. Even from a syntactic perspective, performs unnecessary changes to the initial program, which may even affect rules that do not contain atom(s) to be forgotten. Finally, the operator in [Knorr and Alferes (2014)] is only applicable to a very particular narrow non-standard subclass of programs, which excludes many cases where it is possible to forget while preserving strong persistence, and, in general, cannot be iterated either.

In this paper, we address these issues and present a concrete forgetting operator, defined for the entire class of extended logic programs (disjunctive logic programs with double negation), that allows one to forget a single atom and produces a program in the same class. The operator is syntactic, limiting the computation of the result of forgetting to manipulating the rules in which the atom to be forgotten occurs, thus naturally yielding a resulting program that is close to the original program, while not requiring expensive computation of HT-models. Crucially, the operator satisfies strong persistence whenever this is possible, making it the first such operator.

Whereas one might argue that we still need to compute the HT-models in order to determine whether it is possible to satisfy strong persistence, hence eliminating one of the advantages mentioned above, this is significantly mitigated by the fact that the operator can always be used, even in cases where strong persistence cannot be satisfied, while still exhibiting desirable properties. In other words, if you must forget, this operator will ensure the “perfect” result whenever strong persistence is possible, and a “good” result when “perfection” is not possible. In this paper, we investigate the operators’ properties not only when strong persistence is possible, but also when that is not the case. In addition, we characterise a class of programs – dubbed -forgettable – from which it is always possible to forget (atom ) while satisfying strong persistence, whose membership can be checked in linear time.

We proceed as follows: in Sec. 2, we recall extended logic programs,and briefly recap important notions related to forgetting in ASP; then, we begin Sec. 3 by drawing some general considerations on syntactic forgetting and introduce some necessary notions in Sec. 3.1, introduce our new operator together with several illustrative examples in Sec. 3.2, followed by a discussion of its properties in Sec. 3.3; in Sec. 4 we discuss related work; and in Sec. 5, we conclude. All proofs of the established results and a detailed comparison with relevant syntactic operators in the literature can be found in the accompanying appendix.

2 Preliminaries

In this section, we recall necessary notions on answer set programming and forgetting.

We assume a propositional signature . A logic program over is a finite set of rules of the form , where all , and are atoms of . Such rules are also written more succinctly as where , , , and , and we will use both forms interchangeably. Given a rule , is called the head of , and the body of , where, for a set of atoms, and . We term the elements in (body) literals. and denote the set of atoms appearing in and , respectively. The general class of logic programs we consider111Note that the use of double negation is very common in the literature of forgetting for ASP (cf. the recent survey [Gonçalves et al. (2016a)]), and in fact necessary as argued in [Eiter and Wang (2008), Wang et al. (2013), Knorr and Alferes (2014), Wang et al. (2014)]. This does not pose a problem as double negation can be used to represent choice rules, and tools such as clingo support the syntax of double negation. includes a number of special kinds of rules : if , then we call disjunctive; if, in addition, , then is normal; if on top of that , then we call Horn, and fact if also . The classes of disjunctive, normal and Horn programs are defined resp. as a finite set of disjunctive, normal, and Horn rules. Given a program and an interpretation, i.e., a set of atoms, the reduct of given , is defined as .

An HT-interpretation is a pair s.t. . Given a program , an HT-interpretation is an HT-model of if and , where denotes the standard consequence relation for classical logic. We admit that the set of HT-models of a program is restricted to even if . We denote by the set of all HT-models of . A set of atoms is an answer set of if , but there is no such that . The set of all answer sets of is denoted by . We say that two programs are equivalent if and strongly equivalent, denoted by , if for any program . It is well-known that exactly when  [Lifschitz et al. (2001)]. Given a set , the -exclusion of a set of answer sets (a set of HT-interpretations) , denoted , is ().

A forgetting operator over a class of programs222In this paper, we only consider the very general class of programs introduced before, but, often, subclasses of it appear in the literature of ASP and forgetting in ASP. over is a partial function s.t. the result of forgetting about from , , is a program over , for each and . We denote the domain of by . The operator is called closed for if , for every and . A class of forgetting operators (over ) is a set of forgetting operators s.t. .

Arguably, among the many properties introduced for different classes of forgetting operators in ASP [Gonçalves et al. (2016a)], strong persistence [Knorr and Alferes (2014)] is the one that should intuitively hold, since it imposes the preservation of all original direct and indirect dependencies between atoms not to be forgotten. In the following, is a class of forgetting operators.

  • [align=left]

  • satisfies Strong Persistence if, for each , and , we have , for all programs with .

Thus, (SP) requires that the answer sets of correspond to those of , no matter what programs over we add to both, which is closely related to the concept of strong equivalence. Among the many properties implied by (SP) [Gonçalves et al. (2016a)], (SI) indicates that rules not mentioning atoms to be forgotten can be added before or after forgetting.

  • [align=left]

  • satisfies Strong (addition) Invariance if, for each , and , we have for all programs with .

However, it was shown in [Gonçalves et al. (2016b)] that there is no forgetting operator that satisfies (SP) and that is defined for all pairs , called forgetting instances, where is a program and is a set of atoms to be forgotten from . Given this general impossibility result, (SP) was defined for concrete forgetting instances.

A forgetting operator over satisfies (SP), for a forgetting instance over , if , for all programs with .

A sound and complete criterion was presented to characterize when it is not possible to forget while satisfying (SP). An instance satisfies criterion if there is such that the set of sets is non-empty and has no least element, where

This technical criterion was shown to be sound and complete, i.e., it is not possible to forget about a set of atoms from a program exactly when satisfies . A corresponding class of forgetting operators, , was introduced [Gonçalves et al. (2016b)].

It was shown that every operator in satisfies (SP) for instances that do not satisfy . Moreover, in the detailed study of the case where is satisfied [Gonçalves et al. (2017)], it was shown that the operators in preserve all answer sets, even in the presence of an additional program without the atoms to be forgotten. This makes an ideal choice to forgetting while satisfying (SP) whenever possible. Whereas is only defined semantically, i.e., it only specifies the HT-models that a result of forgetting a set of atoms from program should have, a specific program could be obtained from that set of HT-models based on its counter-models [Cabalar and Ferraris (2007)] – a construction previously adapted for computing concrete results of forgetting for classes of forgetting operators based on HT-models [Wang et al. (2013), Wang et al. (2014)].

3 A Syntactic Operator

In this section, we present a syntactic forgetting operator that satisfies (SP) whenever possible. We start with some general considerations on syntactic forgetting and introduce some necessary notions in Sec. 3.1. Then, we introduce our new operator together with explanatory examples in Sec. 3.2, followed by a discussion of its properties in Sec. 3.3.

3.1 On Syntactic Forgetting in ASP

One fundamental idea in syntactic forgetting (in ASP) is to replace the occurrences of an atom to be forgotten in the body of some rule with the body of a rule whose head is the atom to be forgotten. This can be rooted in the weak generalized principle of partial evaluation wGPPE [Brass and Dix (1999)] and aligns with the objective to preserve answer sets, no matter which rules over the remaining atoms are to be added.

Example 1

Consider program from which we want to forget about . We claim that the following should be a result of forgetting about .

Since depends on , and depends on as well as on , we want to preserve these dependencies without mentioning , thus creating two rules in which is replaced by and , respectively. This way, whenever a set of rules allow us to derive (or ), then must occur in all answer sets of as well as of . At the same time, since depends on , and would be false whenever both and are false, we capture this in a rule that represents this dependency.

As we will see later, these natural ideas provide the foundation for the syntactic operator we are going to define, even though several adjustments have to be made to be applicable to all programs, and to ensure that the operator satisfies (SP) whenever possible. Still, even in such simplified examples, the occurrence of certain rules that can be considered redundant would complicate this idea of syntactic forgetting. If occurred in program , then we would certainly not want to replace by and add . To avoid the problems caused by redundant rules and redundant parts in rules, we simplify the program upfront, and similarly to [Knorr and Alferes (2014)] and previous related work [Inoue and Sakama (1998), Inoue and Sakama (2004), Cabalar et al. (2007), Slota and Leite (2011)], we adopt a normal form that avoids such redundancies, but is otherwise syntactically identical to the original program. There are two essential differences to the normal form considered in [Knorr and Alferes (2014)]. First, contrarily to [Knorr and Alferes (2014)], our normal form applies to programs with disjunctive heads. Moreover, we eliminate non-minimal rules [Brass and Dix (1999)], which further strengthens the benefits of using normal forms.

Formally, a rule in is minimal if there is no rule such that or . We also recall that a rule is tautological if , or , or .

Definition 1

Let be a program. We say that is in normal form if the following conditions hold:

  • for every and , at most one of , or is in ;

  • if , then neither , nor are in ;

  • all rules in are minimal.

The next definition shows how to transform any program into one in normal form.

Definition 2

Let be a program. The normal form is obtained from by:

  1. removing all tautological rules;

  2. removing all atoms from in the remaining rules , whenever ;

  3. removing all atoms from in the remaining rules , whenever ;

  4. removing from the resulting program all rules that are not minimal.

Note that the first item of Def. 1 is ensured by conditions 1 and 2 of Def. 2, the second by 1 and 3, and the third by condition 4. We can show that the construction of is correct.

Proposition 1

Let be a program. Then, is in normal form and is strongly equivalent to .

In addition, can be computed in at most quadratic time in terms of the number of rules in (as ensuring minimality requires comparing all rules with each other).

Proposition 2

Let be a program. Then, the normal form can be computed in PTIME.

Thus for the remainder of the paper, we only consider programs in normal form, as this can be efficiently computed and is syntactically equal to the original program apart from redundancies.

Coming back to Ex. 1, the way we replaced becomes more complicated when the rules with head have more than one body literal or head atoms other than .

Example 2

Consider program , a variation of the program in Ex. 1. We observe that the following rules for would desirably be in the result of forgetting .

These four rules correspond to the four possible ways to guarantee that is false, i.e., that is not derived by any of the rules with in the head. For each rule, this means that either one body literal is false or one head atom different from is true. The first two rules correspond to the cases where one body atom in each rule with head is false. The last two rules correspond to the case where , the other disjunct in the head of the third rule, is true and one of and is false. Intuitively, in the head corresponds to in the body, which is why appears.

Besides the rules for , we should also have the following rules for deriving .

These rules are necessary to guarantee that, similarly as in , can be either true or false (which is why appears) whenever (the body of the original rule with head ) is true.

Together, these six rules guarantee the preservation of the existing implicit dependencies of .

In [Eiter and Wang (2008), Knorr and Alferes (2014)], sets of conjunctions of literals are collected with the aim of replacing some while preserving its truth value (though not considering disjunction nor double negation [Eiter and Wang (2008)]). We now introduce the notion of as-dual , as generalized from [Knorr and Alferes (2014)], which collects the possible ways to satisfy all rules of independently of . The intuitive idea is that, when applied to the set of rules that contain in the head, the as-dual contains sets of literals, each representing a possible way to guarantee that is false (since every rule with in the head is satisfied independently of ).

For this purpose, we need to introduce further notation. For a set of literals, and , where, for , we assume the simplification and . The sets and respectively denote the set of body and head literals after removing every occurrence of , i.e., and . We define as follows.

The as-dual construction considers the possible partitions of , and for each partition collects the negation of exactly one element (except ) from the body of each rule of , thus guaranteeing that the body of every rule of is not satisfied, together with the double negation of exactly one head atom (except ) from each rule of , thus guaranteeing that the head of every rule of is satisfied, together guaranteeing that all rules in are satisfied independently of .

When applied to the set of rules that contain in the head, the as-dual represents the possible ways to replace the occurrences of in the body of a rule when forgetting about from . It is important to note that, in this case, each set in contains one literal for each rule that contains in the head (those that allow to be derived), since only in this way we can guarantee that is false. This definition covers two interesting corner cases. First, if there is no rule with in its head, i.e., the input program is empty, then , meaning that is false, and therefore we do not need to impose conditions on other atoms. Finally, if contains as a fact, then , since in this case it is impossible to make false.

Example 3

Consider the program of Ex. 1. Applying the as-dual to the two rules with in the head, we obtain , whose unique element corresponds to the only way to make false.

If we now consider the program of Ex. 2, which has two rules with in the head, the as-dual construction renders , which correspond to the four possible ways to guarantee that is false.

3.2 A Novel Forgetting Operator

We are now ready to present the formal definition of the operator . As this definition is technically elaborate, we will first present the new operator itself that allows forgetting a single atom from a given program, and subsequently explain and illustrate its definition.

Definition 3 (Forgetting about from )

Let be a program over , and . Let be the normal form of . Consider the following sets, each representing a possible way can appear in rules of :

The result of forgetting about from , , is , where is as follows:

  • each

  • for each


    for each


    for each ,


    for each , ,

  • for each


    for each


    for each ,


    for each , ,

  • for each


    for each such that


    for each , , such that


    for each , ,

  • for each


    for each with ,

Using the normal form of , five sets of rules, , , , , and , are defined over , in each of which appears in the rules in a different form. In addition, contains all rules from that do not mention . These appear unchanged in the final result of forgetting.

The construction is divided in two cases: one for the rules which contain or in the body ( or ), and one for the rules that contain in the body or in the head ( or ).

For rules in , 1a and 1b generate the rules obtained by substituting the occurrences of or by the body of those rules whose head is and do not contain in the body (those in ). Also, 2a and 2b create the model-generating rules, one for each rule supported by (those in ), and 3a and 3b create rules of the form , one such rule for every possible partition of the bodies of rules in , which can be obtained using the as-dual construction. Each such rule also contains , and in the body, because the original rule is triggered if and are true and no other head atom but in the generating rule is true.

Now let us consider the other case (for rules in and in ). Since appears in the body of , the case 4 is based on the as-dual as discussed in Ex. 2. The idea is that can be concluded if is true and no body of a rule with head (those in and ) is true. Likewise, can be concluded if is true and there is no further evidence that is true, which again can be given by the as-dual construction. The cases 5 and 6 are similar to those of 2a, 2b and 3a, 3b. If there is cyclic support for , and each head of is true, we can justify cyclic support for the rule. For each of these rules that has no true head, we require a false body atom as evidence that the head is not true, because its body is not satisfied. Lastly, if there are multiple self-cycles on the atom that is to be forgotten, the case 7 connects them so that they are handled correctly.

Once all these rules are computed, a final normalization step is applied to remove any tautologies or irrelevant atoms in the resulting rules.

Example 4

Recall from Ex. 1. The sets and are empty and, therefore, the result of is

where the first two rules are produced by 1a, s.t.  in the body of is replaced by and , resp. The third rule is obtained by 4, which replaces in the body of by since . The result corresponds exactly to the one given in Ex. 1.

Example 5

Recall program of Ex. 2 which also uses disjunction. Since , 4 replaces in the head of , and in the body of with such elements, yielding

the result of . Note that by 4, and are not used with .

In the previous examples, no cyclic dependencies on the atom to be forgotten existed. Next, we discuss two examples that deal with this more sophisticated case.

Example 6

Consider forgetting about from the following program , an example which cannot be handled by any syntactic forgetting operator in the literature. In this case, since , and are empty, the only applicable rule is 3a. Since there is a cyclic dependency on , i.e., , the application of 3a renders the result of to be:

Thus, when forgetting about from , the cyclic dependency on is transferred to .

If there are several dependencies on though, such self-cycles also create an implicit dependency between the elements supported by (the heads of rules in ) and those supported by (the heads of rules in ). When forgetting , such dependencies must be taken into account.

Example 7

Now, consider program . The answer sets and of should be preserved (for all but ) when forgetting about , even if we add to a set of rules not containing . By distinguishing which rule heads depend on (those of ) and which on (those of ), 2a and 5 create the following model-generating rules, which guarantee that the atoms that depend on should be true whenever the atoms that depend on are false, and vice versa:

These rules alone have the two desired answer sets and , since they basically state that either the elements supported by are true, or the elements supported by are, but not both. In addition, 3a and 6 add the following rules:

The first two rules guarantee that, whenever is derivable (independently, e.g., by the existence of ), then and may both either be simultaneously true or false. Similarly, the third rule ensures that may still vary between true and false if we, e.g., add both and .

3.3 Properties

In this section, we present several properties that our syntactic operator satisfies.

First of all, we show that is in fact a forgetting operator, i.e., does not contain .

Proposition 3

Let be a program over and . Then is a program over .

In order to show that satisfies (SP) whenever this is possible, we start by showing that semantically coincides with any operator of the class (cf. Def. 4 of [Gonçalves et al. (2016b)]).

Theorem 1

Let be a program over and . For any , we have .

Since, as mentioned in Sec. 2, was shown to correspond to the class of forgetting operators that satisfy (SP) for all those cases when this is possible (cf. Thm. 4 of [Gonçalves et al. (2016b)]), Thm. 1 allows us to conclude the main result of the paper, i.e., that satisfies (SP) for all those cases when this is possible. In fact, it is the first such syntactic forgetting operator.

Theorem 2

Let be a program over and . If does not satisfy , then satisfies (SP).

This result guarantees that provides the ideal result whenever is not true.

When is true, such as in Ex. 7, although we are not in an ideal situation, it might be the case that we must forget [Gonçalves et al. (2017)]. In this case, we can use , as it is defined for every extended program, while still satisfying several desirable properties.

Property (SI) guarantees that all rules of a program not mentioning be (semantically) preserved when forgetting about from . Notably, although (SI) is a desirable property, several classes of forgetting operators in the literature fail to satisfy it. Interestingly, preserves all rules of not mentioning , thus satisfying a strong version of (SI).

Proposition 4

Let be a program over and . Then, , for all programs over .

An important property that satisfies in general is the preservation of all answer sets of (modulo ), even in the presence of an additional program not containing .

Theorem 3

Let be a program over and . Then, , for all programs over .

Obviously, whenever satisfies (SP), then we obtain equality of the two sets of answer sets in the previous result. However, when is satisfied, then we may obtain a strict superset. Take Ex. 7, where is satisfied. We can observe that the provided result does admit a third answer set besides the two itself has. But, no matter which program we add, existing answer sets are preserved. In other words, even if is satisfied, the construction of ensures that no existing answer sets (modulo the forgotten atom) are lost while forgetting.

The operator also preserves strong equivalence, i.e., forgetting the same atom from two strongly equivalent programs yields strongly equivalent results.

Proposition 5

Let and be programs over and . If then .

These positive results suggest that, in cases when we must forget, can be used without first checking , in line with the observations on the usage of in [Gonçalves et al. (2017)].

Still, we may want to find a broad class of instances for which we can guarantee that (SP) is satisfied without having to check criterion . We have seen in Ex. 7 that self-cycles on the atom to be forgotten are relevant for forgetting while satisfying (SP), a fact already observed in [Knorr and Alferes (2014)]. We now extend the notion of -forgettable given in [Knorr and Alferes (2014)] to programs with disjunction in the head of the rules.

Definition 4

Let be a program in normal form over and . Then, we say that is q-forgettable if at least one of the following conditions holds:

  • all occurrences of in are within self-cycles, rules with and

  • contains the fact

  • contains no self-cycle on , a rule with and

We can show that, when restricted to -forgettable programs, is not satisfied.

Theorem 4

Let be a program over , and . If is -forgettable, then does not satisfy .

An immediate consequence of this theorem is that, for -forgettable programs, satisfies (SP). In the case of the programs of Ex. 1 and Ex. 2, which are -forgettable, we can forget from both programs while satisfying (SP), and we can use to obtain the desired result.

The converse of Thm. 4 does not hold in general. Program of Ex. 6 is a simple counter-example, since it is not -forgettable, and does not satisfy . This is not surprising given that deciding is -complete (cf. Thm. 7 of [Gonçalves et al. (2017)]), whereas deciding if a program is -forgettable requires to check each rule once.

Proposition 6

Let be a program over , and . Deciding if is -forgettable can be done in linear time.

Besides the simplicity of checking if a program is -forgettable, the restriction to these programs implies that can be constructed using only a small subset of the derivation rules.

Theorem 5

Let be a program over , and . If is -forgettable, then is constructed using only the derivation rules 1a, 1b and 4.

We can now present the complexity result of our forgetting operator .

Theorem 6

Let be a program over and . Then, computing is in EXPTIME in the number of rules containing occurrences of and linear in the remaining rules.

This result is not surprising taking into account the arguments in [Eiter and Kern-Isberner (2019)] showing that the result of forgetting is necessarily exponential. Nevertheless, in the case of , this exponential behavior is limited to the rules mentioning the atom to be forgotten.

Besides the properties already mentioned, a fundamental characteristic of the operator is its syntactic nature, in the sense that the result of forgetting is obtained by a manipulation of the rules of the original program. As a consequence, the result of forgetting according to is somehow close to the original program. In order to formalize this idea, we define a distance function between programs. It builds on a distance measure between rules, which counts the number of literals only appearing in one of the rules.

Definition 5

Let and be two rules over . The distance between and is where is the usual symmetric difference. The size of a rule is defined as .

To extend this distance to a distance between programs, we use mappings between programs.

Definition 6

Let and be programs over . The distance between and is , where a mapping between and is a partial injective function and .

The distance between and induced by a mapping is the sum of the distances of those rules associated by , and the sizes of the remaining rules. The distance between and is then the minimal value for the possible mappings of and . Intuitively, this distance corresponds to the minimal number of literals we need to add to both programs to make them equal, noting that we may need to add new rules.

Example 8

Let and be two programs. Then,