A parametric analysis is an analysis whose input and output are parametrized with a number of parameters which can be instantiated to abstract properties after analysis is completed. This paper proposes to use Cousot and Cousot's Cardinal power domain to capture functional dependencies of analysis output on its input and obtain a parametric analysis by parametrizing a non-parametric base analysis. We illustrate the method by parametrizing a $\pos$ based groundness analysis of logic programs to a parametric groundness analysis. In addition, a prototype implementation shows that generality of the parametric groundness analysis comes with a negligible extra cost.
Deep Dive into Parametrizing Program Analysis by Lifting to Cardinal Power Domains.
A parametric analysis is an analysis whose input and output are parametrized with a number of parameters which can be instantiated to abstract properties after analysis is completed. This paper proposes to use Cousot and Cousot’s Cardinal power domain to capture functional dependencies of analysis output on its input and obtain a parametric analysis by parametrizing a non-parametric base analysis. We illustrate the method by parametrizing a $\pos$ based groundness analysis of logic programs to a parametric groundness analysis. In addition, a prototype implementation shows that generality of the parametric groundness analysis comes with a negligible extra cost.
A program analysis is to infer information from programs. Let P be a program, I express input information before analysis, and O express output information inferred from P and I . We write I , P, O to denote the analysis that infers O from P and I . A typical program analysis is non-parametric in the sense that the program need be analyzed separately for different input information. Note that program variables are not parameters for input information, though input information can be thought of as predicates over program variables. Take the generic sorting program sort(x, y) for instance, letting nat denote the set of natural numbers, int the set of integers, and list (β) the set of lists of elements from β, program analyses x ∈ list (nat ), sort(x, y), y ∈ list (nat ) and x ∈ list (int ), sort(x, y), y ∈ list (int ) are accomplished separately even if they are two instances of a parametric analysis x ∈ list (β), sort(x, y), y ∈ list (β) where both input information and output information are parametrized. By assigning different values to β which serves as a place holder for information to be filled in after analysis, x ∈ list (β), sort(x, y), y ∈ list (β) can be instantiated into many different non-parametric analyses such as x ∈ list (nat ), sort(x, y), y ∈ list (nat) and x ∈ list (int ), sort(x, y), y ∈ list (int ) . Parametric program analyses infer more general results, which brings some benefits. Firstly, a sub-program or a library program need not be analyzed separately for its different uses, i.e., the result of a parametric analysis is re-usable. This has positive bearing on efficiency of analysis because output information for different uses of the same sub-program can be obtained by instantiation rather than by re-analysis. Secondly, parametric analyses are amenable to program modifications since changes to the program does not necessitate re-analyses of the sub-program so long as the sub-program itself is not changed.
This paper addresses the issue of lifting a non-parametric analysis to a parametric analysis such that each instantiation of the result of running the parametric analysis is same as the result of running the non-parametric analysis with instantiated input information. If I (β), P, O(β) is the result of the parametric analysis then I (κ), P, O(κ) is the result of the non-parametric analysis for any possible value κ for β. Observe that both input I (β) and output O(β) of the parametric analysis are functions from the domain of values for parameters to the domain of input properties non-parametric analysis.
The contributions of the paper are as follows. Firstly, a systematic approach is presented for deriving a parametric analysis from a given non-parametric base analysis. This involves lifting the semantic domain for the base analysis to its Cardinal power with respect to the domain of parameter values and lifting the semantic function accordingly. Secondly, this approach is applied to a goaldependent groundness analysis for logic programs using parameters to express groundness of variables in the top-level goal. The result is a parametric goal dependent groundness analysis. Thirdly, we present an encoding for the abstract properties and abstract operations for the parametric groundness analysis using positive propositional formulas.
The next section provides background knowledge on abstract interpretation and logic program analysis. Section 3 describes the approach to parametrizing program analyses and section 4 obtains the parametric goal-dependent groundness analysis for logic programs by applying the approach. Section 5 presents the encoding and section 6 some experimental results with a prototype implementation of the parametric groundness analysis. We discuss related work in section 7 and then conclude in section 8.
A semantics of a program is given by an interpretation (D, ⊑ D ), f where (D, ⊑ D ) is a complete lattice and f is a monotone function on (D, ⊑ D ). The semantics is defined as the least fixed point lfp f of f . The concrete semantics of the program is given by the concrete interpretation (D, ⊑ D ), f while an abstract semantics is given by an abstract interpretation (D ♯ , ⊑ ♯ D ), f ♯ . The correspondence between the concrete and the abstract domains is formalized by a Galois connection (α, γ) between (D, ⊑ D ) and (D ♯ , ⊑ ♯ D ). A Galois connection between D ♯ and D is a pair of monotone functions α : D → D ♯ and γ :
. The function α is called an abstraction function and the function γ a concretization function. A sufficient condition for lfpf ♯ to be a safe abstraction of lfp
), according to propositions 24 and 25 in [9]. In a compositional design of analysis, the concrete semantics is defined in terms of a group of semantic functions f i : D i → E i and the abstract semantics is defined in terms of another group of semantic function f ♯ i : D ♯ i → E ♯ i such that each abstract semantic function f ♯ i simulates its corresponding concrete semantic function
…(Full text truncated)…
This content is AI-processed based on ArXiv data.