Abstract
In answer set programming, two groups of rules are considered strongly equivalent if replacing one group by the other within any program does not affect the set of stable models. Jan Heuer has designed and implemented a system that verifies strong equivalence of programs in the ASP language mini-gringo. The design is based on the syntactic transformation \(\tau ^*\) that converts mini-gringo programs into first-order formulas. Heuer’s assertion about \(\tau ^*\) that was supposed to justify this procedure turned out to be incorrect, and in this paper we propose an alternative justification for his algorithm. We show also that if \(\tau ^*\) is replaced by the simpler and more natural translation \(\nu \) then the algorithm will still produce correct results.
Access provided by Autonomous University of Puebla. Download conference paper PDF
Similar content being viewed by others
1 Introduction
In answer set programming (ASP), two groups of rules are considered strongly equivalent if replacing one group by the other within any program does not affect the set of stable models [21]. This equivalence relation has been extensively studied in the literature because of its interesting theoretical properties and its usefulness for the practice of answer set programming [1,2,3,4,5,6, 8, 10, 11, 15, 16, 19, 20, 22,23,24, 27]. Jan Heuer designed and implemented a system that verifies strong equivalence of programs in the ASP language mini-gringo. The system is described in his Bachelor Thesis [12], presented to the University of Potsdam.
The design of the system is based on the syntactic transformation \(\tau ^*\) [20], which converts mini-gringo rules and programs into first-order formulas. Mini-gringo programs \(\varPi _1\), \(\varPi _2\) are strongly equivalent whenever the formulas \(\tau ^*\varPi _1\) and \(\tau ^*\varPi _2\) can be derived from each other in the deductive system HTA (“here-and-there with arithmetic”) [17].
To use a resolution theorem prover as a proof engine for HTA, Heuer needed an additional translation that would relate HTA to a classical first-order theory. The translation that he implemented is a straightforward generalization of the process proposed by Pearce et al. [25] for propositional formulas.
Unfortunately, the claim that is supposed to justify this additional translation [12, Theorem 3] is incorrect as stated, because it disregards the existence of interpretations that treat arithmetical symbols in nonstandard ways.Footnote 1 For example, the facts \(p(2+3)\) and p(5) are strongly equivalent, but we cannot assert that they get the same truth value under any interpretation. Indeed, the expressions \(2+3\) and 5 can have different values if the symbols 2, 3, 5 and \(+\) are not interpreted as usual in arithmetic.
In this paper we show that, in spite of this difficulty, Heuer’s procedure is in fact correct. Second, we show that the procedure will produce correct results if we modify it by replacing \(\tau ^*R\) with the simpler translation \(\nu R\) when the rule R is regular [18]. The paper begins with a review of the mini-gringo language and of the target language of the translations \(\tau ^*\) and \(\nu \) (Sects. 2 and 3). The main results of this paper are stated in Sect. 4. In Sect. 5 we give examples of their use. In Sect. 6 we describe an extension HTA\(^\omega \) of the deductive system HTA, which plays an important role in our proofs of the main results.
2 Review: Programs
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 and symbolic constants. We assume that a total order on precomputed terms is chosen such that for all integers m and n, \(\overline{m} < \overline{n}\) iff \(m<n\).
Terms allowed in a mini-gringo program are formed from precomputed terms and variables using the six operation names
(the last three serve to represent integer division, remainder and intervals). 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 terms and \(\prec \) is \(=\) or one of the comparison symbols
A rule is an expression of the form \(Head \leftarrow Body \), where
-
\(Body \) is a conjunction (possibly empty) of literals and comparisons, and
-
\(Head \) is either an atom (then the rule is basic), or an atom in braces (then this is a choice rule), or empty (then this is a constraint).
A (mini-gringo) program is a finite set of rules.
The semantics of ground terms is defined by assigning to every ground term t the finite set [t] of its values [20, Section 3]. Values of a ground term are precomputed terms. For instance,
A predicate symbol is a pair p/n, where p is a symbolic constant, and n is a nonnegative integer. About a predicate symbol p/n we say that it occurs in a program \(\varPi \) if a rule of \(\varPi \) contains an atom of the form \(p(t_1,\dots ,t_n)\).
Stable models of a program are defined as stable models of the set of propositional formulas obtained from it by the syntactic transformation \(\tau \) [20, Section 3]. Atomic parts of these formulas are precomputed atoms—atoms \(p(\textbf{t})\) such that the members of \(\textbf{t}\) are precomputed terms. For example, \(\tau \) transforms the rule
into the set of formulas \(p(t)\rightarrow (q(t)\vee \lnot q(t))\) for all precomputed terms t. The rule
is transformed into \(p\rightarrow (q(\overline{0})\wedge q(\overline{1})\wedge q(\overline{2}))\). Thus stable models of mini-gringo programs are sets of precomputed atoms.
Mini-gringo programs \(\varPi _1\) and \(\varPi _2\) are strongly equivalent to each other if, for every set \(\varOmega \) of propositional combinations of precomputed atoms, \(\tau \varPi _1\cup \varOmega \) has the same stable models as \(\tau \varPi _2\cup \varOmega \).
3 Review: Two-Sorted Formulas
The target language of the translations \(\tau ^*\) [20, Section 6] and \(\nu \) [18, Sections 4, 5] is a first-order language with the sort general and its subsort integer.Footnote 2 Variables of the first sort are meant to range over arbitrary precomputed terms, and we identify them with variables used in mini-gringo rules. Variables of the second sort are meant to range over numerals (or, equivalently, integers). This is made precise in the definition of a standard interpretation at the end of this section.
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;Footnote 3
-
predicate symbols p/n as n-ary predicate constants; their arguments have the sort general;
-
comparison symbols (1) as binary predicate constants; their arguments have the sort general.
An atomic formula \((p/n)(t_1,\dots ,t_n)\) can be abbreviated as \(p(t_1,\dots ,t_n)\). An atomic formula of the form \(\prec \!\!(t_1,t_2)\), where \(\prec \) is a comparison symbol, can be written as \(t_1\prec t_2\). A conjunction of the form \(t_1\le t_2 \wedge t_2\le t_3\) can be written as \(t_1\le t_2 \le t_3\), and similarly for other chains of inequalities.
For example, the translation \(\nu \) converts rule (2) into
Rule (3) is transformed into
where N is an integer variable. The result of applying \(\nu \) to the rule
is
An interpretation of the signature \(\sigma _0\) is standard if
-
its domain of the sort general is the set of all precomputed terms;
-
its domain of the sort integer is the set of all numerals;
-
it interprets every precomputed term t as t;
-
it interprets \(\overline{m}+\overline{n}\) as \(\overline{m+n}\), and similarly for subtraction and multiplication;
-
it interprets every atomic sentence \({t_1 \prec t_2}\), where \(t_1\) and \(t_2\) are precomputed terms, as true iff the relation \(\prec \) holds for the pair \({(t_1,t_2)}\).
4 Translation \(\gamma \) and Its Properties
By \(\sigma '_0\) we denote the extension of the signature \(\sigma _0\) obtained by adding, for every predicate symbol p/n, a new n-ary predicate constant \((p/n)'\). An atomic formula \((p/n)'(\textbf{t})\) can be abbreviated as \(p'(\textbf{t})\). For the signature \(\sigma '_0\), the definition of a standard interpretation is the same as for the signature \(\sigma _0\) above.
For any formula F over the signature \(\sigma _0\), by \(F'\) we denote the formula over \(\sigma '_0\) obtained from F by replacing every occurrence of every predicate symbol p/n by \((p/n)'\).
The translation \(\gamma \), which relates logic of here-and-there with arithmetic to classical logic, maps formulas over \(\sigma _0\) to formulas over \(\sigma '_0\).Footnote 4 It is defined recursively:
-
\(\gamma F=F\) if F is atomic,
-
\(\gamma (\lnot F)=\lnot F'\),
-
\(\gamma (F\wedge G)=\gamma F \wedge \gamma G\),
-
\(\gamma (F\vee G)=\gamma F \vee \gamma G\),
-
\(\gamma (F\rightarrow G)=(\gamma F \rightarrow \gamma G)\wedge (F'\rightarrow G')\),
-
\(\gamma (\forall X\,F)=\forall X\,\gamma F\),
-
\(\gamma (\exists X\,F)=\exists X\,\gamma F\).
Our justification of Heuer’s procedure is given by Theorem 1 below. In the statement of the theorem, \(\mathcal {A}(p/n)\) stands for the formula \(\forall \textbf{X}(p(\textbf{X})\rightarrow p'(\textbf{X}))\), where \(\textbf{X}\) is an n-tuple of distinct general variables.
Theorem 1
Mini-gringo programs \(\varPi _1\), \(\varPi _2\) are strongly equivalent iff all standard interpretations of \(\sigma '_0\) satisfy the formula
where the conjunction extends over all predicate symbols p/n that occur in \(\varPi _1\) or in \(\varPi _2\).
This theorem differs from the incorrect assertion mentioned in the introduction [12, Theorem 3] by requiring the interpretations to be standard. It shows that strong equivalence between \(\varPi _1\) and \(\varPi _2\) can be established by proving formula (7) in a first-order theory such that its axioms are satisfied by all standard interpretations. This is how Heuer’s procedure operates. It translates formula (7) into the TPTP language [26] using the algorithm implemented earlier as part of the proof assistant anthem [7]. Then the theorem prover vampire [14] is invoked to find a proof.
Results similar to the theorem above are due to Lin [23] (his Theorem 1 is about strong equivalence of propositional programs), to Pearce et al. [25] (their Theorem 6(iii) is about strong equivalence of propositional formulas), and to Ferraris et al. [9] (their Theorem 9 is about strong equivalence of first-order formulas without arithmetic).
Theorem 2 below shows that the assertion of Theorem 1 will remain true if we replace \(\tau ^*\) by the simpler and more natural translation \(\nu \) when a “regular” rule [18, Section 2] is translated. (The two main distinctive features of regular rules are that they do not use function symbols / and \(\backslash \), and do not apply arithmetical operations to intervals, as in \(X\times (Y\,..\,Z)\).)
For any mini-gringo program \(\varPi \), by \(\mu \varPi \) we denote the set consisting of
-
the formulas \(\nu R\) for all rules R of \(\varPi \) that are regular [18, Section 2], and
-
the formulas \(\tau ^* R\) for all rules R of \(\varPi \) that are not regular.
The assertion of Theorem 1 will remain true if we replace \(\tau ^*\) in its statement by \(\mu \):
Theorem 2
Mini-gringo programs \(\varPi _1\), \(\varPi _2\) are strongly equivalent iff all standard interpretations of \(\sigma '_0\) satisfy the formula
where the conjunction extends over all predicate symbols p/n that occur in \(\varPi _1\) or in \(\varPi _2\).
5 Examples
Example 1
Let \(\varPi _1\) be rule (2), and let \(\varPi _2\) be the rule
Both rules are regular, so that \(\mu \varPi _1\) is (4), and \(\mu \varPi _2\) is
Then \(\gamma \mu \varPi _1\) is
which is (classically) equivalent to
\(\gamma \mu \varPi _2\) is
which is equivalent to
and furthermore to (10). Thus the consequent of (8) is in this case logically valid, and the programs are strongly equivalent by Theorem 2.
Example 2
Let \(\varPi _1\) be rule (5), and let \(\varPi _2\) be the rule
Both rules are regular, so that \(\mu \varPi _1\) is (6), and \(\mu \varPi _2\) is
Then \(\gamma \mu \varPi _1\) is
and \(\gamma \mu \varPi _2\) is
The equivalence \(\gamma \mu \varPi _1\leftrightarrow \gamma \mu \varPi _2\) is a logical consequence of the formulas
which are satisfied by all standard interpretations. The programs are strongly equivalent by Theorem 2.
In both examples above, we did not refer to the antecedent of implication (8); in each case, all standard interpretations satisfy the consequent. Strong equivalence between the program
and its first rule is a case when the presence of the antecedents in implications (7) and (8) is essential. This example is due to Lin [23, Section 2].
6 Logic of Here-and-there with Arithmetic
Proofs of Theorems 1 and 2 are derived from a lemma that refers to an extension of the deductive system HTA. This extension, denoted by HTA\(^\omega \), can be described as the result of adding a few axiom schemas and inference rules to intuitionistic logic with equality for the signature \(\sigma _0\).
The list of additional axioms includes the Hosoi axiom schema [13]
and the schema SQHT [22]
It includes also the formulas
where \(\prec \) is one of comparison symbols (1), and \(t_1\), \(t_2\) are precomputed terms that satisfy the condition \(t_1\prec t_2\);
where \(\prec \) is \(=\) or one of comparison symbols (1), and \(t_1\), \(t_2\) are precomputed terms that do not satisfy the condition \(t_1\prec t_2\); and
for all integers m, n.
The additional inference rules are “omega-rules” with infinitely many premises:
where X is a general variable, and
where N is an integer variable [6, Section 5.3].
Main Lemma. Let \(\varPi _1\), \(\varPi _2\) be mini-gringo programs, and let \(F_i\) (\(i=1,2\)) be a sentence over \(\sigma _0\) that is equivalent to \(\tau ^*\varPi _i\) in HTA\(^\omega \). Programs \(\varPi _1\), \(\varPi _2\) are strongly equivalent iff every standard model of \(\mathcal {A}\) satisfies \(\gamma F_1\leftrightarrow \gamma F_2\), where \(\mathcal {A}\) denotes the set of formulas \(\mathcal {A}(p/n)\) for all predicate symbols p/n.
Conclusion
Theorem 2 shows that Heuer’s procedure can be modified by replacing \(\tau ^*R\) with the simpler translation \(\nu R\) when the rule R is regular. We expect that this modification will make the system easier to use, and we plan to verify this conjecture in collaboration with researchers at the University of Potsdam.
Notes
- 1.
Lifschitz et al. [20] made the same mistake in their Proposition 6.
- 2.
The need to use a language with two sorts is explained by the fact that function symbols in a first-order language are supposed to represent total functions, and arithmetic operations are not defined on symbolic constants.
- 3.
The symbols / and \(\backslash \) are not included because the corresponding functions are not total on the set of integers. The symbol .. is not included because intervals do not belong to the domain of precomputed terms.
- 4.
Heuer [12, Sections 2.2.3 and 3.3] denotes this translation by \(\sigma ^*\). We switched to \(\gamma \) to avoid confusion with the symbols denoting signatures.
References
Bochman, A., Lifschitz, V.: Yet another characterization of strong equivalence. In: Technical Communications of the 27th International Conference on Logic Programming (ICLP), pp. 11–15 (2011)
Cabalar, P., Ferraris, P.: Propositional theories are strongly equivalent to logic programs. Theory Pract. Logic Program. 7, 745–759 (2007)
Chen, Y., Lin, F., Li, L.: SELP – a system for studying strong equivalence between logic programs. In: Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning, pp. 442–446 (2005)
De Jongh, D., Hendriks, L.: Characterization of strongly equivalent logic programs in intermediate logics. Theory Pract. Logic Program. 3, 259–270 (2003)
Eiter, T., Fink, M., Tompits, H., Woltran, S.: Strong and uniform equivalence in answer-set programming: characterizations and complexity results for the non-ground case. In: Proceedings of AAAI Conference on Artificial Intelligence (AAAI), pp. 695–700 (2005)
Fandinno, J., Lifschitz, V.: Omega-completeness of the logic of here-and-there and strong equivalence of logic programs. In: Proceedings of International Conference on Principles of Knowledge Representation and Reasoning (to appear) (2023)
Fandinno, J., Lifschitz, V., Lühne, P., Schaub, T.: Verifying tight logic programs with anthem and vampire. Theory Pract. Logic Program. 20, 735–750 (2020)
Ferraris, P.: On modular translations and strong equivalence. In: Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR), pp. 79–91 (2005)
Ferraris, P., Lee, J., Lifschitz, V.: Stable models and circumscription. Artif. Intell. 175, 236–263 (2011)
Harrison, A., Lifschitz, V., Pearce, D., Valverde, A.: Infinitary equilibrium logic and strong equivalence. In: Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR), pp. 398–410 (2015)
Harrison, A., Lifschitz, V., Pearce, D., Valverde, A.: Infinitary equilibrium logic and strongly equivalent logic programs. Artif. Intell. 246, 22–33 (2017)
Heuer, J.: Automated verification of equivalence properties in advanced logic programs (2020). Bachelor Thesis, University of Potsdam
Hosoi, T.: The axiomatization of the intermediate propositional systems \({S}_n\) of Gödel. J. Faculty Sci. Univ. Tokyo 13, 183–187 (1966)
Kovács, L., Voronkov, A.: First-order theorem proving and Vampire. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 1–35. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39799-8_1
Lee, J., Palla, R.: Yet another proof of the strong equivalence between propositional theories and logic programs. In: Working Notes of the Workshop on Correspondence and Equivalence for Nonmonotonic Theories (2007)
Lierler, Y., Lifschitz, V.: Termination of grounding is not preserved by strongly equivalent transformations. In: Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR) (2011)
Lifschitz, V.: Here and there with arithmetic. Theory Pract. Logic Program. 21, 735–749 (2021)
Lifschitz, V.: Transforming gringo rules into formulas in a natural way. In: Faber, W., Friedrich, G., Gebser, M., Morak, M. (eds.) JELIA 2021. LNCS (LNAI), vol. 12678, pp. 421–434. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-75775-5_28
Lifschitz, V.: Strong equivalence of logic programs with counting. Theory Pract. Logic Program. 22, 573–588 (2022)
Lifschitz, V., Lühne, P., Schaub, T.: Verifying strong equivalence of programs in the input language of gringo. In: Balduccini, M., Lierler, Y., Woltran, S. (eds.) LPNMR 2019. Lecture Notes in Computer Science, vol. 11481, pp. 270–283. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-20528-7_20
Lifschitz, V., Pearce, D., Valverde, A.: Strongly equivalent logic programs. ACM Trans. Comput. Log. 2, 526–541 (2001)
Lifschitz, V., Pearce, D., Valverde, A.: A characterization of strong equivalence for logic programs with variables. In: Baral, C., Brewka, G., Schlipf, J. (eds.) LPNMR 2007. LNCS (LNAI), vol. 4483, pp. 188–200. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-72200-7_17
Lin, F.: Reducing strong equivalence of logic programs to entailment in classical propositional logic. In: Proceedings of International Conference on Principles of Knowledge Representation and Reasoning (KR), pp. 170–176 (2002)
Lin, F., Chen, Y.: Discovering classes of strongly equivalent logic programs. In: Proceedings of International Joint Conference on Artificial Intelligence (IJCAI) (2005)
Pearce, D., Tompits, H., Woltran, S.: Characterising equilibrium logic and nested logic programs: reductions and complexity. Theory Pract. Logic Program. 9, 565–616 (2009)
Sutcliffe, G.: The TPTP problem library and associated infrastructure. J. Autom. Reason. 59(4), 483–502 (2017)
Turner, H.: Strong equivalence made easy: nested expressions and weight constraints. Theory Pract. Logic Program. 3(4–5), 609–622 (2003)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Fandinno, J., Lifschitz, V. (2023). On Heuer’s Procedure for Verifying Strong Equivalence. In: Gaggl, S., Martinez, M.V., Ortiz, M. (eds) Logics in Artificial Intelligence. JELIA 2023. Lecture Notes in Computer Science(), vol 14281. Springer, Cham. https://doi.org/10.1007/978-3-031-43619-2_18
Download citation
DOI: https://doi.org/10.1007/978-3-031-43619-2_18
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-43618-5
Online ISBN: 978-3-031-43619-2
eBook Packages: Computer ScienceComputer Science (R0)