1 Introduction
Many real-world applications have a heterogeneous nature that can only be captured by different types of constraints. This is commonly addressed by hybrid solving technology, most successfully in the area of Satisfiability modulo Theories (SMT; niolti06a niolti06a). Meanwhile, neighboring areas like Answer Set Programming (ASP; lifschitz08b lifschitz08b) follow suit. In doing so, they usually adopt the lazy approach to SMT that abstracts from specific constraints by interpreting them as opaque atoms. This integration is however often done in system-oriented ways that leave semantic aspects behind.
We first addressed this issue in [Cabalar et al.2016] by providing a uniform semantic framework that allows us to capture the integration of ASP with foreign theories. This blends the non-monotonic aspects of ASP with other formalisms in a homogeneous representational framework. Moreover, it retains the representational aspects of ASP such as expressing defaults and an easy formulation of reachability, and transfers them to the integrated theory. In [Cabalar et al.2020], we extended this to conditional aggregates, which already incurred a fraction of the aforementioned opaqueness principle. To illustrate this, consider the following hybrid ASP rule, taken from [Cabalar et al.2020]111We put dots on top of braces, viz. “”, to indicate multisets.
This rule gathers the total tax revenue of each region by summing up the tax liabilities of the region’s residents, .
The need for subatomic structures emerges from the observation that the meaning of this rule should remain unchanged, in case the computation of the revenue is expressed using, for instance, a linear constraint instead of the aggregate. However, this slight syntactic difference leads to a distinct constraint atom, whose semantics can be radically different. Only by inspecting the subatomic structure of both atoms, we can guarantee the expected behavior.
In this paper, we build an account of such abstract subatomic structures, namely constraint terms, and leverage them to provide a uniform treatment of linear constraints, conditional expressions, aggregates and similar future hybrid constructs. Furthermore, we investigate two different principles for conditional expressions: the vicious circle principle () and a new one we call definedness (). While has been investigated in traditional ASP in [Gelfond and Zhang2019], this new principle ensures that the value of any conditional expressions is always defined. This is different from according to which conditional expressions may be undefined due to cyclic dependencies [Cabalar et al.2018]. Interestingly, when combined with aggregates, the principle leads to a generalization of another semantics known from ASP [Ferraris2011], which provides the semantic underpinnings of aggregates used in the ASP system clingo [Gebser et al.2019]. Hence, for characterizing hybrid variants of clingo, this framework is a prime candidate. Moreover, we are able to show how, under certain circumstances, arithmetic aggregates (under both principles) can be mapped into conditional linear constraints under . Combined with our previous results [Cabalar et al.2016, Cabalar et al.2020], this allows us to use off-the-shelf constraint ASP (CASP; lierler14a lierler14a) solvers to implement such hybrid extensions.
2 Here-and-There with Conditional Constraints
The syntax of the logic is based on a set of (constraint) variables and constants or domain values from some non-empty set . For convenience, we also distinguish a special symbol that stands for undefined.
We introduce next what we call basic constraint terms, atoms and formulas and then extend these three concepts to incorporate conditional expressions. We define the set of elementary terms , that is, variables, domain values and the symbol . Each theory will be defined over a given set of basic (constraint) terms, denoted as , that will include, at least, all elementary terms, i.e., . The syntax of a basic term is left open, but can be any expression of infinite length. A basic (constraint) atom is an expression containing a (possibly infinite222An atom may have an infinite number of terms of infinite length. This cannot be represented as a string, but is still a expression similar, for instance, to some formula in infinitary logics.) number of basic terms. Again, for each theory, we will define with a particular set of basic constraint atoms, denoted as , but we do not impose any limitation on their syntax. In most cases, that syntax is defined by some grammar or regular pattern. For instance, difference constraint atoms are expressions of the form “”, containing the elementary terms where are variables and a domain value. Note that we are free to define the subexpression “” as a basic term or not, at our convenience, without affecting the definition of “” as a basic atom. The importance of distinguishing terms is thus not syntactic, but meta-logical: Distinguishing terms allow us guaranteeing some properties that may not be satisfied on unstructured atoms.
A basic formula over is defined as
We define as and as for every formula . We sometimes write instead of
to follow logic programming conventions.
We extend now the previous notions to incorporate conditional constructs. A conditional term is an expression of the form
where and are basic terms and is a basic formula. The intuitive reading of a conditional term is “get the value of if holds, or the value of if it does not.” Now, a (constraint) term is either a basic term, a conditional term or some (possibly infinite) expression involving basic and conditional terms. As before, a (constraint) atom is an expression involving a (possibly infinite) number of constraint terms. We denote the set of all constraint terms and atoms by and , respectively.
A formula over is defined as for a basic formula before but with being an arbitrary constraint atom rather than a basic one. Given a constraint term, atom or formula , we denote the set of variables occurring in by .
For the semantics, we start by defining the extended domain as . A valuation over is a function where represents that variable is left undefined. Moreover, if is a set of variables, valuation stands for the projection of on . A valuation can be alternatively represented as the set by what no pair is in the set. This representation allows us to use standard set inclusion for comparison. We thus write to mean that
The set of all valuations over is denoted by and dropped whenever clear from context.
We define the semantics of basic constraint atoms via denotations, which are functions , mapping each basic constraint atom to a set of valuations. For instance, each difference constraint like can be captured by a constraint atom “” whose denotation is given by the expected set:
(1) |
Satisfaction of constraint atoms involving conditional terms is defined by a previous syntactic unfolding of their conditional terms, using some interpretation to decide the truth values of formulas in conditions. Formally, an interpretation over is a pair of valuations over such that . The interpretation is total if . With this, we define next two valuation functions for conditional terms, one following the vicious cycle principle () and another ensuring the definedness of conditional terms ().
Definition 1
Given an interpretation and a conditional term , we define:
(2) | ||||
(3) |
Note that the valuation functions rely on the satisfaction relation defined below.
To illustrate the different behavior of and , take the following simple example
(4) |
stating that must have value when the conditional expression holds. We see below that this rule has no stable model under -semantics while it has a unique one with under -semantics. We face here a completely analogous situation to the following standard (non-hybrid) ASP rule with an aggregate:
(5) |
where predicate atom is playing the role of in (4). Rule (5) has the unique stable model under ferraris11a’ semantics for aggregates, which does not comply with , whereas it has no stable model333 gelzha19a’s semantics is defined exclusively for set based aggregates, but lifting it to multi-sets is straightforward. under gelzha19a’s semantics, which satisfies .
Observation 1
Given some total interpretation and any conditional term , we have .
Hence, for total interpretations, we may just write instead of and . In our running example, if is a total interpretation such that , then is . This means that to evaluate whether satisfies (4) wrt any of the two semantics, we replace the conditional expression by the domain element and, thus, evaluate whether satisfies the basic formula
(6) |
which obviously holds since we assumed . For non-total interpretations the valuation is slightly more involved, so we will resume our example after introducing the definition of the satisfaction relation.
We permit that different occurrences of conditional expressions are interpreted according to different valuate functions ( or ). A syntactic marking is assumed for distinguishing which of them is used. For instance, in formula
(7) |
we can assume that the first occurrence of , enclosed by parentheses, is evaluated with the function, while its second occurrence, enclosed by brackets, is evaluated with the function. In order to abstract from the particular syntax used to denote which evaluate function is used for each occurrence, we just assume that a semantic mapping is given. More precisely is a function mapping each occurrence of each conditional term to basic term and satisfying either or . In other words, selects whether or is used to unfold the occurrence of a conditional term and performs this unfolding with respect to the interpretation .
For a constraint atom , we define as the basic constraint atom that results from replacing each conditional term in by the basic term .
Definition 2
Given a denotation , a semantic mapping , an interpretation satisfies a formula , written , if
We say that is a -model of when . In particular, and -models are those corresponding to evaluating all conditional terms according to or , respectively. Furthermore, we may just write if is a basic formula or is total because the valuation function becomes irrelevant. Note that this is the satisfaction relation used in Definition 1 for the valuation function. In the rest of the paper, we assume a fixed underlying denotation. If not explicitly stated otherwise, we also assume a fixed underlying semantic mapping.
It is worth noting that Definition 2 differs from our previous work in [Cabalar et al.2020] in two distinct ways that are reflected in Condition 1. First, in [Cabalar et al.2020], the satisfaction relation was not parametrized and the unique valuation function was . Second, this condition only refereed to the “here” world rather than to both worlds. In other words, the satisfaction relation in [Cabalar et al.2020] can be obtained by replacing Condition 1 in Definition 2 by
The following resultstates that our semantics parametrized with the mapping actually corresponds to the semantics we introduced in [Cabalar et al.2020].
Proposition 1
Let be a formula and be some interpretation. Then, iff is a model of according to [Cabalar et al.2020].
Let us resume our running example and let be an interpretation satisfying and . Then, satisfies and, as we saw above, this implies that satisfies (4). On the other hand, we also can see that does not satisfy and, by definition, we get: iff both and . In fact, in view of Proposition 1, it is enough to check whether satisfies . That is, iff satisfies the formula
(8) |
which holds because .
A theory is a set of formulas. An interpretation is a -model of some theory , written , when holds for every .
Definition 3
A (total) interpretation is a -equilibrium model of a theory , if and there is no such that .
Valuation is also called a -stable model of a set of formulas when is an -equilibrium model of .
Continuing with our running example, it is easy to see that is not a -stable model of (4) because . The following result confirms that stable models obtained using our semantics with the mapping correspond to the stable models using the semantics in [Cabalar et al.2020].
Corollary 1
The -stable models of any theory coincide with its stable models according to [Cabalar et al.2020].
Let us now turn to the -semantics and check that is in fact a -stable model of (4). In particular, let us check that . The methodology to check that other interpretations with do not satisfy (4) is similar. First, we should note that for the -semantics, we cannot use Proposition 1 to simplify computation. Hence, we get that iff both and . The following result formalizes this intuition for the general case.
Proposition 2
Let be an interpretation and be a constraint atom.
Then, iff .
As a result, iff satisfies the formula
(9) |
which does not hold. Just note that the right hand side is a tautology and that does not satisfy because . Hence, is a -stable model of (4).
The reason why we need to check both worlds for the -semantics is to keep the persistence property of HT as stated in the following result.
Proposition 3 (Persistence)
Let and be two interpretations, and be a formula.
Then, implies .
To see that for the -semantics is not enough to check in the “here” world, consider the conditional constraint atom
(10) |
together with the interpretation satisfying and . Then, we have
because and . We then get
Persistence then holds only because satisfaction wrt an interpretation is defined by checking both worlds.
The following proposition tells us that some other usual properties of are still valid in this new extension. Let us introduce some notation first. A formula is a tautology (wrt some underlying denotation and semantic mapping) when for every interpretation . Note that, this implies that a basic constraint atom is tautologous whenever . Given any formula let denote the uniform replacement of atoms in by formulas .
Proposition 4
Let and be two interpretations, and be a formula. Then,
-
iff ,
-
If is an tautology then is an tautology.
3 Terms and assignments
As mentioned above, we impose some particular properties on terms to derive properties of interest.
To formalize these properties, we sometimes refer to a constraint atom using the notation meaning that the expression for contains some distinguished occurrence of subexpression . We further write to represent the syntactic replacement in of subexpression by . Then, we assume the following syntactic properties:
-
if is a term, then there are constraint atoms in of the form and for every domain element ,
-
if is a term, is a constraint atom and , then is also a constraint atom,
-
if are terms such that is a subexpression of and is a constraint atom, then .
Intuitively, Condition 1 states that there is some way to assign a domain element to any term and that a term can be compared with itself. We usually use as an abbreviation for as this intuitively means that is defined, that is, it has some assigned value in the domain. Conditions 2 and 3 state that replacement of terms must lead to syntactically valid expressions. Contrary to first order logic, we only require that terms can be replaced by some particular class of terms rather than all possible terms. In particular, Condition 2 implies that replacing any term by an elementary term must lead to syntactic valid expressions. Condition 3 is similar but for every term that is also a subexpression. For instance, if and are terms and is a constraint atom, then we must allow for forming constraint atoms and and among others. Note that, since is not a subexpression of , we do not require to be a constraint atom. We do not forbid it either.
These intuitions are further formalized by imposing the following semantic properties for any denotation , basic atom , basic term , domain element , variable , and any pair of valuations :
-
[start=5]
-
if for all then
iff . -
and imply ,
-
implies
-
,
-
,
-
for any with
-
if for any term , then there is some such that and
-
if , then iff ,
-
if and , then .
Condition 1 asserts that the denotation of is fixed by combinations of values for , while other variables may vary freely, consequently becoming irrelevant. Condition 2 makes constraint atoms behave monotonically. Condition 3 is the counterpart of Condition 2 for terms. Intuitively, it says that, if a constraint does not hold for some term, then it cannot hold when that term is left undefined. For instance, if we include a constraint atom , then we must allow for forming the three constraint atoms and and , too, and any valuation for the latter must also be a valuation for the former two. Conditions 4-7 states how equality atoms are evaluated. Condition 8 stipulates that denotations respect the evaluation of terms as domain values, that is, replacing a term by their assigned value does not change how an expression is evaluated. Conditions 7-8 together imply that is transitive and symmetric.
Proposition 5
Given terms , and , the following conditions hold:
-
if and , then .
-
if , then , and
-
.
In particular, Condition 3 in the above propsition implies that is not reflexive. We also have for any valuation with . The following interesting properties for can also be derived.
Observation 2
The following conditions hold:
-
for every term ,
-
for every domain element ,
-
for every ,
-
.
Finally, Condition 9 states that if a term is undefined its valuation must coincide with the result of replacing it with the undefined constant .
These conditions together imply that constraint terms behave similar to first order terms. That is, we have a recursive function that evaluates terms based on its subterms as follows:
Definition 4 (Term valuation)
Given a valuation , an interpretation and a term , we define as the following function:
where denotes the basic term that results from replacing each conditional term in by .
For a constraint atom , we denote by the constraint atom obtained by replacing each occurrence of term in by .
Proposition 6
Given a valuation , an interpretation and an atom , the following two conditions are equivalent:
In other words, we can use the term valuation to replace every term for its value in the valuation wrt the interpreation . Note that, in practice, we chose to be either or .
In the sake of simplicity, we write instead of when is basic term or is a total interpretation. Note that in these cases depends neither on nor .
Finally, we can establish some relation between the - and -semantics based on how they evaluate constraint terms.
Proposition 7
Any term and interpretation satisfy that implies .
This means that in the -semantics, if we assigns some value to term in , this value is also preserved in . Moreover, when this is the case the - and -semantics coincide. On the other hand, this preservation property is not satisfied by the -semantics. As a simple counterexample, consider the conditional term in the right hand side of inequality (10). Then, for the interpretation with and , we get that is , but is .
As mentioned in the introduction, the main motivation to introduce constraint terms is to permit a uniform treatment of different constructs. This is especially relevant for assignments [Cabalar et al.2016]. Intuitively, an assignment of the form is a directional construct meaning that variable takes the value of term .
Definition 5 (Assignment)
Given a variable and a term an assignment is an expression of the form and stands for the formula
(11) |
Recall that, in [Cabalar et al.2016], assignments were constructs where could only be a linear expression. The introduction of terms allows us to generalize the use of assignments to arbitrary terms, which as we can see in following sections includes both linear expressions and aggregates. The following result provides further intuition relating assignments with grounding in ASP.
Theorem 1
Consider a formula of the form
(12) |
where is a variable, a constraint term and a formula.
Let be the theory containing a formula of the form
(13) |
for every element in the domain.
Then, and (12) have the same -models.
In other words, an assignment on the consequent of an implication stands for (the possibly infinite grounding of) the first order formula . Of course, the advantage of assignments consists in the possibility of delegating their evaluation to specialized constraint solvers. For this, such solvers only need to be able to deal with equality constraints. This also implies that grounding is not necessary.
4 Aggregates as constraint atoms
Aggregates are expressions that represent a function that groups together a collection of expressions and produces a single value as output. For instance, the expression
(14) |
shown in the introduction sums the tax revenue of all persons that live in some region . In this section, we restrict ourselves to ground atoms, that is, atoms that may contain constraint variables but no logical variables like and . We assume that aggregate atoms with logical variables are a shorthand for their (possibly infinite) ground instantiation. For instance, (14) is a shorthand for the infinite expression of the form where each is a sequence containing a conditional term of the form for each pair of domain elements and . Intuitively, the variable is true when the person lives in the region and the variable is assigned the tax revenue of person . If is not a person, is undefined, that is, its assigned value is . As a simpler example, we have the following expression
(15) |
which holds if either holds or both and hold. More generally, we allow applying aggregates not only to numerical constants, but also to expressions involving constraint variables. For instance,
(16) |
holds whenever any of the following conditions hold:
-
and only holds,
-
and only holds, or
-
and both and hold.
We also allow aggregate operations that rely on the order of the elements in the collection. For instance, the aggregate
(17) |
expresses that is the string resulting from concatenating all strings occurring between the brackets. That is, it is only satisfied when the value assigned to is the string “En un lugar de la Mancha”.
Formally, an aggregate term is an expression of the form
(18) |
where is an operation symbol and each is a term. We say that a term is aggregate-free if it contains no aggregate terms and, in the following, we assume that each in (18) is aggregate-free. A basic aggregate term is an expression of the form of (18) where each is a basic term. We reserve the notation for aggregates whose operation is multi-set based, like , and use in general.
Definition 6 (Basic aggregate valuation)
Given a function that maps families of domain elements to domain elements. The evaluation of a basic aggregate term of the form of (18) is defined as follows
where is a function mapping each positive integer to the value .
An aggregate atom (or aggregate for short) is an expression of the form where is an aggregate term, is a relation symbol and is a basic term. We associate the symbol with some relation among elements of the domain. The denotation of a basic aggregate atom is then defined as
In particular, note that can be the equality symbol. The semantics of conditional aggregates follows directly from the evaluation of conditions introduced in the previous section.
The following result shows how the valuation of terms introduced in Definition 4 applies to the particular case of aggregate terms.
Proposition 8 (Aggregate valuation)
Given an aggregate term possibly containing conditional terms, some valuation , some interpretation and a semantic mapping , we have
where is a function mapping each positive integer to the value .
Corollary 2
Given an aggregate term (possibly with conditional terms), a valuation , some interpretation and a semantic mapping , we have:
iff for .
We say that has a neutral element if for every pair of families and positive numbers that satisfies the following three conditions:
-
for all ,
-
, and
-
for all .
Without loss of generality, we restrict ourselves to operations that have a neutral element. For every function without neutral element, one can built an equivalent function with neutral element by adding a new element to the domain.
Using neutral elements, we can consider finite aggregates as abbreviations for infinite ones. That is, a finite constraint term of the form
(19) |
is an abbreviation for the infinite term
(20) |
Treating finite aggregates as an abbreviation allows us to deal with a unique construct for any number of elements and, thus, ensure that aggregate terms with different number of elements are treated in an uniform way.
We also adopt some further conventions for multi-set based aggregates that reflect the syntax of ASP solvers. In particular, a multi-set aggregate term is an expression of the form
(21) |
where each is either a basic term or an expression of the form with a basic term and a basic formula.
Such an expression is understood as an abbreviation for an aggregate term of the form of (18) where each is as follows:
-
if is a basic term, and
-
otherwise.
This allows us to capture the behavior of modern ASP solvers. For instance, the solver clingo removes elements that are undefined from the sum aggregate and a return value can still be obtained. Now, the semantics of (15) and (16) can be formalized by defining the following function
where is a family of domain elements. For , we take the usual meaning. Obviously, the neutral element of is . Note that combining this definition with (6), we get that the sum of an aggregate term is undefined if any of its elements is undefined, otherwise, we get the sum of all integers in the sequence.
Let us illustrate the behavior of aggregates in our setting taking (15) as an example. Note that, following our convention, (15) is a short hand for the atom444We drop and from the conditions as they are tautologies.
(22) |
We see that if hold in some interpretation, then the left hand side of the inequality evaluates to and, the inequality is satisfied. On the other hand, if only hold, we get and the inequality is not satisfied. As another example, while evaluating the aggregate term
(23) |
the string “hello world” is ignored and the result is just .
Beyond arithmetic aggregates, we may also have expressions like (17), which deal with strings. We define as the empty string and as the string resulting of concatenating all string in .
5 Aggregates as conditional linear constraints
One important difference between the understanding of aggregates used in this paper and the one studied in [Cabalar et al.2020] is that the latter directly considers aggregates as abbreviations for conditional linear constraints. This viewpoint is interesting because it allows the use of off-the-shelf CASP solvers to compute aggregates with constraint variables. On the downside, this approach has two drawbacks. First, it is quite different from the usual definition of aggregates in the ASP literature, which makes it difficult to relate to existing approaches in standard (non-constraint) ASP. Second, it is more restrictive as it only permits a particular class of aggregates, namely those using the operation functions sum, count, max and min.
The definition we provide in the previous section solves these two issues, but leaves us with the question whether we can use off-the-shelf CASP solver to compute aggregates. In this section, we show that it is possible to translate sum aggregates into conditional linear constraints. Thus, affirmatively answering the above question for the -semantics. In the next section, we extend this result to an interesting class of theories under the -semantics. Aggregates with operations count, max and min can be mapped to sum ones [Alviano, Faber, and Gebser2015].
We start by reviewing the definition of conditional linear constraints from [Cabalar et al.2020], but incorporating our notion of term. A product term is either an integer , a variable or an expression of the form where is a domain element and is a variable. A finite basic linear term is either a product term or an expression of the form where each is a product term. A linear term is an expression of where each is either a finite basic linear term or a conditional term of the form with and finite basic linear terms and a basic formula. A linear constraint is a comparison of the forms , , or for linear terms and . As usual, we write and to stand for and , respectively.
We adopt some usual abbreviations. We directly replace the ‘’ symbol by (binary) ‘’ for negative constants and, when clear from the context, omit the ‘’ symbol and parentheses. We do not remove parentheses around conditional expressions. As an example, the expression stands for . Other abbreviations must be handled with care. In particular, we neither remove products of form nor replace them by (this is because may be undefined, making the product undefined).
In the rest of the paper, we assume that all integer are part of the domain, that is, . Given a valuation , the semantics of basic linear constraints is defined inductively.
The denotation of a basic linear constraint is given by
with a relation symbol among , , and . In particular, given a linear constraint of the form with , we have iff for all and .
The semantics of conditional linear constraints is immediately obtained by applying the corresponding evaluation functions. The following results show how the valuation function applies to (conditional) linear terms; and how to use this for evaluating (conditional) linear constraints.
Proposition 9 (Linear term valuation)
Let be a valuation, be an interpretation and be a linear term (possibly containing conditional terms). Then,
Corollary 3
Given an interpretation and a linear constraint (possibly containing conditional terms), we get: iff for both .
The following result shows some interesting equivalences.
Proposition 10
Given an interpretation and linear terms and the following equivalences hold:
-
iff ,
-
iff ,
-
iff ,
-
iff .
We see that with the -semantics, we can define all arithmetic relations in terms of , while we need and for the -semantics. To see that the third equivalence does not hold for the -semantics, take the interpretation with and and the atom
(24) |
Then, with being the linear term on the left hand side of (24), we get that holds despite of . Similarly, for the last equivalence take the same interpretation and the constraint
(25) |
Then, with and being the linear terms on the left and right hand side of (25), respectively, we get despite of .
Let us now show how aggregates can be translated into conditional linear constraints. First, we to introduce a new constraint atom whose intuitive meaning is that term is an integer and whose denotation is given as follows:
Definition 7 (Aggregate to linear term)
Given an aggregate term of the form (21) with , we associate the linear term where is defined as follows:
-
if is a finite basic linear term,
-
if is of the form .
For a theory , we define as the result of recursively replacing each aggregate term by in .
Furthermore, for a semantic mapping , we define the semantic mapping given as follows:
-
for every occurrence of conditional term not occurring in any aggregate term ,
-
for every occurrence of conditional term occurring in some aggregate term .
Theorem 2
For any theory , the -(stable) models of and -(stable) models of coincide.
This means that we can use the techniques developed in [Cabalar et al.2020] to compute the stable models of theories with aggregate under the -semantics.
As a first example, the aggregate (16) is translated into the linear constraint
which holds under the same conditions as (16) does. As a further example, the aggregate term (23) is translated as the linear constraint . For any integer , we get that is simply equivalent to because is a tautology. On the other hand, is equivalent to because is a contradiction. Hence, we get .
6 Logic programs
We focus now on a restricted syntax corresponding to logic programs and show that, for stratified occurrences of conditional terms, we can interchange and -semantics.
A literal is either a constraint atom or the negation of one. A rule is a formula of the form where is a either an assignment or a disjunction of literals and is a conjunction of literals called the rule’s head and body, respectively. A theory consisting exclusively of rules is called a (logic) program. Further, we adopt the following conventions. For any rule of form we let and stand for the set of all literals occurring in and , respectively. If is an assignment , we assume that contains additionally . We denote the set of positive and negative literals in by and . We also define if is an assignment and if is a constraint atom. Intuitively, designates all variables assigned by atom : Only the assigned variable is defined by an assignment and all variables in a constraint atom.
Definition 8 (Conditional term stratification)
A program is said to be stratified on (an occurrence of) a conditional term