[

[

Abstract

Modular logic programs provide a way of viewing logic programs as consisting of many independent, meaningful modules. This paper introduces first-order modular logic programs, which can capture the meaning of many answer set programs. We also introduce conservative extensions of such programs. This concept helps to identify strong relationships between modular programs as well as between traditional programs. We show how the notion of a conservative extension can be used to justify the common projection rewriting. This note is under consideration for publication in Theory and Practice of Logic Programming.

First-Order Modular Logic Programs and their Conservative Extensions]First-Order Modular Logic Programs and
their Conservative Extensions Harrison and Lierler]AMELIA HARRISON
University of Texas at Austin
and YULIYA LIERLER
University of Nebraska Omaha

1 Introduction

Answer set programming (ASP) is a prominent knowledge representation paradigm rooted in logic programming. In ASP, a software developer represents a given computational problem by a program whose answer sets (also called stable models) correspond to solutions. Then, the developer uses an answer set solver to generate stable models for the program. In this paper we show how some logic programs can be viewed as consisting of various “modules”, and how stable models of these programs can be computed by composing the stable models of the modules. We call collections of such modules first-order modular programs. To illustrate this approach consider the following two rules

(1)
(2)

Intuitively, these rules encode that the relation is the transitive closure of the relation . The empty set is the only answer set of the program composed of these rules alone. Thus, in some sense the meaning of these two rules in isolation is the same as the meaning of any program that has a single answer set that is empty. We show how we can view these rules as forming a module and use the operator SM introduced by Ferraris et al. (2011) to define a semantics that corresponds more accurately to the intuition associated with the rules above. The operator SM provides a definition of the stable model semantics for first-order logic programs that does not refer to grounding or fixpoints as does the original definition. The operator SM has proved to be an effective tool for studying the properties of logic programs with variables. Since such programs are the focus of this paper, we chose the operator SM as a technical tool here.

Modularity is essential for modeling large-scale practical applications. Yet research on modular answer set programming is at an early stage. Here we propose first-order modular programs and argue their utility for reasoning about answer set programs. We use the Hamiltonian Cycle problem as a running example to illustrate that a “modular” view of a program gives us

  • a more intuitive reading of the parts of the program;

  • the ability to incrementally develop modules or parts of a program that have stand-alone meaning and that interface with other modules via a common signature;

  • a theory for reasoning about modular rewritings of individual components with a clear picture of the overall impact of such changes.

First-order modular programs introduced here can be viewed as a generalization of propositional modular logic programs (Lierler and Truszczyński, 2013). In turn, propositional modular logic programs generalize the concept of lp-modules by Oikarinen and Janhunen (2008). ASP-FO logic (Denecker et al., 2012) is another related formalism. It is a modular formalization of generate-define-test answer set programming (Lifschitz, 2002) that allows for unrestricted interpretations as models, non-Herbrand functions, and first-order formulas in the bodies of rules. An ASP-FO theory is a set consisting of modules of three types: G-modules (G for generate), D-modules (D for define), and T-modules (T for test). In contrast, there is no notion of type among modules in the modular programs introduced here.

We also define conservative extensions for first-order modular programs. This concept is related to strong equivalence for logic programs (Lifschitz et al., 2001). If two rules are strongly equivalent, we can replace one with the other within any program and the answer sets of the resulting program will coincide with those of the original one. Conservative extensions allow us to reason about rewritings even when the rules in question have different signatures. We can justify the common projection rewriting described in Faber et al. (1999) using this concept. For example, the rule

(3)

says that every vertex must be reachable from every other vertex. This rule can be replaced with the following three rules without affecting the stable models in an “essential way”

Furthermore, this replacement is valid in the context of any program, as long as that program does not already contain either of the predicates and . Such rewritings can be justified using conservative extensions. Conservative extensions provide a theoretical justification for rewriting techniques already commonly in use. Projection is one such technique, which often improves the performance of answer set programs. Currently, these performance-enhancing rewritings are done manually. We expect the theory about conservative extensions developed here will provide a platform for automating such rewritings in the future. We note that conservative extensions are related to the notion of knowledge forgetting in Wang et al. (2014). However, that work applies only to propositional programs.

This paper is structured as follows. In Sections 2 and 3 we review traditional programs and the operator SM. In Section 4, we define first-order modular logic programs, and in Section 5 we show how they are related to traditional logic programs. Finally, in Section 6, we introduce conservative extensions and show how they can be used to justify program rewritings.

2 Review: Traditional Programs

A (traditional logic) program is a finite set of rules of the form

(4)

, where each is an atomic formula, possibly containing function symbols, variables, or the equality symbol with the restriction that atomic formulas and may not contain the equality symbol. The expression containing atomic formulas through is called the body of the rule. A rule with an empty body is called a fact. An instance of a rule  occurring in a program is a rule that can be formed by replacing all variables occurring in  with ground terms formed from function symbols and object constants occurring in . The process of grounding a traditional logic program consists of the following steps:

  1. each rule is replaced with all of its instances by substituting ground terms for variables;

  2. in each instance, every atomic formula of the form is replaced by if is the same as and by otherwise.

It is easy to see that the resulting ground program does not have equality symbols and can be viewed as a propositional program. The answer sets of a traditional program are stable models of the result of grounding , where stable models are understood as in (Ferraris, 2005).

According to (Ferraris and Lifschitz, 2005) and (Ferraris, 2005), rules of the form (4) are sufficient to capture the meaning of the choice rule construct commonly used in answer set programming. For instance, the choice rule is understood as the rule

In this paper we adopt choice rule notation. Traditional logic programs cover a substantial practical fragment of the input languages used in developing answer set programming applications.

Consider the traditional program consisting of the rule

(5)

and the facts

(6)

Grounding this program results in eight instances of (5) and the facts in (6). The only answer set of this program is

(7)

Consider the Hamiltonian Cycle problem on an undirected graph. This problem is often used to introduce answer set programming. A Hamiltonian Cycle is a subset of the set of edges in a graph that forms a cycle going though each vertex exactly once. A sample program that encodes this can be constructed by adding rules (1), (2), and (3) to the following:

(8)
(9)
(10)
(11)
(12)
(13)

Each answer set of the Hamiltonian Cycle program above corresponds to a Hamiltonian cycle of the given graph, specified by facts (8), so that the predicate in encodes these cycles. If an atom appears in an answer set it says that the edge between and is part of the subset forming the Hamiltonian cycle. Intuitively,

  • the facts in (8) define a graph instance by listing its edges, and rule (9) ensures that this relation is symmetric (since we are dealing with an undirected graph); the vertices of the graph are implicit—they are objects that occur in the edge relation;111This precludes graphs that include isolated vertices, but such vertices can be safely ignored when computing Hamiltonian cycles.

  • rule (10) says that any edge may belong to a Hamiltonian cycle;

  • rules (11) and (12) impose the restriction that no two edges in a Hamiltonian cycle may start or end at the same vertex, and rule (13) requires that each edge appears at most once in a Hamiltonian cycle (recall that and both encode the information that the edge between and is included in a Hamiltonian cycle);

  • rules (1) and (2) define a relation r (reachable) that is the transitive closure of relation in;

  • rule (3) imposes the restriction that every vertex in a Hamiltonian cycle must be reachable from every other vertex.

Groups of rules of the Hamiltonian Cycle program have clear intuitive meanings as shown above. Yet, considering these groups separately will not produce “meaningful” logic programs under the answer set semantics as discussed in the introduction. In this paper, we show how we can view each of these groups of rules as a separate module, and then use the SM operator introduced by Ferraris et al. (2011), along with a judicious choice of “intensional” and “extensional” predicates to achieve a more accurate correspondence between the intuitive reading of the groups of rules and their model-theoretic semantics.

3 Review: Operator SM

The SM operator introduced by Ferraris et al. (2011) gives a definition for the semantics of logic programs with variables different than that described in the previous section. The SM operator bypasses grounding and provides a mechanism for viewing groups of rules in a program as separate units or “modules”. Consider rule (5). Intuitively, we attach a meaning to this rule: it expresses that relation holds for a pair of objects when property  holds of the second object and some object is in relation  and relation  with the first object. A program consisting only of this rule has a single answer set that is empty, which is inadequate to capture these intuitions. Ferraris et al. (2011) partition predicate symbols of a program into two groups: “intensional” and “extensional”. If the predicate is the only intensional predicate in rule (5), then the SM operator captures the intuitive meaning of this rule seen as a program.

We now review the operator SM following (Ferraris et al., 2011). The symbols and are viewed as primitives. The formulas and are abbreviations for and , respectively. If and are predicate symbols of arity  then is an abbreviation for the formula where is a tuple of variables of length . If and are tuples and of predicate symbols then is an abbreviation for the conjunction

and is an abbreviation for We apply the same notation to tuples of predicate variables in second-order logic formulas. If is a tuple of predicate symbols (not including equality), and is a first-order sentence then SM (called the stable model operator with intensional predicates ) denotes the second-order sentence

where is a tuple of distinct predicate variables , and is defined recursively:

  • is for any tuple of terms;

  • is for any atomic formula that does not contain members of p;

  • is ;

  • is ;

  • is ;

  • is ;

  • is .

Note that if is the empty tuple then SM is equivalent to . For intuitions regarding the definition of the SM operator we direct the reader to (Ferraris et al., 2011, Sections 2.3, 2.4).

A signature is a set of function and predicate symbols. A function symbol of arity 0 is an object constant. For an interpretation  over signature and a function symbol (or, predicate symbol) from by we denote a function (or, relation) assigned to by . Let and be signatures so that . For interpretation over , by we denote the interpretation over constructed from so that for every function or predicate symbol in , .

By we denote the the set of all function and predicate symbols occurring in formula (not including equality). We will call this the signature of . An interpretation over is a -stable model of if it satisfies SM, where p is a tuple of predicates from . We will sometimes refer to -stable models where denotes a set rather than a tuple of predicates. Since the cardinality of will always be finite, the meaning should be clear. It is easy to see that any -stable model of is also a model of . Similarly, it is clear that for any interpretation , if is a -stable model of then satisfies SM. We may refer to such an interpretation as a -stable model as well.

From this point on, we view logic program rules as alternative notation for particular types of first-order sentences. For example, rule (5) is seen as an abbreviation for the first-order sentence

(14)

Similarly, we understand the Hamiltonian Cycle program presented in Section 2 as an abbreviation for the conjunction of the following formulas

(15)

where are object constants and are variables.222In logic programming it is customary to use uppercase letters to denote variables. In the literature on logic it is the specific letter used that indicates whether a symbol is an object constant or a variable (with letters drawn from the beginning of the alphabet typically used for the former and letters from the end of the alphabet for the latter). We utilize both of these traditions depending on the context.

Let denote sentence (14). We now illustrate the definition of -stable models. If is the only intensional predicate occurring in then is

and SM is

This second-order sentence is equivalent to the first-order sentence

which reflects the intuitive meaning of the rule (5) seen as a program.

By we denote the set of all predicate symbols (excluding equality) occurring in . The following theorem is slight generalization of Theorem 1 from (Ferraris et al., 2011) as we consider quantifier-free formulas that may contain equality.

Theorem 1

Let be a traditional logic program. If contains at least one object constant then for any Herbrand interpretation of the following conditions are equivalent

  • is an answer set of ;

  • is a -stable model of .

This theorem illustrates that the set of Herbrand -stable models of program (15) coincide with the set of its answer sets.

4 Modular Logic Programs

In this section, we introduce first-order modular logic programs, which are similar to the propositional modular logic programs introduced in (Lierler and Truszczyński, 2013). In a nutshell, a first-order modular logic program is a collection of logic programs, where the SM operator is used to compute models of each individual logic program in the collection. The semantics of a modular program is computed by finding the “intersection” of the interpretations that are models of its components. We call any formula of the form SM, where is a tuple of predicate symbols and is traditional logic program viewed as a first-order formula, a defining module (of in ) or a def-module. A first-order modular logic program (or, modular program) is a finite set of def-modules

Let be a modular program. By we denote the set

called the signature of . We say that an interpretation over the signature is a stable model of modular program if for every def-module SM in , is a -stable model of .

Let and  stand for formulas

(16)
(17)
(18)

respectively. Consider a modular program consisting of four def-modules

(19)

where is defined as in the previous section. The Herbrand interpretation (7) is a stable model of this modular program.

The stable models of modular program (19) coincide with the -stable models of

(20)

Recall that can be viewed as the logic program consisting of the facts (6) and the rule (5). By Theorem 1, the Herbrand -stable models of (20) coincide with the answer sets of the logic program composed of rules in (5) and (6). These facts hint at the close relationship between modular logic programs and traditional logic programs as written by answer set programming practitioners. In the following, we formalize the relationship between modular logic programs and traditional logic programs. This formalization is rooted in prior work on splitting logic programs from Ferraris et al. (2009).

5 Relating Modular Programs and Traditional Programs

As mentioned earlier, we view a traditional logic program as an abbreviation for a first-order sentence formed as a conjunction of formulas of the form

(21)

which corresponds to rule (4). The symbol denotes universal closure. We call the disjunction in the consequent of a rule (21) its head, and the conjunction in the antecedent its body. The conjunction constitutes the positive part of the body. It is sometimes convenient to abbreviate the body of a rule with the letter and represent rule (21) as

(22)

Let denote a modular program. By we denote the set

called the predicate signature of . Similarly, by we denote the set

called the intensional signature of . By we denote the formula

A modular program is called simple when for every def-module , every predicate symbol occurring in the head of a rule in occurs also in the tuple . For instance, modular program (19) is simple. We note that this restriction is, in a sense, inessential. Indeed, consider a def-module that is not simple. There is a straightforward syntactic transformation that can be performed on each rule in , resulting in a formula such that is equivalent to . Let  be a rule of the form (22) and p be a tuple of predicate symbols. By we denote the universal closure of the following formula

In other words, any atomic formula in the head of a rule whose predicate symbol is not in p is moved to the body of the rule and preceded by negation. For a traditional logic program , is the conjunction of formulas obtained by applying  to each rule in . Theorem 5 from Ferraris et al. (2011) shows that if the equivalence between any two first-order formulas can be derived intuitionistically from the law of excluded middle formulas for all extensional predicates occurring in those formulas, then they have the same stable models. The following observation is a consequence of that theorem.

Observation 1

For a traditional logic program def-modules and are equivalent.

For any simple modular program , the dependency graph of , denoted , is a directed graph that

  • has all members of the intensional signature as its vertices, and

  • has an edge from to if there is a def-module containing a rule with occurring in the head and  occurring in the positive part of the body.

For instance, the dependency graph of simple modular program (19) consists of four vertices and edges from to , from to , and from to . It is easy to see that this graph has four strongly connected components, each consisting of a single vertex.

We call a simple modular program coherent if

  1. for every pair of distinct def-modules and in , tuples , and

  2. for every strongly connected component in the dependency graph of there is a def-module such that contains all vertices in .

It is easy to see, for example, that modular program (19) is coherent.

The following theorem is similar to the Splitting Theorem from Ferraris et al. (2009). That theorem says that under certain conditions the stable models of a conjunction of two formulas coincide with those interpretations that are stable models of both individual formulas with respect to different sets of intensional predicates. The theorem below presents a similar result for coherent programs and is more general in the sense that it applies to any finite number of def-modules, rather than just two.

Theorem 2 (Splitting Theorem)

If is a coherent modular program then an interpretation is an -stable model of iff it is a stable model of .

Since modular program (19) is coherent, it is not by chance that its stable models coincide with the Herbrand -stable models of (20). Rather, this is an instance of a general fact. The following theorem, which follows from Theorems 1 and 2, describes the relationship between modular programs and traditional logic programs.

Theorem 3

For a coherent modular program such that contains at least one object constant and and any Herbrand interpretation of the following conditions are equivalent

  • is an answer set of ;

  • is a stable model of .

A modular program is an example of a non-coherent program. Consider the Herbrand interpretation . This interpretation is a stable model of this program. Yet, it is not an answer set of the traditional program consisting of the two rules and The only answer set of this traditional program is the empty set.

We now illustrate how modular programs capture the encoding (15) of the Hamiltonian Cycle so that each of its modules carries its intuitive meaning. The Hamiltonian Cycle modular program presented below consists of five def-modules:

(23)
(24)
(25)
(26)
(27)

We call this modular program .

edge

in

r

Figure 1: Dependency graph for .

The def-modules shown above correspond to the intuitive groupings of rules of the Hamiltonian Cycle encoding discussed in Section 2.

  • An edge-stable model of def-module (23) is any interpretation over such that the extension333The extension of a predicate in an interpretation is the set of tuples that satisfy the predicate in that interpretation. of the predicate in corresponds to the symmetric closure of the facts in (8).

  • An in-stable model of def-module (24) is any interpretation over such that the extension of the predicate in is a subset of the extension of the predicate in .

  • An -stable model of def-module (25) is any interpretation over that satisfies the conjunction in (25).

  • An -stable model of def-module (26) is any interpretation over , where relation r is the transitive closure of relation in.

  • An -stable model of def-module (27) is any interpretation over that satisfies the conjunction in (27).

Any interpretation over that satisfies the conditions imposed by every individual module of is a stable model of .

The dependency graph of is shown in Figure 1. The strongly connected components of this graph each consist of a single vertex. It is easy to verify that the Hamiltonian Cycle program is coherent. By Theorem 3, it follows that the Herbrand models of Hamiltonian Cycle coincide with the answer sets of (15) so that answer set solvers can be used to find these models.

Arguably, when answer set practitioners develop their applications they intuitively associate meaning with components of the program. We believe that modular programs as introduced here provide us with a suitable model for understanding the meaning of components of the program.

6 Conservative Extensions

In this section, we study the question of how to formalize common rewriting techniques used in answer set programming, such as projection, and argue their correctness.

Let and be second-order formulas such that and both formulas share the same function symbols. We say that  is a conservative extension of if

  • and

  • there are no distinct models and of such that .

The definition of a conservative extension for second-order formulas gives us a definition of a conservative extension for def-modules, as they are second-order formulas. It is interesting to note that the first condition of the definition holds if and only if has the same models as the second-order formula where The second condition adds another intuitive restriction. For example, consider the broadly used Tseitin transformation. In this transformation, an arbitrary propositional formula is converted into conjunctive normal form by (i) augmenting the original formula with “explicit definitions” and (ii) applying equivalent transformations. The resulting formula is of a new signature, but both of the conditions of the definition hold between the original formula and the result of Tseitin transformation. We can state the definition of a conservative extension more concisely by saying that is a conservative extension of if is a 1-1 correspondence between the models of and the models of .

In view of Theorem 1, the definition of a conservative extension can be applied to traditional logic programs: If and are traditional programs such that and both programs share the same function symbols, then is a conservative extension of if is a 1-1 correspondence between the answer sets of and the answer sets of .

As an illustration of a conservative extension, consider the following formulas:

(28)
(29)

It is easy to verify that the models of formulas (28) and (29) are in 1-1 correspondence so that

In fact, formula (29) is obtained from formula (28) by introducing an explicit definition using predicate symbol . Recall the notion of an explicit definition: to extend a formula by an explicit definition using predicate symbol means to add to the signature of a new predicate symbol of arity , and to add a conjunctive term to  of the form

(30)

where are distinct variables and is a formula over the signature of . The result of adding such a definition is a formula that is a conservative extension of . Furthermore, constructing a formula from by

  • substituting every occurrence of subformula in with (modulo proper substitution of terms) and

  • extending this formula with a conjunctive term (30)

results in a conservative extension as well. This is the procedure that is used to obtain formula (29) from (28).

Recall that denotes sentence (14). By we denote the sentence

(31)

It can be verified that (28) is equivalent to SM and that (29) is equivalent to

The next proposition provides a general method for showing that one def-module is a conservative extension of another.

Proposition 1

For any def-modules SM and SM such that , both formulas share the same function symbols, and is a subset of predicate symbols , if SM and SM are equivalent to first-order formulas and respectively, and is a conservative extension of then SM is a conservative extension of SM .

An analogous property holds for traditional programs:

Proposition 2

For any traditional programs and such that and both programs share the same function symbols and contain at least one object constant, if SM and SM are equivalent to first-order formulas and respectively, and is a conservative extension of , then traditional program is a conservative extension of .

We now lift the definition of a conservative extension to the case of modular programs. We say that modular program is a conservative extension of if is a 1-1 correspondence between the models of and the models of .

Let us recall the notion of strong equivalence (Lifschitz et al., 2001). Traditional programs and  are strongly equivalent if for every traditional program , programs and have the same answer sets. Strong equivalence can be used to argue the correctness of some program rewritings used by answer set programming practitioners. However, the projection rewriting technique, exemplified by replacing rule (14) with rules (31), cannot be justified using the notion of strong equivalence. This rewriting technique is commonly used to improve the performance of answer set programs (Buddenhagen and Lierler, 2015). Strong equivalence is inappropriate for justifying this rewriting for a simple reason: the signature of the original program is changed. In what follows we attempt to “adjust” the notion of strong equivalence to the context of modular programs so that we may formally reason about the correctness of projection and other similar rewriting techniques. We then translate these notions to the realm of traditional programs. We start by restating the definition of strong equivalence given in (Ferraris et al., 2011) and recalling some of its properties.

First-order formulas and are strongly equivalent if for any formula , any occurrence of  in , and any list  of distinct predicate constants, SM is equivalent to SM, where is obtained from by replacing by . In (Lifschitz et al., 2007) the authors show that first-order formulas and  are strongly equivalent if they are intuitionistically equivalent.

The following theorem, which is easy to verify, illustrates that classical equivalence between second-order formulas is sufficient to capture the condition of “strong equivalence” for modular programs. In other words, replacing a def-module by an equivalent def-module with the same intensional predicates does not change the semantics of a modular program.

Theorem 4

Let SM and SM be def-modules. Then the following two conditions are equivalent:

  1. for any modular program , the programs and have the same stable models;

  2. SM and SM are equivalent.

In (Ferraris et al., 2011, Section 5.2), the authors observe that if first-order formulas and are strongly equivalent then def-modules of the form SM and SM are equivalent. Consequently, to show that replacing SM by SM in any modular program results in a program with the same models it is sufficient to prove that and are intuitionistically equivalent.

The following theorem lifts Theorem 4 to conservative extensions.

Theorem 5

Let SM, SM be def-modules such that , both formulas share the same function symbols, and is . Then the following two conditions are equivalent:

  1. for any modular program such that contains no elements from , modular program is a conservative extension of ;

  2. SM is a conservative extension of SM.

Theorem 5 tells us that we can replace def-modules in a modular program with their conservative extensions and are guaranteed to obtain a conservative extension of the original modular program. Thus, conservative extensions of def-modules allow us to establish something similar to strong equivalence for modular programs with possibly different signatures.

For example, consider the choice rule , a shorthand for the rule . In some answer set programming dialects double negation is not allowed in the body of a rule. It is then common to simulate a choice rule as above by introducing an auxiliary atom and using the rules and . It is easy to check that SM is a conservative extension of SM. By Theorem 5, it follows that we can replace the latter with the former within the context of any modular program not containing the predicate symbol , and get a conservative extension of the original program.

Proposition 1 and Theorem 5 equip us with a method for establishing the correctness of program rewritings. For instance, the fact that formulas (28) and (29) are equivalent to def-modules SM and respectively, translates into the assertion that the latter is a conservative extension of the former. Thus, replacing def-module SM in modular program (19) with results in a modular program that is a conservative extension of (19). Similarly, replacing def-module (27) in the Hamiltonian Cycle modular program presented in Section 5 by the def-module

(32)

results in a conservative extension of the original program. This is an instance of projection rewriting. We now introduce some notation used to state a result about the general case of projection that will support our claim that (32) is a conservative extension of (27).

Let  be a rule (21) occurring in a traditional logic program , and let x be a non-empty tuple of variables occurring only in the body of . By we denote the conjunction of all conjunctive terms in the body of  that contain at least one variable from x, where y denotes all the variables occurring in these conjunctive terms but not occurring in x. By we denote the set of all conjunctive terms in the body of  that do not contain any variables occurring in . By we denote the head of . Let be a predicate symbol that does not occur in . Then the result of projecting variables  out of  using predicate symbol is the conjunction of the following two rules

For example, the result of projecting out of (14) using predicate symbol is (31). We can project variables out of a traditional logic program by successively projecting variables out of rules. For example, first projecting out of the traditional logic program in (27) and then projecting out of the first rule of the resulting program yields the traditional logic program in (32).

Theorem 6

Let SM be a def-module and  be a rule in . Let x denote a non-empty tuple of variables occurring in the body of , but not in the head. If  is constructed from by replacing  in  with the result of projecting variables out of  using a predicate symbol  that is not in the signature of , then SM is a conservative extension of SM.

We now restate Theorem 6 in terms of traditional logic programs using the link between def-modules and traditional programs established in Theorem 1.

Corollary 1

Let be a traditional logic program containing at least one object constant and  be a rule in . Let x denote a non-empty tuple of variables occurring in the body of , but not in the head. If is constructed from by replacing  in with the result of projecting variables  out of  using a predicate symbol that does not occur in , then is a conservative extension of .

7 Conclusion

In this paper, we introduced first-order modular logic programs that provide a way of viewing logic programs as consisting of many independent, meaningful modules. We also defined conservative extensions, which like strong equivalence for traditional programs, can be useful for reasoning about traditional programs and modular programs. We showed how these concepts may be used to justify the common projection rewriting.

Acknowledgments

Many thanks to Joshua Irvin, Vladimir Lifschitz, and Miroslaw Truszczynski for useful discussions regarding ideas in this paper. Thanks as well to the anonymous referees for helpful comments. Amelia Harrison was partially supported by the National Science Foundation under Grant IIS-1422455.

References

  • Buddenhagen and Lierler (2015) Buddenhagen, M. and Lierler, Y. (2015). Performance tuning in answer set programming. In Logic Programming and Nonmonotonic Reasoning - 13th International Conference, LPNMR 2015, Lexington, KY, USA, September 27-30, 2015. Proceedings, pages 186–198.
  • Denecker et al. (2012) Denecker, M., Lierler, Y., Truszczynski, M., and Vennekens, J. (2012). A tarskian informal semantics for answer set programming.
  • Faber et al. (1999) Faber, W., Leone, N., Mateis, C., and Pfeifer, G. (1999). Using database optimization techniques for nonmonotonic reasoning. pages 135–139.
  • Ferraris (2005) Ferraris, P. (2005). Answer sets for propositional theories. In Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR), pages 119–131.
  • Ferraris et al. (2011) Ferraris, P., Lee, J., and Lifschitz, V. (2011). Stable models and circumscription. Artificial Intelligence, 175:236–263.
  • Ferraris et al. (2009) Ferraris, P., Lee, J., Lifschitz, V., and Palla, R. (2009). Symmetric splitting in the general theory of stable models. In Proceedings of International Joint Conference on Artificial Intelligence (IJCAI), pages 797–803.
  • Ferraris and Lifschitz (2005) Ferraris, P. and Lifschitz, V. (2005). Weight constraints as nested expressions. Theory and Practice of Logic Programming, 5(1–2):45–74.
  • Lierler and Truszczyński (2013) Lierler, Y. and Truszczyński, M. (2013). Modular answer set solving. In Proceedings of the 27th AAAI Conference on Artificial Intelligence.
  • Lifschitz (2002) Lifschitz, V. (2002). Answer set programming and plan generation. Artificial Intelligence, 138:39–54.
  • Lifschitz et al. (2001) Lifschitz, V., Pearce, D., and Valverde, A. (2001). Strongly equivalent logic programs. ACM Transactions on Computational Logic, 2:526–541.
  • Lifschitz et al. (2007) Lifschitz, V., Pearce, D., and Valverde, A. (2007). A characterization of strong equivalence for logic programs with variables. In Procedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR), pages 188–200.
  • Oikarinen and Janhunen (2008) Oikarinen, E. and Janhunen, T. (2008). Achieving compositionality of the stable model semantics for Smodels programs. Theory and Practice of Logic Programming, 5–6:717–761.
  • Wang et al. (2014) Wang, Y., Zhang, Y., Zhou, Y., and Zhang, M. (2014). Knowledge forgetting in answer set programming. Journal of Artificial Intelligence Research, 50(1):31–70.

Appendix A Appendix: Proofs of Theorems

a.1 Proof of Splitting Theorem (Theorem 2)

Splitting Theorem. If is a coherent modular program then an interpretation is an -stable model of iff it is a stable model of .

{proof}

Let be . The proof is by induction on . The base case is trivial. In the induction step, we assume that for any simple modular program of the form

and meeting conditions (i) and (ii) of a coherent program, is a stable model of iff it is an -stable model of . Consider a simple modular program

meeting conditions (i) and (ii). Let denote the set . Now, an interpretation is an -stable model of iff it satisfies the formula

But by the Splitting Theorem from (Ferraris et al., 2009), this is the case iff satisfies

(33)

which is true iff satisfies both conjunctive terms. But satisfies

iff it is an -stable model of , and by the induction hypothesis, this is the case iff is a stable model of . Interpretation is a stable model of iff it satisfies SM for . So satisfies (33) iff it satisfies SM for , which is the case iff is a stable model of .

a.2 Proofs of Propositions 1 and 2

Proposition 1. For any def-modules SM and SM such that , both formulas share the same function symbols, and is a subset of predicate symbols , if SM and SM are equivalent to first-order formulas and respectively, and is a conservative extension of , then SM is a conservative extension of SM.

{proof}

Consider def-modules SM and SM and first-order formulas and , meeting the conditions of the proposition. Then first-order formula has the same models as SM , and first-order formula has the same models as SM. Furthermore, since is a conservative extension of , is a 1-1 correspondence between the models of and the models of . It follows that this function is also a 1-1 correspondence between the models of SM and SM.

The same reasoning shows that Proposition 2 holds

a.3 Proof of Theorem 5

Theorem 5. Let SM, SM be def-modules such that , both formulas share the same function symbols, and is , then the following two conditions are equivalent

  1. for any modular program such that contains no elements from , modular programs is a conservative extension of .

  2. SM is a conservative extension of SM.

{proof}

Establishing that if condition (i) holds then condition (ii) also holds is not difficult. In the other direction, assume SM is a conservative extension of SM . We need to show that for any modular program such that does not contain any elements of , is a conservative extension of . Let be a model of . Then

  1. is a model of SM and

  2. is a model of each def-module SM in .

By our initial assumption, can be extended to the signature . That is, there is some such that and is a model of SM. Furthermore, there is a unique about which the above property holds (recall the condition on 1-1 correspondence). Since the signature of differs from the signature of only by predicates in , and that none of these predicates occur in the signature of , is an interpretation over . Furthermore, it is clear that this interpretation is a model of . Finally, it is easy to show that if is a model of then is a model of . From the uniqueness of the 1-1 correspondence condition of the definition of conservative extensions for modular programs also holds.

a.4 Proof of Theorem 6

Theorem 6. Let SM be a def-module and be a rule in so that x denotes a non-empty tuple of variables occurring in atoms in the body of , but not in the head. Let formula be constructed from by replacing  in with the result of projecting variables out of  using predicate symbol not in the signature of . Then SM is a conservative extension of SM. {proof} By the definition of projection, formula is constructed from by replacing rule  in of the form (21) with rules

(34)

and

(35)

where we assume the notation introduced in the end of Section 6. Consider minimizing the scope of the quantifiers in rule  as follows

(36)

The transformation from  to (36) is an intuitionistically equivalent transformation. Thus  and (36) are strongly equivalent formulas. Let denote the result of replacing  in by (36). Since  and (36) are strongly equivalent, it follows that SM and SM are equivalent second-order formulas. Similarly, we can minimize the scope of the quantifiers in (35) which will result in the following rule

(37)

Since the transformation from (35) to (37) is intuitionistically equivalent, it follows that

is equivalent to

(38)

where is the conjunction of rules in other than . It is sufficient to show that (38) is a conservative extension of SM. Let be a model of SM. We will show that we can construct an interpretation that coincides with on the symbols in and is a model of (38). We construct