<!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>A taxonomy of program analyses</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gianluca Amato</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Maria Chiara Meo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Francesca Scozzari</string-name>
          <email>francesca.scozzarig@unich.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dipartimento di Economia, Universita di Chieti-Pescara</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>where D? = N [ f?g.</p>
      <p>
        In most cases we are only interested in determining some properties of the
semantics of a system speci ed by a set A of abstract objects. Formally, an
abstract interpretation2 for a concrete domain C is a pair (A; ) where A is
partially ordered by A (the approximation ordering ) and : C ! A maps every
semantic property to the strongest (smallest) abstract property it enjoys. An
1 For easiness of presentation, we do not consider here higher-order functions.
2 The abstract interpretation framework here used is the one presented in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] under
the \existence of a best abstract approximation assumption". Not all the abstract
interpretations may be formalized in this way, such as polyhedral analysis [
        <xref ref-type="bibr" rid="ref11 ref2 ref3 ref4 ref5">11, 3, 2,
4, 5</xref>
        ].
example of a simple and useful abstraction is strictness [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. We say that a
function f : D? ! D? is strict if f (?) = ?. The strictness abstract interpretation
is Str = (fstr ; &gt;g; str ) where str &gt; and
str (f ) =
      </p>
      <p>&gt;
(str if f (?) = ?,
otherwise.</p>
      <p>Clearly, str (JprogK) = str since prog describes a strict function.
1.1</p>
      <p>
        Collecting Semantics
In most cases abstract interpretations are de ned starting from a so-called
collecting semantics. According to [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], a collecting semantics is \a version of the
standard semantics reduced to essentials in order to ignore irrelevant details
about program execution". Thus, a collecting semantics should be an
abstraction precise enough that many other abstractions may be derived from it. We
say that the abstraction (B; B) may be derived from (A; A), or that (A; A)
is more precise than (B; B), when for each b 2 B there exists a 2 A such that,
for any c 2 C, B(c) b () A(c) a.
      </p>
      <p>
        For example, consider the collecting semantics CS1 for the concrete domain
C = D? ! D? de ned in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]: the abstract domain is P(D?) ![ P(D?), the
set of complete join-morphisms from P(D?) to itself ordered pointwise, and
      </p>
      <p>CS1 (f ) = X 2 P(D?):f (X), where f (X) is the image of f through X. It
turns out that strictness may be derived from CS1. Actually, we have that:
{
{
str (f )
str (f )
CS1 (f?g)
&gt; is always true, hence it is equivalent to CS1 (f ) X:D?;
str means that f is a strict function, which is equivalent to
f?g, i.e., CS1 (f ) str by de ning
str =</p>
      <p>X:
(X</p>
      <p>D?
if X f?g,
otherwise.</p>
      <p>
        However, not all the abstractions may be recovered from CS1. Consider the
property of absence. We say that a function is absent if it ignores its arguments.
This gives origin to the absence abstract interpretation [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] de ned as Abs =
(fabs; &gt;g; abs ) where abs &gt; and
abs (f ) =
      </p>
      <p>&gt;
(abs if 8x 2 D?: f (x) = f (?),</p>
      <p>otherwise.</p>
      <p>
        It turns out that absence cannot be recovered from CS1, since there is no element
in the abstract domain of CS1 which exactly corresponds to the set of all the
absent functions. However, more precise collecting semantics may be used to
derive abs, such as CS2 [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] which has P(D? ! D?) as the abstract domain
and CS2 (f ) = ff g as the abstraction function. Then, abs (c) abs is equivalent
to CS2 (f ) ff j abs (f ) absg. We can also compare the relative precision of
two collecting semantics. It is easily shown that CS1 may be derived from CS2,
since CS1 (f ) i CS2 (f ) ff 0 j CS1 (f 0) g.
      </p>
    </sec>
    <sec id="sec-2">
      <title>A category of abstract interpretations</title>
      <p>We now formalize the notion of precision which arises from the previous
considerations and characterize the collecting semantics using the category theory3. We
recall that a Galois connection (Gc) is a pair of maps h ; i : A B such that
(a) b , a (b). Given a set C, we de ne the category AI(C) whose objects
are abstract interpretations and whose morphisms from (A; A) to (B; B) are
Galois connections h ; i : A B such that B = A. Identity and
composition of arrows work as in the category of Galois connections. This de nition of
the category of abstract interpretations naturally arises from the practical uses
of abstract interpretation and represents a strengthening of the notion of
derivability between abstractions, since the existence of a morphism h ; i : A B
implies that B is derivable from A. The following proposition shows that there
is a Gc from CS2 to CS1 but not from CS1 to CS2, which re ects our intuition
that CS2 is strictly more precise than CS1, and that CS1 is a suitable collecting
semantics for strictness but not for the absence property.</p>
      <p>Proposition 1. The following properties hold:
{ there is no Gc h 12; 12i : CS1
{ there is a Gc h 21; 21i : CS2
{ there is a Gc h 1str ; 1str i : CS1</p>
      <p>CS2 such that CS2 =
CS1 such that CS1 =</p>
      <p>Str such that str =
When an abstract interpretation (A; A) is designed starting from the collecting
semantics (S; S ), it means that (A; A) is derivable from (S; S ), hence there
is a map from (S; S ) to (A; A) in our category AI(C). In addition, it would
be preferable to have a canonical way of deriving one from the other. This leads
to the notion of initial object in a category: if (S; S ) is initial for a given full
subcategory D of AI(C), it means that all the abstract interpretations in D may
be reduced to (S; S ) in a unique canonical way.</p>
      <p>
        Given a collecting semantics (S; S ), we are interested in characterizing the
maximal full subcategory D of AI(C) such that (S; S ) is initial for D. Such
subcategories immediately induce a taxonomy on program analysis which precisely
characterizes the program properties suitable for a given collecting semantics.
3 Since the very beginning of the abstract interpretation theory, there have been work
on categorical approaches to abstract interpretation (see, for instance, [
        <xref ref-type="bibr" rid="ref1 ref14 ref15 ref6">1, 6, 14, 15</xref>
        ]).
In the rest of the section, we show that for the two collecting semantics CS1 e
CS2, such a full subcategory can be constructively described.
      </p>
      <p>We rst show that CS2 is initial for all the abstract interpretations which
have enough joins, and that this is the largest class of abstract interpretations
which enjoys this property.</p>
      <p>De nition 2 (Having enough joins). We say that the abstract interpretation
(A; A) has enough joins when WA X exists for each X which is a subset of the
image of A.</p>
      <p>Obviously, if A is a complete join-semilattice, than (A; A) has enough joins.
Theorem 3. The full subcategory of all the abstract interpretations which have
enough joins is the largest class of abstractions for which the collecting semantics
CS2 is initial.</p>
      <p>The maximality of the class of abstract interpretations which have enough joins
allows us to completely characterize the analyses which reduce to the collecting
semantics CS2. We now show that the collecting semantics CS1 is initial for a
large class of abstract interpretations, which can be constructively characterized.
De nition 4 (Mix of functions). We say that a function g : D? ! D? is a
mix of the set of functions F D? ! D? i for each x 2 D? there exists f 2 F
such that g(x) = f (x).</p>
      <p>De nition 5 (Mixable interpretations). Let (A; A) be an abstract
interpretation such that A has enough joins. We call (A; A) mixable if, for any set
of functions F D? ! D?, whenever g is a mix of functions in F , we have
A(g) W A(f ).</p>
      <p>f2F</p>
      <p>An interpretation is mixable when deciding whether (f ) a may be done
by looking at the values of f for a single element of the domain at a time. This
observation is formalized by the following lemma.</p>
      <p>Lemma 6. Let (A; A) be a mixable interpretation. Then
D? 9f 0 s.t. f 0(x) = f (x) ^ A(f 0) a.</p>
      <p>A(f )
a () 8x 2
This lemma can be exploited to characterize mixable abstract interpretations:
{ the strictness abstract interpretation is mixable, since we only need to check
the single value of f (?) in order to decide whether a function is strict;
{ the absence abstract interpretation is not mixable, since we need to compare
the values computed by f for di erent arguments;
{ the totality abstract interpretation, which decides whether a function is total,
i.e., for all x 2 D? n f?g we have that f (x) 6= ? is mixable, since we just
need to see the value of f for (many) single arguments, without the need of
comparing them.</p>
      <p>We now show that all the mixable interpretations may be designed starting from
the collecting semantics CS1.</p>
      <p>Theorem 7. The full subcategory of all the mixable abstract interpretations is
the largest class of abstractions for which the collecting semantics CS1 is initial.</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>
        Static analyses formalized in the abstract interpretation framework are de ned
starting from a collecting semantics, which is a fundamental choice in the design
of any abstract interpretation, but few works in the literature systematically
study collecting semantics. [
        <xref ref-type="bibr" rid="ref10 ref9">9, 10</xref>
        ] present many collecting semantics, without
giving a general method for choosing the right one. Mostly authors simply use
one of the already de ned collecting semantics or invent a new one for a speci c
abstraction (e.g., [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] for logic programs). On the contrary, we start from the
definition of two most commonly used collecting semantics and derive a taxonomy
on program analysis. Most importantly we show that the sets of abstract
interpretations that can be derived from them can be constructively characterized.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>S.</given-names>
            <surname>Abramsky</surname>
          </string-name>
          .
          <article-title>Abstract interpretation, logical relations, and Kan extensions</article-title>
          .
          <source>Journal of Logic and Computation</source>
          ,
          <volume>1</volume>
          (
          <issue>1</issue>
          ):5{
          <fpage>40</fpage>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>G.</given-names>
            <surname>Amato</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Di Nardo Di Maio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. C.</given-names>
            <surname>Meo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Scozzari</surname>
          </string-name>
          .
          <article-title>Descending chains and narrowing on template abstract domains</article-title>
          .
          <source>Acta Informatica</source>
          ,
          <volume>55</volume>
          (
          <issue>6</issue>
          ):
          <volume>521</volume>
          {
          <fpage>545</fpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>G.</given-names>
            <surname>Amato</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Di Nardo Di Maio</surname>
          </string-name>
          and
          <string-name>
            <given-names>F.</given-names>
            <surname>Scozzari</surname>
          </string-name>
          <article-title>Numerical static analysis with Soot</article-title>
          .
          <source>In Proc. ACM SIGPLAN SOAP</source>
          . ACM Press,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Gianluca</given-names>
            <surname>Amato</surname>
          </string-name>
          and
          <string-name>
            <given-names>Francesca</given-names>
            <surname>Scozzari</surname>
          </string-name>
          .
          <article-title>Observational completeness on abstract interpretation</article-title>
          .
          <source>Fundamenta Informaticae</source>
          ,
          <volume>106</volume>
          (
          <issue>2</issue>
          {4):
          <volume>149</volume>
          {
          <fpage>173</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Gianluca</given-names>
            <surname>Amato</surname>
          </string-name>
          and
          <string-name>
            <given-names>Francesca</given-names>
            <surname>Scozzari</surname>
          </string-name>
          . Random:
          <article-title>R-based Analyzer for Numerical Domains</article-title>
          .
          <source>In Proc. LPAR-18, LNCS</source>
          , vol.
          <volume>7180</volume>
          :
          <issue>375</issue>
          {
          <fpage>382</fpage>
          . Springer,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>K.</given-names>
            <surname>Backhouse</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Backhouse</surname>
          </string-name>
          .
          <article-title>Safety of abstract interpretations for free, via logical relations and galois connections</article-title>
          .
          <source>Science of Computer Programming</source>
          ,
          <volume>51</volume>
          (
          <issue>1</issue>
          ):
          <volume>153</volume>
          {
          <fpage>196</fpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cousot</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Cousot</surname>
          </string-name>
          .
          <article-title>Abstract interpretation: A uni ed lattice model for static analysis of programs by construction or approximation of xpoints</article-title>
          .
          <source>In Proc. POPL '77</source>
          , pages
          <fpage>238</fpage>
          {
          <fpage>252</fpage>
          . ACM Press,
          <year>1977</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cousot</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Cousot</surname>
          </string-name>
          .
          <article-title>Systematic design of program analysis frameworks</article-title>
          .
          <source>In Proc. POPL '79</source>
          , pages
          <fpage>269</fpage>
          {
          <fpage>282</fpage>
          . ACM Press,
          <year>1979</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cousot</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Cousot</surname>
          </string-name>
          .
          <article-title>Abstract interpretation frameworks</article-title>
          .
          <source>Journal of Logic and Computation</source>
          ,
          <volume>2</volume>
          (
          <issue>4</issue>
          ):
          <volume>511</volume>
          {
          <fpage>549</fpage>
          ,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cousot</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Cousot</surname>
          </string-name>
          .
          <article-title>Higher-order abstract interpretation (and application to comportment analysis generalizing strictness, termination, projection and PER analysis of functional languages)</article-title>
          .
          <source>In Proc. ICCL</source>
          , pages
          <volume>95</volume>
          {
          <fpage>112</fpage>
          . IEEE Press,
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>P.</given-names>
            <surname>Cousot</surname>
          </string-name>
          and
          <string-name>
            <given-names>N.</given-names>
            <surname>Halbwachs</surname>
          </string-name>
          .
          <article-title>Automatic discovery of linear restraints among variables of a program</article-title>
          .
          <source>In Proc. POPL '78</source>
          , pages
          <fpage>84</fpage>
          {
          <fpage>97</fpage>
          ,
          <year>1978</year>
          . ACM Press.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>R.</given-names>
            <surname>Giacobazzi</surname>
          </string-name>
          .
          <article-title>"Optimal" collecting semantics for analysis in a hierarchy of logic program semantics</article-title>
          .
          <source>In Proc. STACS</source>
          , LNCS, vol.
          <volume>1046</volume>
          :
          <issue>503</issue>
          {
          <fpage>514</fpage>
          . Springer,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>A.</given-names>
            <surname>Mycroft</surname>
          </string-name>
          .
          <article-title>The theory and practice of transforming call-by-need into call-by-value</article-title>
          .
          <source>In Proc. Int. Symposium on Programming, LNCS</source>
          , vol.
          <volume>83</volume>
          :
          <issue>269</issue>
          {
          <fpage>281</fpage>
          . Springer,
          <year>1980</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>P.</given-names>
            <surname>Panangaden</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Mishra</surname>
          </string-name>
          .
          <article-title>A category theoretic formalism for abstract interpretation</article-title>
          .
          <source>Technical Report UUCS-84-005</source>
          , University of Utah,
          <year>1984</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>A.</given-names>
            <surname>Venet</surname>
          </string-name>
          .
          <article-title>Abstract co bered domains: Application to the alias analysis of untyped programs</article-title>
          .
          <source>In Proc. SAS '96, LNCS</source>
          , vol.
          <volume>1145</volume>
          :
          <issue>366</issue>
          {
          <fpage>382</fpage>
          . Springer,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>P.</given-names>
            <surname>Wadler</surname>
          </string-name>
          and
          <string-name>
            <given-names>R. J. M.</given-names>
            <surname>Hughes</surname>
          </string-name>
          .
          <article-title>Projections for strictness analysis</article-title>
          .
          <source>In Proc. FPCA</source>
          , LNCS, vol.
          <volume>274</volume>
          :
          <issue>385</issue>
          {
          <fpage>407</fpage>
          . Springer,
          <year>1987</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>