<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Recursive Aggregates as Intensional Functions⋆</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jorge Fandinno</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zachary Hansen</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Nebraska Omaha</institution>
          ,
          <addr-line>NE</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Recently, it was shown how to translate logic programs with aggregates into first-order formulas. In combination with the SM operator, this translation can be used to describe the ASP-Core-2 semantics for this class of programs without relying on grounding. In this paper we prove that this same translation can be used to describe the semantics used by the answer set solver clingo when we interpret functions in an intensional way. We also state a similar conjecture regarding the semantics used by the answer set solver dlv. Recall that these solvers extend the ASP-Core-2 semantics to programs that contain recursive aggregates. If this last conjecture is correct, the interpretation of aggregates used by clingo and dlv are exactly the same and the diference in their behaviour arises only from the diferent interpretations of implication (and negation).</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Answer Set Programming</kwd>
        <kwd>Aggregates</kwd>
        <kwd>First-order formalization</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Answer set programming (ASP) is a form of declarative logic programming well-suited to solving
knowledge-intensive search and optimization problems [1]. Its success relies on the combination
of a rich knowledge representation language with eficient solvers. Some of the most useful
constructs of this language are aggregates: intuitively, these are functions that apply to sets. The
semantics of aggregates have been extensively studied in the literature [2, 3, 4, 5, 6, 7, 8, 9, 10]. In
most cases, papers rely on the idea of grounding — a process in which all variables are replaced
by variable-free terms. Thus, first a program with variables is transformed into a propositional
program, then the semantics of the propositional program are defined. This makes reasoning
about programs with variables cumbersome. For instance, it prohibits using first-order theorem
provers for verifying properties of programs as advocated by Fandinno et al. [11].</p>
      <p>Though there are several approaches to describe the semantics of aggregates that bypass the
need for grounding, most of these approaches only allow a restricted class of aggregates [12, 13]
or use some extension of the logical language [14, 15, 16, 17]. Recently, Fandinno et al. [18]
showed how to translate logic programs with aggregates into first-formulas, which, after the
application of the SM operator [19] to the result, captures the ASP-Core-2 semantics. Recall
that the ASP-Core-2 semantics do not allow recursion through aggregates. Despite the fact that
most practical problems can be represented within the restrictions of the ASP-Core-2 semantics,
there are some notable execptions that are more naturally represented using recursive aggregates.
One of these examples is the Company Control problem, which consists of finding companies
that control other companies by (directly or indirectly) owning a majority of its shares. This
problem has been encoded in the literature using the following logic program [4, 7, 20, 21, 22]:
ctrStk(C1,C1,C2,P) :- ownsStk(C1,C2,P).
ctrStk(C1,C2,C3,P) :- controls(C1,C2), ownsStk(C2,C3,P).</p>
      <p>
        controls(C1,C3) :- company(C1), company(C3),
#sum{P,C2 : ctrStk(C1,C2,C3,P)} &gt; 50.
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
where ownsStk(C1,C2,P) means that company C1 directly owns P% of the shares of
company C2; ctrStk(C1,C2,C3,P) means that company C1 controls P% of the shares of
company C3 through company C2 that it controls; and controls(C1,C3) means that company C1
controls company C3. Another area where allowing recursive aggregates is important is in
the study of strong equivalence [23, 24]. Recall that the strong equivalence problem consists
of determining whether two programs have the same behaviour in any context. Here, even if
the program we are analyzing does not contain recursion, augmenting it by some context may
introduce recursion.
      </p>
      <p>In this paper, we show that the translation introduced by Fandinno et al. [18] can also
be used for programs with recursive aggregates if we interpret functions in an intensional
way [25, 26, 27, 28]. In particular, we focus on the Abstract Gringo [29] generalization of the
semantics by Ferraris [6], which is used in the answer set solver clingo, and the semantics
by Faber et al. [7], which is used in the answer set solver dlv. More precisely, we prove that the
translation introduced by Fandinno et al. [18] coincides with the Abstract Gringo semantics when
we interpret the function symbols representing sets according to the semantics for intensional
functions by Bartholomew and Lee [28]. For the semantics used by dlv, we introduce a variation
of these semantics for intensional functions based on the FLPT semantics [14] and state a similar
conjecture, which is matter of ongoing study.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Preliminaries</title>
      <p>Syntax of programs with aggregates. We assume a (program) signature with three
countably infinite sets of symbols: numerals, symbolic constants and program variables. We also
assume a 1-to-1 correspondence between numerals and integers; the numeral corresponding to
an integer  is denoted by . Program terms are either numerals, symbolic constants, variables
or either of the special symbols inf and sup. A program term (or any other expression) is ground
if it contains no variables. We assume that a total order on ground terms is chosen such that
• inf is its least element and sup is its greatest element,
• for any integers  and ,  &lt;  if  &lt; , and
• for any integer  and any symbolic constant ,  &lt; .</p>
      <p>
        An atom is an expression of the form (t), where  is a symbolic constant and t is a list of
program terms. A comparison is an expression of the form  ≺ ′, where  and ′ are program
terms and ≺ is one of the comparison symbols:
= ̸= &lt;
&gt; ≤ ≥
(
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
where each  (1 ≤  ≤ ) is a program term and each  (1 ≤  ≤ ) is a basic literal. An
aggregate atom is of form
1, . . . ,  : 1, . . . ,
      </p>
      <p>
        #op{} ≺ 
An atomic formula is either an atom or a comparison. A basic literal is an atomic formula
possibly preceded by one or two occurrences of not. An aggregate element has the form
where op is an operation name,  is an aggregate element, ≺ is one of the comparison symbols
in (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ), and  is a program term, called guard. We consider operation names names count
and sum. For example, expression
      </p>
      <p>
        #sum{P,C2 : ctrStk(C1,C2,C3,P)} &gt; 50
in the body of rule (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) is an aggregate atom. An aggregate literal is an aggregate atom possibly
preceded by one or two occurrences of not. A literal is either a basic literal or an aggregate
literal.
      </p>
      <p>A rule is an expression of the form</p>
      <p>
        Head :- 1, . . . , ,
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
where
• Head is either an atom or symbol ⊥; we often omit symbol ⊥ which results in an empty
head;
• each  (1 ≤  ≤ ) is a literal.
      </p>
      <p>We call the symbol :- a rule operator. We call the left hand side of the rule operator the head, the
right hand side of the rule operator the body. When the head of the rule is an atom we call the
rule normal. A program is a finite set of rules.</p>
      <p>Each operation name op is associated with a function op that maps every set of tuples of
̂︁
ground terms to a ground term. If the first member of a tuple t is a numeral  then we say that
integer  is the weight of t, otherwise the weight of t is 0. For any set Δ of tuples of ground
terms,
• cˆou︂nt(Δ) is the numeral corresponding to the cardinality of Δ, if Δ is finite; and sup
otherwise.
• ŝu︂m(Δ) is the numeral corresponding to the sum of the weights of all tuples in Δ, if Δ
contains finitely many tuples with non-zero weights; and 0 otherwise.1 If Δ is empty,
then ŝu︂m(Δ) = 0.
1The sum of a set of integers is not always defined. We could choose a special symbol to denote this case, we chose
to use 0 following the description of abstract gringo [30].</p>
      <p>Many-sorted formulas A many-sorted signature consists of symbols of three kinds—sorts,
function constants, and predicate constants. A reflexive and transitive subsort relation is defined
on the set of sorts. A tuple 1, . . . ,  ( ≥ 0) of argument sorts is assigned to every function
constant and to every predicate constant; in addition, a value sort is assigned to every function
constant. Function constants with  = 0 are called object constants.</p>
      <p>We assume that for every sort, an infinite sequence of object variables of that sort is chosen.
Terms over a (many-sorted) signature  are defined recursively:
• object constants and object variables of a sort  are terms of sort ;
• if  is a function constant with argument sorts 1, . . . ,  ( &gt; 0) and value sort ,
and 1, . . . ,  are terms such that the sort of  is a subsort of  ( = 1, . . . , ), then
 (1, . . . , ) is a term of sort .</p>
      <p>Atomic formulas over  are
• expressions of the form (1, . . . , ), where  is a predicate constant and 1, . . . ,  are
terms such that their sorts are subsorts of the argument sorts 1, . . . ,  of , and
• expressions of the form 1 = 2, where 1 and 2 are terms such that their sorts have a
common supersort.
(First-order) formulas over  are formed from atomic formulas and the 0-place connective ⊥
(falsity) using the binary connectives ∧, ∨, → and the quantifiers ∀, ∃. The other connectives are
treated as abbreviations: ¬ stands for  → ⊥ and  ↔  stands for ( → ) ∧ ( →  ).</p>
      <p>An interpretation  of a signature  assigns
• a non-empty domain || to every sort  of , so that ||1 ⊆ | |2 whenever 1 is a
subsort of 2,
• a function   from ||1 × · · · × | | to || to every function constant  with argument
sorts 1, . . . ,  and value sort , and
• a Boolean-valued function  on ||1 × · · · × | | to every predicate constant  with
argument sorts 1, . . . , .</p>
      <sec id="sec-2-1">
        <title>If  is an interpretation of a signature  then by   we denote the signature obtained from</title>
        <p>by adding, for every element  of a domain ||, its name * as an object constant of sort .
The interpretation  is extended to   by defining (* ) = . The value  assigned by an
interpretation  of  to a ground term  over   and the satisfaction relation between an
interpretation of  and a sentence over   are defined recursively, in the usual way.</p>
        <p>If d is a tuple 1, . . . ,  of elements of domains of  then d* stands for the tuple *1, . . . , *
of their names. If t is a tuple 1, . . . ,  of ground terms then t stands for the tuple 1 , . . . , 
of values assigned to them by .</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Programs With Aggregates as Many-Sorted First-Order</title>
    </sec>
    <sec id="sec-4">
      <title>Sentences</title>
      <p>
        In this section, we present translation  * that turns a program Π into a first-order sentence
with equality over a signature  * (, ) of three sorts where  and  respectively are sets of
predicate and set symbols. An set symbol is a pair /X, where  is an aggregate element and X
is a list of variables occurring in . In the sake of brevity, each set symbol /X is assigned a
short name |/X|. The first sort is called the program sort (denoted prg ); all program terms
are of this sort. The second sort is called the tuple sort (denoted tuple ); it contains entities that
are tuples of objects of the program sort. The second sort is called the set sort (denoted set );
it contains entities that are sets of elements of the second sort, that is, tuples of objects of the
program sort. Signature  * (, ) contains:
1. all ground terms as object constants of the program sort;
2. all predicate symbols in  with all arguments of program sort;
3. the comparison symbols other than equality as binary predicate constants whose
arguments are of the program sort;
4. predicate constant ∈/2 with the first argument of the sort tuple and the second argument
of the sort set;
5. function constant tuple / with arguments of the program sort and value of the tuple
sort for each set symbol /X in  with  of the form of (
        <xref ref-type="bibr" rid="ref5">5</xref>
        );
6. unary function constants count and sum whose argument is of the set sort and its value
is of the program sort;
      </p>
      <sec id="sec-4-1">
        <title>7. for each set symbol /X in , a function constant set |/X|/ whose arguments are of</title>
        <p>the program sort and its value is of the set sort and where  is the number of variables
in X;
We use infix notation in constructing atoms that utilize predicate symbols &gt;, ≥ , &lt;, ≤ , ̸= and ∈.</p>
        <p>Intuitively, tuple (1, . . . , ) is a constructor for the -tuple containing program terms 1, . . . , .</p>
      </sec>
      <sec id="sec-4-2">
        <title>Furthermore, each function constant set |/X|/ maps an -tuple of ground terms x to the</title>
        <p>
          set of tuples represented2 by xX. The result of count is the cardinality of the set passed as
an argument; the result of sum is the sum of the weights of all elements in the set passed as
an argument. These claims are formalized below. Note also that in contrast to other work
on the theory of stable models that do not consider aggregates (or intensional functions),
expression 1 ̸= 2 is not equivalent to ¬(1 = 2). This is necessary because according to the
Abstract Gringo semantics inequality and the negation of equality are not equivalent when
used in aggregate atoms. For instance, the program consisting of rule
(
          <xref ref-type="bibr" rid="ref8">8</xref>
          )
(
          <xref ref-type="bibr" rid="ref9">9</xref>
          )
p(a) :- not #count{X : p(X)} = 0.
has two answer sets according to the Abstract Gringo semantics: the empty set and {()}.
The program consisting of rule
        </p>
        <p>p(a) :- #count{X : p(X)} ̸= 0.
has the empty set as its unique answer set. On the other hand, this replacement is correct
under the dlv semantics and, in fact, both programs have only the empty set as their unique
answer set.
2For a tuple X of distinct variables, a tuple x of ground terms of the same length as X, and an expression  , by  xX
we denote the expression obtained from  by substituting x for X.</p>
        <p>About a predicate symbol /, we say that is occurs in a program Π if there is an atom of
the form (1, . . . , ) in Π. For set symbols, we need to introduce first the concepts of a global
variable and an set symbol. A variable is said to be global in a rule if
1. it occurs in any non-aggregate literal, or
2. it occurs in a guard of any aggregate literal.</p>
        <p>
          We say that set symbol /X occurs in rule  if this rule contains an aggregate literal with the
aggregate element  and X is the list of all variables in  that are global in . We say that /X
occurs in a program Π if /X occurs in some rule of the program. For instance, in rule (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) the
global variables are C1 and C3. Set symbol /X occurs in this rule where  stands for
the aggregate element P,C2 : ctrStk(C1,C2,C3,P) and X is the list of variables C1, C3.
In the following, we denote by set /2 the function symbol associated with this set symbol.
        </p>
        <p>In the following, when discussing some program Π, we assume a signature  * (, ) such
that  is a set that contains all predicate symbols occurring in Π and  contains all set symbols
occurring in Π. When no confusion arises we will simply write  * instead of  * (, ). In the
following, we also assume that  is the set of intensional symbols and that the set of intensional
functions ℱ is the set of all function symbols corresponding to the set symbols in .
Translation  * We now describe a translation  * that converts a program into a finite set of
ifrst-order sentences.</p>
        <p>Given a list Z of global variables in some rule , we define  Z* for all elements of  as follows:
1. for every atomic formula  occurring outside of an aggregate literal, its translation  Z*
is  itself;  Z*⊥ is ⊥;
2. for an aggregate atom  of form #count{} ≺  or #sum{} ≺ , its translation  Z* is
the atom</p>
        <p>
          count (set |/X|(X)) ≺  or sum(set |/X|(X)) ≺ 
respectively, where X is the list of variables in Z occurring in ;
3. for every (basic or aggregate) literal of the form not  its translation  Z*(not ) is ¬ Z*;
for every literal of the form not not  its translation  Z*(not not ) is ¬¬ Z*.
We now define the translation  * as follows:
4. for every rule  of form (
          <xref ref-type="bibr" rid="ref4">4</xref>
          ), its translation  *  is the universal closure of
 Z*1 ∧ · · · ∧  Z* →  Z* Head ,
where Z is the list of the global variables of .
5. for every program Π, its translation  * Π is the first-order theory containing  *  for each
rule  in Π.
        </p>
        <p>
          For instance, rule (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) is translated into
where variables 1 and 3 are of the program sort.
        </p>
        <p>
          company (1) ∧ company (3) ∧ sum(set (1, 3)) &gt; 50 → controls(1, 3)
(
          <xref ref-type="bibr" rid="ref10">10</xref>
          )
Standard interpretations. A standard interpretation  is an interpretation of  * (, ℱ ) that
satisfies the following conditions:
1. the domain ||prg is the set containing all ground terms of the program sort (or ground
program terms, for short);
2. universe ||tuple is the set of all tuples of form ⟨1, . . . , ⟩ with  ∈ ||prg for each set
symbol /X in  with  of the form of (
          <xref ref-type="bibr" rid="ref5">5</xref>
          );
3. the elements of domain ||set are sets of elements from ||tuple ;
4.  interprets each ground program term as itself;
5.  interprets predicate symbols &gt;, ≥ , &lt;, ≤ according to the total order chosen earlier;
6.  interprets each tuple term of form tuple (1, . . . , ) as the tuple ⟨1 , . . . , ⟩;
7. ∈ is the set of pairs (, ) such that tuple  belongs to set ;
8. for term set of sort set , count (set ) is cˆou︂nt(set );
9. for term set of sort set , sum(set ) is ŝu︂m(set );
        </p>
        <p>
          To complete the first-order characterization of the Abstract Gringo semantics, we introduce
a set axiom as follows. For each set symbol /X of the form of (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ), by SCA(/X) we denote
the first-order sentence
∀X (︀  ∈ set |/X|(X) ↔ ∃Y( = tuple (1, . . . , ) ∧ 1 ∧ · · · ∧
))︀
(
          <xref ref-type="bibr" rid="ref11">11</xref>
          )
where Y is the list of all the variables occurring in  that are not in X. We write SCA for the
set containing SCA(/X) for each set symbol /X in the signature.
        </p>
        <p>
          Proposition 1. A standard interpretation  of  * satisfies (
          <xref ref-type="bibr" rid="ref11">11</xref>
          ) if it satisfies the following condition:
set |/X|(x) is the set of all tuples of form ⟨(1)xXyY, . . . , ()xXyY⟩ such that
 satisfies (1)xXyY ∧ · · · ∧ ()xXyY
where x and y are lists of ground program terms of the same length as X and Y respectively.
        </p>
        <p>
          For instance, the program representing the Company Control problem has a unique set
symbol that is associated with the function symbol set /2. For this function symbol, we have
the first-order sentence
∀13 (︀  ∈ set (1, 3) ↔ ∃ 2( = tuple (, 2) ∧ ctrStk (1, 2, 3,  )))︀
(
          <xref ref-type="bibr" rid="ref12">12</xref>
          )
If  is a model of (
          <xref ref-type="bibr" rid="ref12">12</xref>
          ) such that ctrStk  is the set containing (1, 2, 3, 10) and (1, 4, 3, 20),
by Proposition 1, it follows that set ctr (c1 , c3 ) is the set containing tuples ⟨10, 2⟩ and ⟨20, 4⟩.
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>4. Abstract Gringo Semantics</title>
      <p>In this section, we establish the correspondence between the semantics of programs with
aggregates introduced in the previous section and the Abstract Gringo [29]. These semantics
are stated in terms of infinitary formulas.</p>
      <p>Background on Infinitary Formulas We recall some definitions of infinitary logic [ 31].
We denote a propositional signature (a set of propositional atoms) as  . For every nonnegative
integer , (infinitary propositional) formulas of rank  are defined recursively:
• every ground atom in  is a formula of rank 0,
• if Γ is a set of formulas, and  is the smallest nonnegative integer that is greater than the
ranks of all elements of Γ, then Γ∧ and Γ∨ are formulas of rank ,
• if  and  are formulas, and  is the smallest nonnegative integer that is greater than
the ranks of  and , then  →  is a formula of rank .</p>
      <p>We write {, }∧ as  ∧ , {, }∨ as  ∨ , and ∅∨ as ⊥.</p>
      <p>Subsets of a propositional signature  will be called interpretations. The satisfaction relation
between an interpretation  and an infinitary formula is defined recursively:
• for every ground atom  from  ,  |=  if  belongs to ,
•  |= Γ∧ if for every formula  in Γ,  |=  ,
•  |= Γ∨ if there is a formula  in Γ such that  |=  ,
•  |=  →  if  ̸|=  or  |= .</p>
      <p>An interpretation satisfies a set Γ of formulas if it satisfies every formula in Γ. We say that a
set  of atoms is a ⊆ -minimal model of an infinitary formula  , if  |=  and there is no ℬ
that satisfies both ℬ |=  and ℬ ⊂  .</p>
      <p>Stable Models The FT-reduct   of an infinitary formula  with respect to a set  of atoms
is defined recursively. If  ̸|=  then   is ⊥; otherwise,
• for every ground atom ,  is 
• (Γ∧) = { |  ∈ Γ}∧,
• (Γ∨) = { |  ∈ Γ}∨,
• ( → ) is  → .</p>
      <p>We say that a set  of ground atoms is a FT-stable model of an infinitary formula  if it is
a ⊆ -minimal model of  . We say that a set  of ground atoms is a gringo answer set of a
program Π if  a FT-stable model of  Π where  is the translation from logic programs to
infinitary formulas defined by Gebser et al. [29].</p>
    </sec>
    <sec id="sec-6">
      <title>5. First-order characterization of the Abstract Gringo Semantics</title>
      <p>The first-order characterization of the Abstract Gringo Semantics proposed here relies on the
stable model semantics with intensional functions [28]. Our presentation follows the definition
in terms of of equilibrium logic [32] described by Bartholomew and Lee [33, Section 3.3].
Stable Model Semantics with Intensional Functions. Let  and  be two interpretations
of a signature  and  and ℱ respectively be sets of predicate and function constants of  . We
write  ≤ ℱ  if
•  and  have the same universe for all sorts;
•  ⊆  for every predicate constant  in  and  =  for every predicate constant 
not in  ;
•   ̸=   for every function constant  in  and  =  for every function constant 
not in  ;
We write  &lt;ℱ  if  ≤ ℱ  and  ̸= .</p>
      <p>Let  and ℱ be sets of predicate and function constant of  , that we consider intensional. An
ht-interpretation of  is a pair ⟨, ⟩, where  and  are interpretation of  such that  ≤ ℱ .
(In terms of Kripke models with two sorts,  is the there-world, and  is the here-world of a
non-total interpretation). The satisfaction relation |=ℎ between HT-interpretation ⟨, ⟩ of 
and a sentence  over   is defined recursively as follows:
• ⟨, ⟩ |=ℎ (t), if  |= (t) and  |= (t);
• ⟨, ⟩ |=ℎ 1 = 2 if 1 = 2 and 1 = 2 ;
• ⟨, ⟩ ̸|=ℎ ⊥;
• ⟨, ⟩ |=ℎ  ∧  if ⟨, ⟩ |=ℎ  and ⟨, ⟩ |=ℎ ;
• ⟨, ⟩ |=ℎ  ∨  if ⟨, ⟩ |=ℎ  or ⟨, ⟩ |=ℎ ;
• ⟨, ⟩ |=ℎ  →  if
(i)  |=  → , and
(ii) ⟨, ⟩ ̸|=ℎ  or ⟨, ⟩ |=ℎ ,
• ⟨, ⟩ |=ℎ ∀  () if ⟨, ⟩ |=ℎ  (* ) for each  ∈ ||, where  is the sort of ;
• ⟨, ⟩ |=ℎ ∃  () if ⟨, ⟩ |=ℎ  (* ) for some  ∈ ||, where  is the sort of .
If ⟨, ⟩ |=ℎ  holds, we say that ⟨, ⟩ satisfies  and that ⟨, ⟩ is an ht-model of  . If two
formulas have the same ht-models then we say that they are ht-equivalent.</p>
      <p>
        An ht-interpretation ⟨, ⟩ is said to be standard if both  and  are standard.
Proposition 2. A standard ht-interpretation ⟨, ⟩ of  * satisfies (
        <xref ref-type="bibr" rid="ref11">11</xref>
        ) if  satisfies the condition
stated in Proposition 1 and, in addition, ⟨, ⟩ satisfies the following condition:
set |/X|(x) is the set of all tuples of form ⟨(1)xXyY, . . . , ()xXyY⟩ such that
⟨, ⟩ satisfies (1)xXyY ∧ · · · ∧ ()xXyY
where x and y are lists of ground program terms of the same length as X and Y respectively.
      </p>
      <p>About a model  of a set Γ of sentences over   we say it is ht-stable if every ht-interpretation ⟨, ⟩
with  &lt;ℱ  does not satisfy Γ.</p>
      <p>Now we define the first-order counterpart of gringo answer sets defined in the previous
section. For an interpretation  of  * , by Ans(), we denote the set of ground atoms that are
satisfied by  and whose predicate symbol is not a comparison. If  is a standard ht-stable model
of SCA ∪  * Π, we say that Ans() is a fo-gringo answer set of Π.</p>
      <p>Theorem 1. The fo-gringo answer sets of any program coincide with its gringo answer sets.</p>
    </sec>
    <sec id="sec-7">
      <title>6. The dlv semantics</title>
      <p>Similarly to the Abstract Gringo semantics, the dlv semantics can be stated in terms of a the
same translation  to infinitary formulas, but using a diferent reduct [34].</p>
      <p>FLP-stable models are defined for sets of implications rather than arbitrary formulas. Let Γ be
a set of infinitary formulas of the form  →  , where  is a disjunction of propositional atoms
from  . The FLP-reduct   (Γ, ) of Γ w.r.t. an interpretation  is the set of all formulas
 →  from Γ such that  satisfies . A set  of ground atoms is an FLP-stable model of Γ if
it is a ⊆ -minimal model of   (Γ,  ). We say that a set  of ground atoms is a dlv answer set
of a program Π if  a FLP-stable model of  Π.</p>
      <p>
        First-order characterization of the dlv semantics. For the dlv semantics we introduce a
new entailment relation |=, which is variation of the here-and-there entailment relation |=ℎ
defined above. This relation is defined recursively, analogously to the relation |=ℎ, with the
only diference being the implication case:
• ⟨,  ⟩ |=  →  if
(i)  |=  → , and
(ii)  ̸|=  or  ̸|=  or both  |=  and  |= ;
If ⟨,  ⟩ |=ℎ  holds, we say that ⟨,  ⟩ dlv-staisfies  and that ⟨,  ⟩ is an dlv-model of  .
Proposition 3. A standard ht-interpretation ⟨,  ⟩ of  * dlv-staisfies (
        <xref ref-type="bibr" rid="ref11">11</xref>
        ) if  satisfies the
condition stated in Proposition 1 and, in addition,  satisfies the following condition:
 satisfies (1)xXyY ∧ · · · ∧
      </p>
      <p>()xXyY
set |/X|(x) is the set of all tuples of form ⟨(1)xXyY, . . . , ()xXyY⟩ such that
where x and y are lists of ground program terms of the same length as X and Y respectively.</p>
      <p>About a model  of a set Γ of sentences, we say it is dlv-stable if there is no ht-interpretation ⟨,  ⟩
with  &lt;ℱ  and ⟨,  ⟩ |= Γ. If  is a dlv-stable model of SCA ∪  * Π, we say that Ans ( )
is a fo-dlv answer set of Π.</p>
      <p>The following conjecture about the relation between dlv answer sets and fo-dlv answer sets
is a matter of ongoing work:
Conjecture 1. The fo-dlv answer sets of any program coincide with its dlv answer sets.</p>
    </sec>
    <sec id="sec-8">
      <title>7. Conclusion</title>
      <p>This work presents a characterization of recursive aggregates that does not rely on grounding.
For this, we use the same translation from logic programs to first-order formulas described
by Fandinno et al. [35], but we rely on semantics that treat function symbols corresponding
to set symbols as intensional. Recall that these functions map ground terms to sets of tuples
of ground terms - each of these tuples must satisfy the associated conditions present in the
aggregate element. Interestingly, for the semantics of the solver clingo, this particular class of
function symbols behaves in a truly analogous way to intensional predicate symbols; namely,
the constructed set in the here-world is a subset of the constructed set in the there-world, for
any arguments to the function. This is not ordinarily the case for intensional functions nor does
it seem to be the case for the semantics of the solver dlv.</p>
      <p>Another interesting outcome of this work is Conjecture 1. The implication of this conjecture
(if proven) is that the diferences between recursive aggregates in clingo and dlv are not
actually rooted in aggregates themselves. In both solvers, aggregates are the same intensional
functions on sets of tuples, but which tuples belong to these sets varies between solvers due
to diferences in their treatment of implication and negation. The proof of this conjecture is a
matter of ongoing work.</p>
      <p>The results presented in this paper bring us closer to a long-term goal of using first-order
reasoning tools to automatically verify properties of programs with aggregates. The next step
is to prove Conjecture 1 and explore its implications. Subsequent future work will include
extending results on strong equivalence to the class of programs studied here.
[13] V. Lifschitz, Strong equivalence of logic programs with counting, Theory and Practice of</p>
      <p>Logic Programming 22 (2022) 573–588.
[14] M. Bartholomew, J. Lee, Y. Meng, First-order extension of the flp stable model semantics
via modified circumscription., in: T. Walsh (Ed.), Proceedings of the Twenty-second
International Joint Conference on Artificial Intelligence (IJCAI’11), IJCAI/AAAI Press,
2011, pp. 724–730.
[15] J. Lee, Y. Meng, Stable models of formulas with generalized quantifiers (preliminary
report), in: A. Dovier, V. Santos Costa (Eds.), Technical Communications of the
Twentyeighth International Conference on Logic Programming (ICLP’12), volume 17, Leibniz
International Proceedings in Informatics (LIPIcs), 2012, pp. 61–71.
[16] V. Asuncion, Y. Chen, Y. Zhang, Y. Zhou, Ordered completion for logic programs with
aggregates, Artificial Intelligence 224 (2015) 72–102.
[17] P. Cabalar, J. Fandinno, L. Fariñas del Cerro, D. Pearce, Functional ASP with intensional
sets: Application to Gelfond-Zhang aggregates, Theory and Practice of Logic Programming
18 (2018) 390–405.
[18] J. Fandinno, Z. Hansen, Y. Lierler, Axiomatization of aggregates in answer set programming,
in: Proceedings of the Thirty-sixth National Conference on Artificial Intelligence (AAAI’22),
AAAI Press, 2022, pp. 5634–5641.
[19] P. Ferraris, J. Lee, V. Lifschitz, Stable models and circumscription, Artificial Intelligence
175 (2011) 236–263.
[20] I. Mumick, H. Pirahesh, R. Ramakrishnan, The magic of duplicates and aggregates, in:
D. McLeod, R. Sacks-Davis, H. Schek (Eds.), Proceedings of the Sixteenth International
Conference on Very Large Data Bases (VLDB’90), Morgan Kaufmann Publishers, 1990, pp.
264–277.
[21] D. Kemp, P. Stuckey, Semantics of logic programs with aggregates, in: V. Saraswat, K. Ueda
(Eds.), Proceedings of the 1991 International Symposium on Logic Programming (ISLP’91),
MIT Press, 1991, pp. 387–401.
[22] K. Ross, Y. Sagiv, Monotonic aggregation in deductive databases, Journal of Computer
and System Sciences 54 (1997) 79–97.
[23] V. Lifschitz, D. Pearce, A. Valverde, Strongly equivalent logic programs, ACM Transactions
on Computational Logic 2 (2001) 526–541.
[24] V. Lifschitz, D. Pearce, A. Valverde, A characterization of strong equivalence for logic
programs with variables, in: C. Baral, G. Brewka, J. Schlipf (Eds.), Proceedings of the
Ninth International Conference on Logic Programming and Nonmonotonic Reasoning
(LPNMR’07), volume 4483 of Lecture Notes in Artificial Intelligence , Springer-Verlag, 2007,
pp. 188–200.
[25] F. Lin, Y. Wang, Answer set programming with functions, in: G. Brewka, J. Lang (Eds.),
Proceedings of the Eleventh International Conference on Principles of Knowledge
Representation and Reasoning (KR’08), AAAI Press, 2008, pp. 454–465.
[26] P. Cabalar, Functional answer set programming, Theory and Practice of Logic Programming
11 (2011) 203–233.
[27] M. Balduccini, ASP with non-herbrand partial functions: A language and system for
practical use, Theory and Practice of Logic Programming 13 (2013) 547–561.
[28] M. Bartholomew, J. Lee, First-order stable model semantics with intensional functions,</p>
    </sec>
    <sec id="sec-9">
      <title>A. Proof of Results</title>
      <p>
        Lemma 1. Let  be an aggregate element of the form (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) with free variables X and bound
variables Y and let  be a standard interpretation. Let x be a list of ground terms of sort prg of
the same length as X, tuple a domain element of sort tuple, ′ = ()xX and ′ = ()xX. Then, 
satisfies
*tuple ∈ set ||(x) ↔ ∃Y (︀ *tuple = tuple (′1, . . . , ′) ∧ 1′ ∧ · · · ∧
′)︀
(13)
if the first of the following three conditions is equivalent to the conjunction of the other two:
1. tuple belongs to set ||(x) ,
2. there is a list c of domain elements of sort prg of the same length as Y such that
tuple = ⟨(′1′) , . . . , (′′)⟩ and  satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY
and y = c* .
      </p>
      <p>Proof.  satisfies (13) if condition 1 is equivalent to:
 satisfies ∃Y ( = tuple (′1, . . . , ′) ∧ 1′ ∧ · · · ∧
Furthemore, the latter holds if there is a list c of domain elements of sort prg such that
tuple = tuple (′1′, . . . , ′′) = tuple (′1′, . . . , ′′) = ⟨(′1′) , . . . , (′′) ⟩
and  satisfies 1′′ ∧ · · · ∧</p>
      <p>′′ with y = c* if condition 2 holds.</p>
      <p>
        Lemma 2. Let  be an aggregate element of the form (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) with free variables X and bound
variables Y and let  be a standard interpretation. Let x be a list of ground terms of sort prg of
the same length as X, ′ = ()xX and ′ = ()xX. Then,  satisfies
∀ (︀  ∈ set ||(x) ↔ ∃Y ( = tuple (′1, . . . , ′) ∧ 1′ ∧ · · · ∧
′) ︀)
(14)
if set ||(x) is the set of all tuples of the form ⟨(′1′) , . . . , (′′) ⟩ s.t.  satisfies 1′′ ∧ · · · ∧ ′′ with
′′ = (′)yY and ′′ = (′)yY and y a list of ground terms of sort prg of the same length as Y.
Proof. Left-to-right. Assume that  satisfies (14) and pick any domain element tuple of sort tuple .
Then,  satisfies (13) and, by Lemma 1, tuple belongs to set ||(x) if there is a list c of domain
elements of sort prg of the same length as Y such that tuple = ⟨(′1′) , . . . , (′′)⟩ and 
satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY and y = c* . Then, the rigth-hand side of
the if holds.
      </p>
      <p>Right-to-left. Assume that set ||(x) is the set of all tuples of the form ⟨(′1′) , . . . , (′′) ⟩ such
that  satisfies 1′′ ∧ · · · ∧ ′′ for some list y of ground terms of sort prg of the same length
as Y. Pick any domain element tuple of sort tuple . By Lemma 1,  satisfies (13) and, thus, 
satisfies (14).</p>
      <p>Proof of Proposition 1. Pick any list c of domain elements of sort prg and let x = c* . Then,
the result follows directly by Lemma 2.</p>
      <p>Lemma 3. ⟨, ⟩ |=ℎ  ↔  if
•  |=  ↔ , and
• ⟨, ⟩ |=ℎ  if ⟨, ⟩ |=ℎ .</p>
      <p>Proof. ⟨, ⟩ |=ℎ  ↔ 
if ⟨, ⟩ |=ℎ  →  and ⟨, ⟩ |=ℎ  → 
if both
•  |=  →  and either ⟨, ⟩ ̸|=ℎ  or ⟨, ⟩ |=ℎ , and
•  |=  →  and either ⟨, ⟩ ̸|=ℎ  or ⟨, ⟩ |=ℎ 
if
if
•  |=  →  and  |=  →  , and
• either ⟨, ⟩ ̸|=ℎ  or ⟨, ⟩ |=ℎ , and
• either ⟨, ⟩ ̸|=ℎ  or ⟨, ⟩ |=ℎ 
•  |=  ↔ , and
• ⟨, ⟩ |=ℎ  if ⟨, ⟩ |=ℎ .</p>
      <p>Lemma 4. If ⟨, ⟩ is a standard ht-interpretation, then set |/X|(x) is a subset of set /X(x)
for every set symbol /X and list x of ground terms of the same length as X.</p>
      <p>
        Proof. Pick any element tuple of set |/X|(x) . Since ⟨, ⟩ is a standard ht-interpretation, it
follows that  is a standard interpreation and, thus, that the pair (tuple , set |/X|(x) ) belongs
to ∈ . Hence, (tuple , set |/X|(x) ) also belongs to ∈ and, thus, tuple of set |/X|(x) .
Lemma 5. Let  be an aggregate element of the form (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) with free variables X and bound
variables Y and let ⟨, ⟩ be a standard ht-interpretation. Let x be a list of ground terms of
sort prg of the same length as X, tuple a domain element of sort tuple, ′ = ()xX and ′ = ()xX.
Then, ⟨, ⟩ satisfies (13) if the the following two conditions are equivalent:
1. tuple belongs to set ||(x) ,
2. there is a list c of domain elements of sort prg of the same length as Y such that
tuple = ⟨(′1′) , . . . , (′′)⟩ and  satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY
and y = c* ,
and the the following two conditions are aslo equivalent:
3. tuple belongs to set ||(x) ,
4. there is a list c of domain elements of sort prg of the same length as Y such that
tuple = ⟨(′1′) , . . . , (′′)⟩ and ⟨, ⟩ satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ =
(′)yY and y = c* .
      </p>
      <p>Proof. From Lemma 3, ⟨, ⟩ satisfies (13) if  satisfies (13) and the following two conditions
are equivalent:
5. ⟨, ⟩ satisfies *tuple ∈ set ||(x);
6. ⟨, ⟩ satisfies ∃Y ( = tuple (′1, . . . , ′) ∧ 1′ ∧ · · · ∧
Furthemore, by Lemma 1,  satisfies (13) if Conditions 1 and 2 are equivalent. Hence, ⟨, ⟩
satisfies (13) if Conditions 1 and 2 are equivalent, and Conditions 5 and 6 are equivalent.</p>
      <p>On the one hand, condition 6 is equivalent to conjuntion of conditions 1 and 3. On the other
hand, condition 6 holds if there is a list c of domain elements of sort prg such that
tuple = tuple (′1′, . . . , ′′) = tuple (′1′, . . . , ′′) = ⟨(′1′) , . . . , (′′) ⟩
and ⟨, ⟩ satisfies 1′′ ∧ · · · ∧
ifes (13) if</p>
      <p>′′ with y = c* if condition 4 holds. Therefore, ⟨, ⟩
satis• Conditions 1 and 2 are equivalent, and
• Condition 4 is equivalent to the conjunction of conditions 1 and 3.</p>
      <p>Finally, note that by Lemma 4 condition 3 implies 1 and the result holds.</p>
      <p>
        Lemma 6. Let  be an aggregate element of the form (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) with free variables X and bound
variables Y and let  be a standard interpretation. Let x be a list of ground terms of sort prg of the
same length as X, ′ = ()xX and ′ = ()xX. Then, ⟨, ⟩ satisfies (14) if  satisfies the condition
stated in Lemma 2 and, in addition, set ||(x) is the set of all tuples of the form ⟨(′1′) , . . . , (′′) ⟩
s.t.  satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY and y a list of ground terms of sort prg
of the same length as Y.
      </p>
      <p>Proof. Left-to-right. Assume that ⟨,  ⟩ satisfies (14) and pick any domain element tuple of
sort tuple . Then, ⟨,  ⟩ satisfies (13) and the result follows immediately by Lemma 5.
Right-to-left. Pick any domain element tuple of sort tuple. The conditions of Lemma 5 are
satisfied and the result follows by this lemma.</p>
      <p>Proof of Proposition 2. Pick any list c of domain elements of sort prg and let x = c* . Then,
the result follows directly by Lemma 2.</p>
      <p>A.1. Proof of Theorem 1
First-order interpretations and infinitary formulas. We can extend the satisfaction
relation for ht-interpretations can be extended to infinitary formulas by adding the following
two conditions to the definition for first-order formulas:
• ⟨,  ⟩ |=ℎ Γ∧ if for every formula  in Γ, ⟨,  ⟩ |=ℎ  ,
• ⟨,  ⟩ |=ℎ Γ∨ if there is a formula  in Γ such that ⟨,  ⟩ |=ℎ  ,
We write  |=  if ⟨ ,  ⟩ |=ℎ  .</p>
      <p>In the following, if  is an interpretation, then ℐ denotes the set of ground atomic formulas
satisfied by  .</p>
      <p>Proposition 4. Let   be a propositional signature consisting of all the ground atomic formulas
of first-order signature  . Let  be a an infinitary formula of  . Then,</p>
      <p>|= 
⟨,  ⟩ |=ℎ 
if
if
ℐ |= 
ℋ |=  ℐ
Proof. We proceed by induction on the rank  of  . For a formula  of rank  + 1, assume that,
for all formulas  of lesser rank than  occurring in  , ⟨,  ⟩ |=ℎ  if ℋ |= ℐ .
Base Case:  = 0,  is a ground atomic formula. Then, ⟨,  ⟩ |=ℎ 
if  |=  and  |= 
if  |=  and  ℐ = 
if ℋ |=  ℐ
Induction Step:</p>
      <p>Case 1: Formula  of rank  + 1 has form Γ∧. Then, ⟨,  ⟩ |=ℎ 
if ⟨,  ⟩ |=ℎ  for every formula  in Γ
if ℋ |= ℐ for every formula  in Γ
if ℋ |= {ℐ |  ∈ Γ}∧
if ℋ |=  ℐ</p>
      <p>Case 2: Formula  of rank  + 1 has form Γ∨. Then, ⟨,  ⟩ |=ℎ 
if ⟨,  ⟩ |=ℎ  for some formula  in Γ
if ℋ |= ℐ for this certain formula  in Γ
if ℋ |= {ℐ |  ∈ Γ}∨
if ℋ |=  ℐ
(by definition)
(by induction hypothesis)</p>
      <p>(by definition)
(by induction hypothesis)</p>
      <p>Case 3: Formula  of rank  + 1 has form 1 → 2. Then, ⟨, ⟩ |=ℎ 
if  |= 1 → 2 and ⟨, ⟩ ̸|=ℎ 1 or ⟨, ⟩ |=ℎ 2
if ⟨, ⟩ |=ℎ 1 → 2 and ⟨, ⟩ ̸|=ℎ 1 or ⟨, ⟩ |=ℎ 2
if ℐ |= 1ℐ → 2ℐ and ℋ ̸|= 1ℐ or ℋ |= 2ℐ
if ℐ |= 1 → 2 and ℋ ̸|= 1ℐ or ℋ |= 2ℐ
if ℐ |= 1 → 2 and ℋ |= 1ℐ → 2ℐ
if  ℐ = 1ℐ → 2ℐ and ℋ |= 1ℐ → 2ℐ
if ℋ |=  ℐ
(by definition)
(by definition)
(by induction hypothesis)</p>
      <p>An interpretation that satisfies the condition of Proposition 1 for every set symbol /X
in  is called an agg-interpretation. Similarly, a ht-interpretation that satisfies the condition of
Proposition 2 for every set symbol /X in  is called an agg-ht-interpretation. A model that is
an agg-interpretation is called an agg-model and a ht-model that is an agg-ht-interpretation is
called an agg-ht-model.</p>
      <p>Lemma 7. Let ⟨, ⟩ be an agg-ht-interpretation. Then,  &lt;ℱ  if  &lt;∅ .
Proof. Right-to-left.  &lt;∅  means that there is a predicate symbol  such that  ⊂  and,
thus,  &lt;ℱ  also holds. Lert-to-right.  &lt;ℱ  means that on of the following holds
•  ⊂  for some intensional predicate symbol ; or
•   ̸=   for some intensional function symbol  .</p>
      <p>The first immediately implies that  &lt;∅  also holds. For the latter,  must be of the
form set |/X| for some aggregate element . Therefore, the set of the set of all tuples of
form ⟨(1)xXyY, . . . , ()xXyY⟩ such that  satisfies (1)xXyY ∧ · · · ∧ ()xXyY and the set of all tuples
of form ⟨(1)xXyY, . . . , ()xXyY⟩ such that ⟨, ⟩ satisfies (1)xXyY ∧· · ·∧ ()xXyY must be diferent.
This means that  ̸=  for some predicate symbols  and, thus,  ⊂  and  &lt;∅ 
follow.</p>
      <p>We say that an agg-model  of an infinitary formula  is an FT-agg-stable model of  if there
is no agg-ht-interpretation ⟨, ⟩ with  &lt;ℱ  such that ⟨, ⟩ satisfies  .</p>
      <p>In the following two Lemmas,  is an agg-interpretationand ℐ is the set of ground atomic
formulas satisfied by .</p>
      <p>Lemma 8. If ℐ is a FT-stable model of  , then  is a FT-agg-stable model of  .
Proof. Since  is a FT-stable model of  , we get that  satisfies  and, thus,  is an agg-model 
of  . Suppose, for the sake of contradiction, that there is an agg-ht-interpretation ⟨, ⟩
with  &lt;ℱ  such that ⟨, ⟩ satisfies  . Then, by Proposition 4, it follows that ℋ |=  ℐ .
Furthermore, by Proposition 7, it follows that  &lt;∅  and, thus, ℋ ⊂ ℐ . This is a contradiction
with the assumption that ℐ is a FT-stable model of  .</p>
      <p>Lemma 9. Let  be a an infinitary formula that does not contain function symbols corresponding
to set symbols. Then, ℐ is a FT-stable model of  if  is FT-agg-stable model of 
Proof. The left-to-right direction follows by Lemma 8. For the right-to-left direction, assume
that  is an FT-agg-stable model of  . Then,  satisfies  and, by Proposition 4, it follows that ℐ
is a model of  . Suppose, for the sake of contradiction, that ℐ is a FT-stable model of  . Then,
there is some model  of  ℐ such that  ⊂ ℐ . Let  be an agg-interpretation such that
•  has the same domain as ,
• for every ground atomic formula (t) that does not function symbols corresponding to
set symbols, (t) is true if (t) belongs to  .</p>
      <p>Then,  &lt;∅  and, from Proposition 7, we get that  &lt;ℱ . Since  is an FT-agg-stable model
of  , it follows that ⟨, ⟩ ̸|=ℎ  . From Proposition 4, this implies that ℋ ̸|=  ℐ where ℋ
is the set of ground atomic formulas satisfied by . However,  and ℋ agree on all atoms
occurring in  , so this is a contradiction with the fact that  is a model of  ℐ .
Infinitary grounding The grounding of a first order sentence  with respect to an
interpretation  and sets  and ℱ of intensional predicate and function symbols is defined as follows:
• gr ℱ (⊥) = ⊥;
• gr ℱ ((t)) = ((t )* ) if (t) contains intensional symbols;
• gr ℱ ((t)) = ⊤ if (t) does not contain intensional symbols and  |= (t); and gr ℱ ((t)) = ⊥
otherwise;
• gr ℱ (1 = 2) = (1 = 2) if 1 or 2 contain intensional symbols;
• gr ℱ (1 = 2) = ⊤ if 1 and 2 do not contain intensional symbols and 1 = 2 and ⊥
otherwise;
• gr ℱ ( ⊗ ) = gr ℱ ( ) ⊗ gr ℱ () if ⊗ is ∧, ∨, or →;
• gr ℱ (∃  ()) = {gr ℱ ( ()) |  ∈ ||}∨ if  is a variable of sort ;
• gr ℱ (∀  ()) = {gr ℱ ( ()) |  ∈ ||}∧ if  is a variable of sort ;
For a first order theory Γ, we define gr ℱ (Γ) = {gr ℱ ( ) |  ∈ Γ}∧.</p>
      <p>In the following, we write gr  ( ) instead of gr ℱ ( ) when clear by the context.
Lemma 10. An interpretation  satisfies a sentence  over   if  satisfies gr  ( ).
Proof. By induction on  .</p>
      <p>Case 1:  is an atomic sentence. Then, gr  ( ) =  and the result is trivial.</p>
      <p>Case 2:  is ∀() with  a variable of sort . Then, gr  ( ) = {gr  ((* )) | * ∈ ||}∧
and</p>
      <p>⟨, ⟩ |=ℎ 
if ⟨, ⟩ |=ℎ (* ) for each  ∈ ||
if ⟨, ⟩ |=ℎ gr  ((* )) for each  ∈ || (induction)
if ⟨, ⟩ |=ℎ gr  ( ).</p>
      <p>The case where  is ∃() is analogous to Case 2. The remaining cases where  is 1 ∧ 2,
1 ∨ 2 or 1 → 2 follow immediately by induction.</p>
      <p>Lemma 11. An ht-interpretation ⟨, ⟩ satisfies a sentence  over   if ⟨, ⟩ satisfies gr  ( ).
Lemma 12. Let Γ be a set of first-order sentences. Then,  is a agg-stable model of Γ if  is an
FT-agg-stable model of gr  (Γ).</p>
      <p>Proof. First, note that by Lemma 10, it follows that  is agg-model of Γ if  is an agg-interpretation
and  |= Γ if  is agg-modelof gr  (Γ). Then,  is a agg-stable model of Γ if there is no ⟨, ⟩
with  &lt;ℱ  that satisfies Γ if there is no ⟨, ⟩ with  &lt;ℱ  that satisfies gr  (Γ)
(Lemma 11) if  is a FT-agg-stable model of gr  (Γ).</p>
      <p>Lemma 13. Let  be an agg-interpretation and op be an operation name.</p>
      <p>Then,  satisfies op(set |/X|(x)) ≺  if  satisfies</p>
      <p>⎛
⋀︁ ⎜ ⋀︁ lxXyY →</p>
      <p>⎝
Δ∈ y∈Δ</p>
      <p>⋁︁</p>
      <p>⎞
lxXyY⎟⎠
(15)
where  is the set of subsets Δ of ΨxX that do not justify aggregate atom op{xX} ≺ .
Proof. Let Y be the list of variables occurring in  that do not occur in X. Let Δ = { y ∈
ΨxX |  |= lxXyY } and  be the formula
Then,  ̸|=  and
Consequently, we have
⋀︁ lxXyY →
y∈Δ</p>
      <p>⋁︁
y∈Ψ∖Δ</p>
      <p>lxXyY
set |/X|(x) = {txXyY | y ∈ Δ } = [Δ ].
 |= (15) if  is not a conjunctive term of (15)
if Δ justifies op(set |/X|(x)) ≺ 
if  |= op|([Δ ]* ) ≺ 
if  |= op(set |/X|(x)) ≺ 
Lemma 14. Let ⟨, ⟩ be an agg-ht-interpretation and op be an operation name. Then, ⟨, ⟩
satisfies op(set |/X|(x)) ≺  if ⟨, ⟩ satisfies</p>
      <p>⎛
Δ∈</p>
      <p>y∈Δ
⋀︁ ⎜ ⋀︁ lxXyY →
⎝</p>
      <p>⋁︁
where  is the set of subsets Δ of ΨxX that do not justify aggregate atom op{xX} ≺ .</p>
      <sec id="sec-9-1">
        <title>Proof. Let us denote op(set |/X|(x)) ≺  as  in the following.</title>
        <p>Case 1:  ̸|= . By Lemma 13, it follows that  ̸|= (16). Therefore, ⟨, ⟩ ̸|=ℎ  and ⟨, ⟩ ̸|=ℎ (16).
Case 2:  |= . By Lemma 13, it follows that  |= (16). Let
and ⟨,⟩ be the formula
Then, ⟨, ⟩ ̸|= ⟨,⟩ and
Consequently, we have
Δ⟨,⟩ = { y ∈ ΨxX | ⟨, ⟩ |=ℎ lxXyY }</p>
        <p>⋀︁
y∈Δ⟨,⟩
lxXyY →</p>
        <p>⋁︁
y∈Ψ∖Δ⟨,⟩</p>
        <p>lxXyY
set |/X|(x) = {txXyY | y ∈ Δ⟨,⟩} = [Δ⟨,⟩].
⟨, ⟩ |= (16) if  |= (16) and</p>
        <p>⟨,⟩ is not a conjunctive term of (16)
if ⟨,⟩ is not a conjunctive term of (16)
if Δ⟨,⟩ justifies op(set |/X|(x)) ≺ 
if  |= op|([Δ⟨,⟩]* ) ≺ 
if  |= op(set |/X|(x)) ≺ 
if  |= 
if ⟨, ⟩ |= 
Lemma 15. Let Π be a program,  be the set of all predicate symbols in  * other than comparisons,
ℱ be the set of all function symbols corresponding set symbols. Then,
⟨, ⟩ |=ℎ  Π
if</p>
        <p>⟨, ⟩ |=ℎ gr ℱ ( * Π)
for every agg-ht-interpretation ⟨, ⟩.</p>
        <p>Proof. Recall that comparisons are not intensional in the definition of the stable models of
a program, that is, they do not belong to . Then, it is easy to see that  Π can be obtained
from gr ℱ ( * Π) by replacing each occurrence of op(set |/X|(x)) ≺ , where op is an
operation name, by its corresponding formula of the form of (15): Here  is the set of subsets Δ
of ΨxX that do not justify op(set |/X|(x)). Hence, it is enough to show that
⟨, ⟩ |=ℎ op(set |/X|(x) ≺ ) if
⟨, ⟩ |=ℎ (15)
This follows from Lemma 15.</p>
        <p>In the following two Lemmas, Π is a program,  is the set of all predicate symbols in  *
other than comparisons, ℱ is the set of all function symbols corresponding set symbols, and
let  be an agg-interpretation.</p>
        <p>Lemma 16.  is an FT-agg-stablemodel of  Π if it is an FT-agg-stablemodel of gr  ( * Π).
Proof. By Lemma 15,  Π and gr  ( * Π) have the same agg-ht-models.</p>
        <p>Lemma 17. ℐ is an FT-stable model of  Π if  is an agg-stable model of  * Π.</p>
        <p>Proof. ℐ is an FT-stable model of  Π
if  is an FT-agg-stable model of  Π
if  is an FT-agg-stable model of gr  ( * Π)
if  is an agg-stable model of  * Π.</p>
        <p>(Lemma 9)
(Lemma 16)
(Lemma 12)
Lemma 18. A set  of ground atoms is an FT-stable model of  Π if there is some  agg-stable
model of  * Π such that  = Ans().</p>
        <p>Proof. The right-to-left direction follows directly from Lemma 17 by taking noting that there
are no comparison symbols in  Π. For the left-to-right direction let  be an agg-interpretation
such that (t) is true if (t) belongs to . Then,  is the set of all ground atoms in ℐ that do
not contain comparison symbols and, since  Π does not contain comparison symbols, it follows
that ℐ is a FT-stable model of  Π too. The result follows now by Lemma 17.</p>
        <p>Lemma 19.  is a stable model of SCA ∪ Γ if  is a agg-stable model of Γ.</p>
        <p>Proof. By definition,  is a agg-stable model of Γ if  is an agg-model of Γ and there is no
agg-ht-interpretation ⟨, ⟩ with  &lt;ℱ  such that ⟨, ⟩ satisfies Γ if (Propositions 1 and 2)
if  is a model of SCA ∪ Γ and there is no agg-ht-interpretation ⟨, ⟩ with  &lt;ℱ  such
that ⟨, ⟩ satisfies SCA ∪ Γ if  is a stable model of SCA ∪ Γ.</p>
        <p>Proof of Theorem 1. Let Π be a program. Then,</p>
        <p>is a gringo answer set of Π.
if  is an FT-stable model of  Π
if (Lemma 18) there is an agg-stable model  of  * Π such that Ans() = 
if (Lemma 19) there is an stable model  of SCA ∪  * Π such that Ans() = 
if  is a fo-gringo answer set of Π
Lemma 20. ⟨, ⟩ |=  ↔  if</p>
        <p>Proof. ⟨,  ⟩ |=  ↔ 
if ⟨,  ⟩ |=  →  and ⟨,  ⟩ |=  → 
if both
•  |=  →  and either  ̸|=  or  ̸|=  or both  |=  and  |= , and
•  |=  →  and either  ̸|=  or  ̸|=  or both  |=  and  |=  ;
•  |=  →  and  |=  →  , and
• either  ̸|=  or  ̸|=  or both  |=  and  |= , and
• either  ̸|=  or  ̸|=  or both  |=  and  |=  ;
•  |=  ↔ , and
•  |=  and  |=  implies  |=  and  |= , and
•  |=  and  |=  implies  |=  and  |=  ;
•  |=  ↔ , and
•  |=  implies  |= , and
•  |=  implies  |=  ;
•  |=  ↔ , and
•  |=  ↔ .</p>
        <p>
          Lemma 21. Let  be an aggregate element of the form (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ) with free variables X and bound
variables Y and let ⟨,  ⟩ be a standard ht-interpretation. Let x be a list of ground terms of
sort prg of the same length as X, tuple a domain element of sort tuple, ′ = ()xX and ′ = ()xX.
Then, ⟨,  ⟩ dlv-staisfies (13) if the the following two conditions are equivalent:
1. tuple belongs to set ||(x) ,
2. there is a list c of domain elements of sort prg of the same length as Y such that
tuple = ⟨(′1′) , . . . , (′′)⟩ and  satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY
and y = c* ,
and the the following two conditions are aslo equivalent:
3. tuple belongs to set ||(x) ,
4. there is a list c of domain elements of sort prg of the same length as Y such that
tuple = ⟨(′1′) , . . . , (′′)⟩ and  satisfies 1′′ ∧ · · · ∧ ′′ with ′′ = (′)yY and ′′ = (′)yY
and y = c* .
        </p>
        <p>Proof. From Lemma 20, ⟨,  ⟩ dlv-staisfies (13) if both  and  satisfy (13). The result follows
now by Lemma 1.</p>
        <p>Proof of Proposition 3. Pick any list c of domain elements of sort prg and let x = c* . Then,
the result follows directly by Lemma 21.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          , Answer Set Programming, Springer-Verlag,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Simons</surname>
          </string-name>
          , I. Niemelä, T. Soininen,
          <article-title>Extending and implementing the stable model semantics</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>138</volume>
          (
          <year>2002</year>
          )
          <fpage>181</fpage>
          -
          <lpage>234</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>A.</given-names>
            <surname>Dovier</surname>
          </string-name>
          , E. Pontelli, G. Rossi, Intensional sets in CLP, in: C.
          <string-name>
            <surname>Palamidessi</surname>
          </string-name>
          (Ed.),
          <source>Logic Programming, 19th International Conference, ICLP 2003</source>
          , Mumbai, India, December 9-
          <issue>13</issue>
          ,
          <year>2003</year>
          , Proceedings, volume
          <volume>2916</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2003</year>
          , pp.
          <fpage>284</fpage>
          -
          <lpage>299</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>N.</given-names>
            <surname>Pelov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Denecker</surname>
          </string-name>
          , M. Bruynooghe,
          <article-title>Well-founded and stable semantics of logic programs with aggregates</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>7</volume>
          (
          <year>2007</year>
          )
          <fpage>301</fpage>
          -
          <lpage>353</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>T.</given-names>
            <surname>Son</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Pontelli</surname>
          </string-name>
          ,
          <article-title>A constructive semantic characterization of aggregates in answer set programming</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>7</volume>
          (
          <year>2007</year>
          )
          <fpage>355</fpage>
          -
          <lpage>375</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>P.</given-names>
            <surname>Ferraris</surname>
          </string-name>
          ,
          <article-title>Logic programs with propositional connectives and aggregates</article-title>
          ,
          <source>ACM Transactions on Computational Logic</source>
          <volume>12</volume>
          (
          <year>2011</year>
          )
          <volume>25</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          :
          <fpage>40</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>W.</given-names>
            <surname>Faber</surname>
          </string-name>
          , G. Pfeifer,
          <string-name>
            <given-names>N.</given-names>
            <surname>Leone</surname>
          </string-name>
          ,
          <article-title>Semantics and complexity of recursive aggregates in answer set programming</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>175</volume>
          (
          <year>2011</year>
          )
          <fpage>278</fpage>
          -
          <lpage>298</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gelfond</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y. Zhang,</surname>
          </string-name>
          <article-title>Vicious circle principle and logic programs with aggregates</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>14</volume>
          (
          <year>2014</year>
          )
          <fpage>587</fpage>
          -
          <lpage>601</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gelfond</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y. Zhang,</surname>
          </string-name>
          <article-title>Vicious circle principle, aggregates, and formation of sets in ASP based languages</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>275</volume>
          (
          <year>2019</year>
          )
          <fpage>28</fpage>
          -
          <lpage>77</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>P.</given-names>
            <surname>Cabalar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Fandinno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Schaub</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Schellhorn</surname>
          </string-name>
          ,
          <article-title>Gelfond-zhang aggregates as propositional formulas</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>274</volume>
          (
          <year>2019</year>
          )
          <fpage>26</fpage>
          -
          <lpage>43</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fandinno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Lühne</surname>
          </string-name>
          , T. Schaub,
          <article-title>Verifying tight logic programs with anthem and vampire</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>20</volume>
          (
          <year>2020</year>
          )
          <fpage>735</fpage>
          -
          <lpage>750</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>J.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Palla</surname>
          </string-name>
          ,
          <article-title>A reductive semantics for counting and choice in answer set programming</article-title>
          , in: D.
          <string-name>
            <surname>Fox</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          Gomes (Eds.),
          <source>Proceedings of the Twenty-third National Conference on Artificial Intelligence (AAAI'08)</source>
          , AAAI Press,
          <year>2008</year>
          , pp.
          <fpage>472</fpage>
          -
          <lpage>479</lpage>
          .
          <source>Artificial Intelligence</source>
          <volume>273</volume>
          (
          <year>2019</year>
          )
          <fpage>56</fpage>
          -
          <lpage>93</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [29]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gebser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Harrison</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kaminski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          , T. Schaub, Abstract Gringo,
          <source>Theory and Practice of Logic Programming</source>
          <volume>15</volume>
          (
          <year>2015</year>
          )
          <fpage>449</fpage>
          -
          <lpage>463</lpage>
          . doi:
          <volume>10</volume>
          .1017/S1471068415000150.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [30]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gebser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Harrison</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kaminski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          , T. Schaub,
          <article-title>Abstract gringo</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>15</volume>
          (
          <year>2015</year>
          )
          <fpage>449</fpage>
          -
          <lpage>463</lpage>
          . doi:
          <volume>10</volume>
          .1017/s1471068415000150.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [31]
          <string-name>
            <given-names>M.</given-names>
            <surname>Truszczyński</surname>
          </string-name>
          ,
          <article-title>Connecting first-order ASP and the logic FO(ID) through reducts</article-title>
          , in: E. Erdem,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Lierler</surname>
          </string-name>
          , D. Pearce (Eds.),
          <source>Correct Reasoning: Essays on Logic-Based AI in Honour of Vladimir Lifschitz</source>
          , volume
          <volume>7265</volume>
          of Lecture Notes in Computer Science, Springer-Verlag,
          <year>2012</year>
          , pp.
          <fpage>543</fpage>
          -
          <lpage>559</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [32]
          <string-name>
            <given-names>D.</given-names>
            <surname>Pearce</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Valverde</surname>
          </string-name>
          ,
          <article-title>Quantified equilibrium logic and foundations for answer set programs</article-title>
          , in: M.
          <string-name>
            <surname>Garcia de la Banda</surname>
          </string-name>
          , E. Pontelli (Eds.),
          <source>Proceedings of the Twenty-fourth International Conference on Logic Programming (ICLP'08)</source>
          , volume
          <volume>5366</volume>
          of Lecture Notes in Computer Science, Springer-Verlag,
          <year>2008</year>
          , pp.
          <fpage>546</fpage>
          -
          <lpage>560</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -89982-2\ _
          <fpage>46</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [33]
          <string-name>
            <given-names>M.</given-names>
            <surname>Bartholomew</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <article-title>On the stable model semantics for intensional functions</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>13</volume>
          (
          <year>2013</year>
          )
          <fpage>863</fpage>
          -
          <lpage>876</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [34]
          <string-name>
            <given-names>A.</given-names>
            <surname>Harrison</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          ,
          <article-title>Relating two dialects of answer set programming</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>19</volume>
          (
          <year>2019</year>
          )
          <fpage>1006</fpage>
          -
          <lpage>1020</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [35]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fandinno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Hansen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Lierler</surname>
          </string-name>
          ,
          <article-title>Axiomatization of aggregates in answer set programming</article-title>
          ,
          <source>Proceedings of the AAAI Conference on Artificial Intelligence</source>
          <volume>36</volume>
          (
          <year>2022</year>
          )
          <fpage>5634</fpage>
          -
          <lpage>5641</lpage>
          . doi:
          <volume>10</volume>
          . 1609/aaai.v36i5.
          <fpage>20504</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>