1 Introduction
In answer set programming (Marek and Truszczynski Reference Marek and Truszczynski1999; NiemelÄ Reference Niemelä1999; Gelfond and Kahl Reference Gelfond and Kahl2014; Lifschitz Reference Lifschitz2019), two groups of rules are considered strongly equivalent if, informally speaking, they have the same meaning in any context (Lifschitz et al. Reference Lifschitz, Pearce and Valverde2001). We are interested in proving strong equivalence of programs in the input language of the grounder gringo (Gebser et al. Reference Gebser, Kaminski, Kaufmann, Lindauer, Ostrowski, Romero, Schaub and Thiele2019) by deriving rules of each program from rules of the other. The possibility of such proofs has been demonstrated for the subset of that language called mini-gringo (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019; Lifschitz Reference Lifschitz2021). Programs allowed in that subset may include comparisons, arithmetic operations, and simple choice rules, but not aggregates.
The process of proving strong equivalence uses the translation $\tau^*$ (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019, Section 6) that transforms mini-gringo rules into first-order formulas with two sorts of variables – for numerals and for arbitrary precomputed terms. If two mini-gringo programs, rewritten as sets of sentences, are equivalent in the deductive system HTA (“here-and-there with arithmetic”), then they are strongly equivalent (Lifschitz Reference Lifschitz2021, Section 4).
In this paper, $\tau^*$ is extended to a superset of mini-gringo in which the #count aggregate can be used in a limited way. The study of the strong equivalence relation between gringo programs with counting and other aggregates is important because these constructs are widely used in answer set programming, and because some properties of this relation in the presence of aggregates may seem counterintuitive. For instance, the rule
is strongly equivalent to each of the simpler rules
and
—as could be expected. But the rule
is not strongly equivalent to (2) and (3). Indeed, adding the rules
to (4) gives a program without stable models. Footnote 1
The syntax and semantics of mini-gringo rules are reviewed in Sections 2 and 3. The semantics is defined by transforming rules into infinite sets of propositional formulas (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019, Section 3) and then appealing to the propositional stable model semantics (Lifschitz Reference Lifschitz2019, Section 5.2). Adding the #count aggregate, described in Sections 4 and 5, involves stable models of infinitary propositional formulas (Truszczynski Reference Truszczynski2012, Section 2), in the spirit of the approach of Gebser et al. (Reference Gebser, Harrison, Kaminski, Lifschitz and Schaub2015). The translation $\tau^*$ is reviewed in Section 6 and extended to mini-gringo with counting in Sections 7 and 8. After providing additional background information in Section 9, we state in Section 10 three theorems expressing properties of the translation and show how the strong equivalence of rules (1)–(3) can be proved by deriving them from each other. Proofs of the theorems are given in Section 11.
2 Review: syntax of mini-gringo
The description of mini-gringo programs below uses “abstract syntax,” which disregards some details related to representing programs by strings of ASCII characters. We assume that three countably infinite sets of symbols are selected: numerals, symbolic constants, and variables. We assume that a 1-1 correspondence between numerals and integers is chosen; the numeral corresponding to an integer n is denoted by $\overline n$ . Precomputed terms are numerals, symbolic constants, and the symbols inf, sup. We assume that a total order on the set of precomputed terms is selected, with the least element inf and the greatest element sup, so that numerals are contiguous and ordered in the standard way.
Terms allowed in a mini-gringo program are formed from precomputed terms and variables using the binary operation symbols
An atom is a symbolic constant optionally followed by a tuple of terms in parentheses. A literal is an atom possibly preceded by one or two occurrences of not. A comparison is an expression of the form $t_1\prec t_2$ , where $t_1$ , $t_2$ are mini-gringo terms and $\prec$ is one of the six comparison symbols
A mini-gringo rule is an expression of the form
where
-
${Body}$ is a conjunction (possibly empty) of literals and comparisons, and
-
${Head}$ is either an atom (then (7) is a basic rule), or an atom in braces (then (7) is a choice rule), or empty (then (7) is a constraint).
A mini-gringo program is a finite set of mini-gringo rules.
3 Review: Semantics of mini-gringo
The semantics of ground terms is defined by assigning to every ground term t the finite set [t] of its values (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019, Section 3). Values of a ground term are precomputed terms. For instance,
If a term is interval-free (that is, does not contain $..$ ), then it has at most one value. For any ground terms $t_1, \dots, t_n$ , by $[t_1, \dots, t_n]$ , we denote the set of tuples $r_1, \dots, r_n$ such that $r_1 \in [t_1], \dots,$ $r_n \in [t_n]$ .
Stable models of a mini-gringo program are defined as stable models of the set of propositional formulas obtained from it by applying a syntactic transformation denoted by $\tau$ (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019, Section 3). These propositional formulas are built from precomputed atoms—atoms $p({\bf r})$ such that members of the tuple $\bf r$ are precomputed terms. Thus, every stable model is a set of precomputed atoms.
The transformation $\tau$ is defined as follows. For any ground atom $p({\bf t})$ ,
-
$\tau(p({\bf t}))$ is $\bigvee_{{\bf r} \in [{\bf t}]} p({\bf r})$ ,
-
$\tau ({not}\ p({\bf t}))$ is $\bigvee_{{\bf r} \in [{\bf t}]} \neg p({\bf r})$ , and
-
$\tau ({not}\ {not}\ p({\bf t}))$ is $\bigvee_{{\bf r} \in [{\bf t}]} \neg\neg p({\bf r})$ .
For any ground comparison $t_1 \prec t_2$ , $\tau(t_1 \prec t_2)$ is $\top$ if the relation $\prec$ holds between some $r_1$ from $[t_1]$ and some $r_2$ from $[t_2]$ , and $\bot$ otherwise. The result of applying $\tau$ to a conjunction $B_1\wedge B_2\wedge \cdots$ is $\tau(B_1)\wedge \tau(B_2)\wedge\cdots$ . If R is a ground basic rule $p({\bf t}) \leftarrow {Body}$ , then $\tau(R)$ is the propositional formula
If R is a ground choice rule $\{p({\bf t})\} \leftarrow {Body}$ then $\tau(R)$ is the propositional formula
If R is a ground constraint $\leftarrow{Body}$ then $\tau(R)$ is
For any mini-gringo program $\Pi$ , $\tau(\Pi)$ is the set of propositional formulas $\tau(R)$ for all ground rules R that can be obtained from rules of $\Pi$ by substituting precomputed terms for variables.
For example, substituting a precomputed term r for X in the choice rule
gives the ground rule $\{p(\overline 2)\} \leftarrow p(r)$ , so that $\tau$ transforms (11) into the set of all formulas of the form
4 Mini-gringo with counting: syntax
We extend the class of mini-gringo rules as follows. An aggregate element is a pair ${\bf X}:{\bf L},$ where X is a tuple of distinct variables, and $\bf L$ is a conjunction of literals and comparisons such that every member of X occurs in $\bf L$ . In mini-gringo with counting, the body of a rule is allowed to contain, besides literals and comparisons, aggregate atoms of the forms
where E is an aggregate element, and t is an interval-free term. The conjunction of aggregate atoms (12) can be written as ${count\ /}\{E\}=t$ .
A variable that occurs in a rule R is local in R if each of its occurrences is within an aggregate element, and global otherwise. A rule is pure if, for every aggregate element ${\bf X}:{\bf L}$ in its body, all variables in the tuple X are local. For example, all rules that do not contain aggregate elements are pure. The rules
and
are pure, because X is local in each of them. The rule
is not pure, because X is global. Footnote 2
A program in mini-gringo with counting, or an mgc program, is a finite set of pure rules. Allowing nonpure rules in a program would necessitate making the semantics more complicated; see Footnote 5.
An expression of the form
where $\bf X$ is a tuple of distinct variables, A is an atom, and ${Body}$ is a conjunction of literals, comparisons and aggregate atoms, can be used as shorthand for the group of three rules:
5 Mini-gringo with counting: Semantics
To define the semantics of mgc programs, we will extend the definition of $\tau$ (Section 3) to aggregate atoms (12) such that t is a ground term. Since t is interval-free, [t] is either a singleton or empty. If [t] is a singleton $\{c\}$ , then $\tau({count\ /}\{{\bf X}:{\bf L}\} \geq t)$ is defined as the infinite disjunction
and $\tau({count\ /}\{{\bf X}:{\bf L}\} \leq t)$ as the infinite conjunction
where
-
$\Delta$ ranges over finite sets of tuples of precomputed terms of the same length as X;
-
W is the list of variables that occur in $\bf L$ but do not belong to X;
-
$\bf w$ ranges over tuples of precomputed terms of the same length as W;
-
the expression ${\bf L}^{{\bf X},{\bf W}}_{\,{\bf x},\;{\bf w}}$ denotes the result of substituting $\bf x$ , $\bf w$ for all occurrences of X, W in L.
(If c is a numeral $\overline n$ then the inequalities $\overline{|\Delta|}\geq c$ , $\overline{|\Delta|}> c$ in these formulas can be written as $|\Delta|\geq n$ , $|\Delta|>n$ .) If [t] is empty, then we define
For example, the result of applying $\tau$ to the body of rule (13) is
(In this case, X is X; W is Y; $\Delta$ ranges over sets of precomputed terms; w ranges over precomputed terms.) In application to the aggregate expression
where r is a precomputed term, $\tau$ gives
(W is empty).
A rule is closed if it has no global variables. It is clear that substituting precomputed terms for all global variables in a pure rule is a closed pure rule. Footnote 3 For any mini-gringo program $\Pi$ , $\tau(\Pi)$ stands for the conjunction of the formulas $\tau(R)$ over all closed rules R that can be obtained from rules of $\Pi$ by such substitutions. Thus, $\tau(\Pi)$ is an infinitary propositional formula over the signature consisting of all precomputed atoms.
For example, $\tau$ transforms rule (13) into
where $\Delta$ ranges over sets of precomputed terms, and w ranges over precomputed terms. Rule (14) becomes
where r ranges over precomputed terms, and $\Delta$ ranges over sets of precomputed terms. The subformula $\tau(r=\overline 1..\overline{10})$ is $\top$ if r is one of the numerals $\overline 1,\dots,\overline{10}$ , and $\bot$ otherwise.
The semantics of mgc described in this section, like the semantics of aggregates proposed by Gebser et al. (Reference Gebser, Harrison, Kaminski, Lifschitz and Schaub2015), aims at modeling the behavior of the answer set solver clingo. The definition in this paper is simpler than the 2015 version, but more limited in scope, because it is does not cover aggregates other than #count. The two versions of the semantics of #count are not completely equivalent, however, because they handle infinite sets in slightly different ways. This difference does not affect safe programs and is in this sense inessential.
6 Review: Representing mini-gringo rules by formulas
The target language of the translation $\tau^*$ is a first-order language with two sorts: the sort general and its subsort integer. General variables are meant to range over arbitrary precomputed terms, and we identify them with variables used in mini-gringo rules. Integer of the second sort is meant to range over numerals (or, equivalently, integers). The signature $\sigma_0$ of the language includes
-
all precomputed terms as object constants; an object constant is assigned the sort integer iff it is a numeral;
-
the symbols $+$ , $-$ and $\times$ as binary function constants; their arguments and values have the sort integer;
-
symbols $p/n$ , where p is a symbolic constant, as n-ary predicate constants;
-
comparison symbols (6) as binary predicate constants.
An atomic formula $(p/n)({\bf t})$ can be abbreviated as $p({\bf t})$ . An atomic formula $\prec\!\!(t_1,t_2)$ , where $\prec$ is a comparison symbol, can be written as $t_1\prec t_2$ .
Lifschitz et al. (Reference Lifschitz, Lühne and Schaub2019) defined, for every mini-gringo term t, a formula ${val\,}_{t}({Z})$ that expresses, informally speaking, that Z is one of the values of t. For example, ${val\,}_{\overline 2}({Z})$ is $Z=\overline 2$ . If $\bf t$ is a tuple $t_1,\dots,t_n$ of mini-gringo terms, and $\bf Z$ is a tuple $Z_1,\dots,Z_n$ of distinct general variables, then ${val\,}_{\bf t}({\bf Z})$ stands for ${val\,}_{t_1}({Z_1}) \wedge \cdots \wedge {val\,}_{t_n}({Z_n})$ .
The translation $\tau^B$ , which transforms literals and comparisons into formulas over the signature $\sigma_0$ , is defined in that paper as follows: Footnote 4
-
$\tau^B(p({\bf t}))= \exists {\bf Z}({val\,}_{\bf t}({\bf Z}) \wedge p({\bf Z}))$ ;
-
$\tau^B({not}\ p({\bf t})) = \exists {\bf Z}({val\,}_{\bf t}({\bf Z}) \wedge \neg p({\bf Z}))$ ;
-
$\tau^B({not}\ {not}\ p({\bf t})) = \exists {\bf Z}({val\,}_{\bf t}({\bf Z}) \wedge \neg\neg p({\bf Z}))$ ;
-
$\tau^B(t_1\prec t_2) =\exists Z_1 Z_2 ({val\,}_{t_1}({Z_1}) \wedge {val\,}_{t_2}({Z_2}) \wedge Z_1\prec Z_2)$ .
Here $Z_1$ , $Z_2$ , and members of the tuple Z are fresh general variables.
The result of applying $\tau^*$ to a mini-gringo rule $H \leftarrow B_1\wedge\cdots\wedge B_n$ can be defined as the universal closure of the formula
where $B^*_i$ stands for $\tau^B(B_i)$ , and $\bf Z$ is a tuple of fresh general variables.
For example, the result of applying $\tau^*$ to choice rule (11) is
$\tau^B(p(X))$ can be further expanded into $\exists Z(Z=X \wedge p(Z))$ .
7 Extending the target language
In this section, we extend the translation $\tau^*$ to arbitrary pure rules. This more general translation produces first-order formulas over the signature $\sigma_1$ that is obtained from $\sigma_0$ by adding infinitely many predicate constants
where X and V are disjoint lists of distinct general variables, and F is a formula over $\sigma_0$ such that each of its free variables belongs to X or to V. Footnote 5 The number of arguments of each of constants (19) is greater by 1 than the length of V; all arguments are of the sort general.
If n is a positive integer, then the formula ${Atleast\ /}^{{\bf X},{\bf V}}_F({\bf V},\overline n)$ is meant to express that F holds for at least n values of X; symbolically,
where ${\bf X}_1,\dots,{\bf X}_n$ are tuples of fresh general variables. Footnote 6 For any precomputed term r, the expression $\exists_{\geq r}{\bf X} F$ will stand for
The formula ${Atmost\ /}^{{\bf X},{\bf V}}_F({\bf V},\overline n)$ is meant to express that F holds for at most n values of X; symbolically,
For any precomputed term r, the expression $\exists_{\leq r}{\bf X} F$ will stand for
The set of all sentences of the forms
will be denoted by Defs.
8 Representing pure rules by formulas
To extend the definition of $\tau^*$ reproduced in Section 6 to arbitrary pure rules, we need to say how to choose $B^*_i$ in (18) when $B_i$ includes an aggregate element ${\bf X}:{\bf L}$ . Let V be the list of global variables that occur in $\bf L$ , and let W be the list of local variables that occur in $\bf L$ but are not included in X. Then, $B^*_i$ is defined as
if $B_i$ is ${count\ /}\{{\bf X}:{\bf L}\} \geq t$ , and as
if $B_i$ is ${count\ /}\{{\bf X}:{\bf L}\} \leq t$ , where C is a fresh general variable.
For example, the result of applying $\tau^*$ to rule (13) is
(V is empty, W is Y). The result of applying $\tau^*$ to rule (14) is
(V is Y, W is empty).
For any mgc program $\Pi$ , $\tau^*(\Pi)$ stands for the conjunction of the formulas $\tau^*(R)$ for all rules R of $\Pi$ . Thus, $\tau^*(\Pi)$ is a sentence over the signature $\sigma_1$ .
9 Review: infinitary logic of here-and-there
Some of the properties of the translation $\tau^*$ discussed below refer to the deductive system of infinitary propositional logic of here-and-there (Harrison et al. Reference Harrison, Lifschitz, Pearce and Valverde2017), denoted by ${HT\ /}^\infty$ . In this section, we reproduce the definition of that system.
The derivable objects of ${HT\ /}^{\infty}$ are sequents—expressions of the form $\Gamma\Rightarrow F$ , where F is an infinitary propositional formula, and $\Gamma$ is a finite set of infinitary propositional formulas (“F under assumptions $\Gamma$ ”). To simplify notation, we write $\Gamma$ as a list. We identify a sequent of the form $\Rightarrow F$ with the formula F.
The axiom schemas of ${HT\ /}^\infty$ are
and
where $(\mathcal{H}_\alpha)_{\alpha \in A}$ is a nonempty family of sets of formulas; the disjunction in the consequent of (24) extends over all elements $(F_\alpha)_{\alpha \in A}$ of the Cartesian product of the family $(\mathcal{H}_\alpha)_{\alpha \in A}$ . The inference rules of ${HT\ /}^\infty$ are the introduction and elimination rules for the propositional connectives shown in the Table 1 above and the weakening rule
Falsity and negation are not mentioned in the axiom schemas and inference rules of ${HT\ /}^\infty$ because $\bot$ is considered shorthand for $\emptyset^\lor$ , and $\neg F$ is shorthand for $F\to\bot$ .
The set of theorems of HT $^\infty$ is the smallest set of sequents that includes the axioms of the system and is closed under the application of its inference rules. We say that formulas F and G are equivalent in HT $^\infty$ if $F\leftrightarrow G$ is a theorem of HT $^\infty$ .
The role of this deductive system is determined by the fact that two infinitary propositional formulas are strongly equivalent to each other if and only if they are equivalent in ${HT\ /}^\infty$ (Harrison et al. Reference Harrison, Lifschitz, Pearce and Valverde2017, Corollary 2).
10 Properties of the generalized translation
Informally speaking, a pure rule R has the same meaning as the sentence $\tau^*(R)$ . This claim is made precise in Theorem 1 below. The statement of the theorem refers to the infinitary propositional formulas obtained from sentences over $\sigma_1$ by applying the grounding operator gr, which is defined recursively:
-
$gr(\bot)$ is $\bot$ ;
-
if F is $\prec(t_1,t_2)$ , where $\prec$ is a comparison symbol, then gr(F) is $\top$ if the relation $\prec$ holds for the values of $t_1$ and $t_2$ , and $\bot$ otherwise;
-
if F is $p({\bf t})$ , where p is not a comparison symbol, then gr(F) is obtained from F by replacing each member of the tuple t by its value;
-
$gr(F\odot G)$ is $gr(F)\odot gr(G)$ for every binary connective $\odot$ ;
-
$gr(\forall X\,F)$ is the conjunction of the formulas $gr\left(F^X_r\right)$ over all precomputed terms r if X is a general variable, and over all numerals r if X is an integer variable;
-
$gr(\exists X\,F)$ is the disjunction of the formulas $gr\left(F^X_r\right)$ over all precomputed terms r if X is a general variable, and over all numerals r if X is an integer variable.
Thus, gr(F) is an infinitary propositional formula over the signature consisting of all atomic formulas of the form $p({\bf r})$ , where p is different from comparison symbols and $\bf r$ is a tuple of precomputed terms. Such atomic formulas will be called extended precomputed atoms. Unlike precomputed atoms, they may contain predicate symbols (19). If $\Gamma$ is a set of sentences over $\sigma_1$ , then $gr(\Gamma)$ stands for the set of formulas gr(F) for all F in $\Gamma$ .
The statement of the theorem refers also to the system ${HT\ /}^\infty$ (Section 9) extended by the axioms $gr({Defs})$ . These axioms express the meaning of predicate symbols (19).
Theorem 1 For any pure rule R, $gr(\tau^*(R))$ is equivalent to $\tau(R)$ in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ .
About mgc programs $\Pi_1$ , $\Pi_2$ we say that they are strongly equivalent to each other if $\tau(\Pi_1)$ is strongly equivalent to $\tau(\Pi_2)$ . This condition guarantees that for any mgc program $\Pi$ (and, more generally, for any logic program $\Pi$ in a similar language), $\Pi_1\cup\Pi$ has the same stable models as $\Pi_2\cup\Pi$ .
Theorem 2 mgc programs $\Pi_1$ , $\Pi_2$ are strongly equivalent to each other iff
Thus, the claim that MGC programs $\Pi_1$ , $\Pi_2$ are strongly equivalent to each other can be always established, in principle, by deriving each of the infinitary propositional formulas $gr(\tau^*(\Pi_1))$ , $gr(\tau^*(\Pi_2))$ from the other in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ . Theorem 3 below shows that in some cases such a claim can be justified by operating with finite formulas—with first-order formulas of the signature $\sigma_1$ . Instead of ${HT\ /}^\infty\!+\!gr({Defs\ /})$ , we can use the logic of here-and-there with arithmetic (Lifschitz Reference Lifschitz2021) extended by the axiom schemas Defs:
Theorem 3 For any mgc programs $\Pi_1$ , $\Pi_2$ , if the formulas $\tau^*(\Pi_1)$ and $\tau^*(\Pi_2)$ are equivalent in ${HTA}\!+\!{Defs}$ then $\Pi_1$ and $\Pi_2$ are strongly equivalent to each other.
As an example, we will use ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to verify that rules (1), (2), (3) are strongly equivalent to each other. The translation $\tau^*$ transforms these rules into the formulas
The first two formulas are equivalent to each other in intuitionistic predicate calculus with equality, which is a subsystem of ${HTA\ /}$ ; this is clear from the fact that $\tau^B(Y=\overline 1)$ stands for the formula $\exists Z_1Z_2(Z_1=Y\wedge Z_2=\overline 1\wedge Z_1=Z_2)$ , which is intuitionistically equivalent to $Y=\overline 1$ . Furthermore, (27) is intuitionistically equivalent to
Using the axiom
of ${HTA}\!+\!{Defs}$ , (29) can be transformed into the formula $\exists X\,\tau^B(p(X))\to q$ , which is intuitionistically equivalent to (28).
11 Proofs
In this section, the word “equivalent” in application to infinitary propositional formulas refers to equivalence in ${HT\ /}^\infty$ whenever the deductive system is not specified.
Lemma 1 For any tuple t of terms in the language of mini-gringo and any tuple $\bf r$ of precomputed terms of the same length, the formula $gr(val_{\bf t}({\bf r}))$ is provable in ${HT\ /}^\infty$ if ${\bf r}\in[{\bf t}]$ , and refutable otherwise.
Proof. For the case when t is a single term, the assertion of the lemma can be proved by induction (Lifschitz et al. Reference Lifschitz, Lühne and Schaub2019, Proposition 1). The general case easily follows.
The following fact is Proposition 2 by Lifschitz et al. (Reference Lifschitz, Lühne and Schaub2019).
Lemma 2 If L is a ground literal or ground comparison in the language of mini-gringo then $gr(\tau^B(L))$ is equivalent to $\tau(L)$ .
Lemma 3 Let X, V, W be disjoint lists of distinct general variables, and let A be an aggregate atom $count\{{\bf X}:{\bf L}\} \prec t$ such that every variable occurring in $\bf L$ belongs to one of these three lists, and every variable occurring in t belongs to V. For any list $\bf v$ of precomputed terms of the same length as V, the formula $\tau\left(A^{\bf V}_{\bf v}\right)$ is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to
if $\prec$ is $\geq$ , and to
if $\prec$ is $\leq$ .
Proof. Case 1: $\prec$ is $\geq$ . Formula (30) can be written as
where c ranges over precomputed terms. From Lemma 1, we see that it is equivalent to
Consider the infinitary formula obtained by grounding (22) with $\exists{\bf W}\tau^B({\bf L})$ as F. One of its conjunctive terms is
Consequently (30) is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to
Case 1.1: The set $\left[t^{\bf V}_{\bf v}\right]$ is empty. Then (32) is the empty disjunction $\bot$ ; $\tau\left(A^{\bf V}_{\bf v}\right)$ is $\bot$ as well. Case 1.2: The set $\left[t^{\bf V}_{\bf v}\right]$ is nonempty. Since t is interval-free, this set is a singleton $\{c\}$ , so that (32) is
and $\tau\left(A^{\bf V}_{\bf v}\right)$ is
Case 1.2.1: $c\leq\overline 0$ . Then (33) is $\top$ . The disjunctive term of (34) with $\Delta=\emptyset$ is the empty conjunction $\top$ , so that (34) is equivalent to $\top$ . Case 1.2.2: for all n, $c>\overline n$ . Then (33) is $\bot$ . Formula (34) is the empty disjunction $\bot$ as well. Case 1.2.3: c is a numeral $\overline n$ , $n>0$ . Then (33) is
This formula can be rewritten as
( ${\bf x}_1,\dots{\bf x}_n,{\bf w}$ range over tuples of precomputed terms). The part $\bigwedge_{i<j}\neg(gr({\bf x}_i={\bf x}_j))$ is equivalent to $\top$ if the tuples ${\bf x}_1,\dots{\bf x}_n$ are pairwise distinct, that is to say, if the cardinality of the set $\{{\bf x}_1,\dots{\bf x}_n\}$ is n; otherwise, this conjunction is equivalent to $\bot$ . Consequently (33) is equivalent to
The formula $gr\!\left((\tau^B{\bf L})^{{\bf X},{\bf V},{\bf W}}_{{\bf x},\;{\bf v},\;{\bf w}}\right)$ can be rewritten as $gr\!\left(\tau^B\left({\bf L}^{{\bf X},{\bf V},{\bf W}} _{{\bf x},\;{\bf v},\;{\bf w}}\right)\right)$ . By Lemma 2, it is equivalent to $\tau\left({\bf L}^{{\bf X},{\bf V},{\bf W}}_{{\bf x},\;{\bf v},\;{\bf w}}\right)$ , so that (33) is equivalent to
Disjunction (34) can be obtained from this disjunction by adding similar disjunctive terms with sets $\Delta$ containing more than n tuples. Since each of these disjunctive terms is stronger than some of the disjunctive terms in (35), the two disjunctions are equivalent.
Case 2: $\prec$ is $\leq$ . Formula (31) is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to
this is parallel to the argument in Case 1.
Case 2.1: The set $\left[t^{\bf V}_{\bf v}\right]$ is empty. Then (36) is the empty disjunction $\bot$ ; $\tau\left(A^{\bf V}_{\bf v}\right)$ is $\bot$ as well. Case 2.2: The set $\left[t^{\bf V}_{\bf v}\right]$ is nonempty. Since t is interval-free, this set is a singleton $\{c\}$ , so that (36) is
and $\tau\left(A^{\bf V}_{\bf v}\right)$ is
Case 2.2.1: $c<\overline 0$ . Then (37) is $\bot$ . The conjunctive term of (38) with $\Delta=\emptyset$ is $\neg\top$ , so that (38) is equivalent to $\bot$ . Case 2.2.2: for all n, $c>\overline n$ . Then (37) is $\top$ . Formula (38) is the empty conjunction $\top$ as well. Case 2.2.3: c is a numeral $\overline n$ , $n>0$ . Then (37) is
This formula can be rewritten as
The consequent $\bigvee_{i<j}gr({\bf x}_i={\bf x}_j))$ is equivalent to $\bot$ if the tuples ${\bf x}_1,\dots{\bf x}_{n+1}$ are pairwise distinct, that is to say, if the cardinality of the set $\{{\bf x}_1,\dots{\bf x}_{n+1}\}$ is $n+1$ ; otherwise this conjunction is equivalent to $\top$ . Consequently, (37) is equivalent to
and furthermore to
this is parallel to the argument in Case 1.2.3. Conjunction (38) can be obtained from this conjunction by adding similar conjunctive terms with finite sets $\Delta$ containing more than $n+1$ tuples. Since each of these conjunctive terms is weaker than some of the conjunctive terms in (39), the two conjunctions are equivalent to each other.
Proof of Theorem 1 Assume, for instance, that R is a basic rule $p({\bf t}) \leftarrow B_1\wedge\cdots\wedge B_n$ ; for choice rules and constraints the proof is similar. Then $\tau^*(R)$ is
where V is the list of global variables of R, and $B_i^*$ are the formulas defined in Section 8. It follows that $gr(\tau^*(R))$ is the conjunction of the formulas
over all tuples $\bf v$ of precomputed terms of the same length as V and all tuples $\bf r$ of precomputed terms of the same length as Z. By Lemma 1, we can conclude that $gr(\tau^*(R))$ is equivalent to the formula
Each of the formulas
$(i=1,\dots,n)$ is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to $\tau\left((B_i)^{\bf V}_{\bf v}\right)$ . Indeed, if $B_i$ is a literal or a comparison, then (40) is $gr\left(\left(\tau^B(B_i)\right)^{\bf V}_{\bf v}\right)$ , which can be also written as $gr\left(\tau^B\left((B_i)^{\bf V}_{\bf v}\right)\right)$ ; this formula is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to $\tau\left((B_i)^{\bf V}_{\bf v}\right)$ by Lemma 2. If $B_i$ is an aggregate atom then (40) is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to $\tau\left((B_i)^{\bf V}_{\bf v}\right)$ by Lemma 3. Consequently $gr(\tau^*(R))$ is equivalent in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ to
It remains to observe that instances of R are rules of the form
so that (41) is $\tau(R)$ .
Lemma 4 If an infinitary propositional formula over the set of precomputed atoms is provable in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ , then it is provable in ${HT\ /}^\infty$ .
Proof (sketch) The set $gr({Defs})$ consists of infinitary propositional formulas of the forms
and
A derivation from $gr({Defs})$ can be visualized as a tree with axioms of ${HT\ /}^\infty$ and formulas (42), (43), attached to leaves. In such a tree, modify all formulas by replacing
-
atoms ${Atleast\ /}^{{\bf X};{\bf V}}_F({\bf v},r)$ by $gr\left(\exists_{\leq r}{\bf X} F^{{\bf V}}_{\bf v}\right)$ , and
-
atoms ${Atmost\ /}^{{\bf X};{\bf V}}_F({\bf v},r)$ by $gr\left(\exists_{\geq r}{\bf X} F^{{\bf V}}_{\bf v}\right)$ .
The result is a derivation from formulas that are provable in ${HT\ /}^\infty$ . If the formula attached to the root does not contain ${Atleast\ /}^{{\bf X};{\bf V}}_F$ , ${Atmost\ /}^{{\bf X};{\bf V}}_F$ , then it is not affected by this transformation.
Proof of Theorem 2 By Theorem 1, each of the equivalences
is provable in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ . Consequently condition (25) is equivalent to the condition
By Lemma 4, (44) is equivalent to the condition
which holds if and only if $\Pi_1$ is strongly equivalent to $\Pi_2$ .
Lemma 5 If a sentence F over the signature $\sigma_1$ is provable in ${HTA}\!+\!{Defs}$ , then gr(F) is provable in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ .
Proof (sketch) For any axiom S of ${HTA\ /}$ , the formula gr(S) is provable in ${HT\ /}^\infty$ . (To be precise, axioms of ${HTA\ /}$ are sequents, and the transformation gr needs to be applied to the universal closure of the formula corresponding to S.) For any instance
of an inference rule of ${HTA\ /}$ , the formula gr(S) is derivable from $gr(S_1),\dots,gr(S_k)$ in ${HT\ /}^\infty$ . It follows that for any formula F that is derivable from Defs in ${HTA\ /}$ , the formula gr(F) is derivable from $gr({Defs})$ in ${HT\ /}^\infty$ .
Proof of Theorem 3 By Lemma 5, if the equivalence $\tau^*(\Pi_1)\leftrightarrow\tau^*(\Pi_2)$ is provable in ${HTA}\!+\!{Defs}$ then the equivalence $gr(\tau^*(\Pi_1))\leftrightarrow gr(\tau^*(\Pi_2))$ is provable in ${HT\ /}^\infty\!+\!gr({Defs\ /})$ . Then, by Theorem 2, the programs $\Pi_1$ and $\Pi_2$ are strongly equivalent.
12 Related Work
Fandinno et al. (Reference Fandinno, Nansen and Lierler2022) defined a translation similar to $\tau^*$ for an answer set programming language that is in some ways less expressive than mini-gringo with counting (no arithmetic operations), and in some ways more expressive (the #sum aggregate is allowed, besides #count). The main difference between that approach to transforming aggregate expressions into formulas and the one described above is that the former employs function symbols in the role that predicate symbols (19) play here. As discussed in Footnote 1, thinking of #count as a function may be misleading. This is apparently the reason why the adequacy of the translation due to Fandinno et al. is only guaranteed for programs without positive recursion through aggregates (Fandinno et al. Reference Fandinno, Nansen and Lierler2022, Theorem 3). This assumption is not satisfied, for instance, for program (4), (5).
The technical problems discussed in this paper are specific for the approach to aggregates implemented in the answer set solver clingo and do not appear in the same form, for instance, in the theory of the solver dlv (Faber et al. Reference Faber, Pfeifer and Leone2011). The semantics of aggregates based on the vicious circle principle (Gelfond and Zhang Reference Gelfond and Zhang2019), unlike the clingo semantics, makes rule (4) strongly equivalent to each of the rules (1)–(3).
Acknowledgments
Many thanks to Jorge Fandinno, Michael Gelfond, Yuliya Lierler, and the anonymous referees for comments on preliminary versions of this paper.