Type dependencies for logic programs using ACI-unification (original) (raw)
Related papers
Analysis of Polymorphically Typed Logic Programs Using ACI-Unification
Lecture Notes in Computer Science, 2001
Analysis of (partial) groundness is an important application of abstract interpretation. There are several proposals for improving the precision of such an analysis by exploiting type information, icluding our own work with Hill and King [SHK00], where we had shown how the information present in the type declarations of a program can be used to characterise the degree of instantiation of a term in a precise and yet inherently finite way. This approach worked for polymorphically typed programs as in Gödel or HAL. Here, we recast this approach following Codish, Lagoon and Stuckey [CL00, LS01]. To formalise which properties of terms we want to characterise, we use labelling functions, which are functions that extract subterms from a term along certain paths. An abstract term collects the results of all labelling functions of a term. For the analysis, programs are executed on abstract terms instead of the concrete ones, and usual unification is replaced by unification modulo an equality theory which includes the well-known ACI-theory. Thus we generalise [CL00, LS01] w.r.t. the type systems considered and relate those two works.
A Framework for Analysis of Typed Logic Programs
2001
The paper presents a novel approach to the analysis of typed logic programs. We assume regular type descriptions of logic program variables provided by regular tree grammars. Types are used to identify components of terms which can be equated during the programs execution. This information is
Optimizing the runtime processing of types in a higher-order logic programming language
2005
The traditional purpose of types in programming languages of providing correctness assurances at compile time is increasingly being supplemented by a direct role for them in the computational process. In the specific context of typed logic programming, this is manifest in their effect on the unification operation. Their influence takes two different forms. First, in a situation where polymorphism is permitted, type information is needed to determine if different occurrences of the same name in fact denote an identical constant. Second, type information may determine the specific form of a binding for a variable. When types are needed for the second purpose as in the case of higher-order unification, these have to be available with every variable and constant. However, in many situations such as first-order and higher-order pattern unification it turns out that types have no impact on the variable binding process. As a consequence, type examination is needed in these situations only for the first of the two purposes described and even here a careful preprocessing can considerably reduce their runtime footprint. We develop a scheme for treating types in these contexts that exploits this observation. Under this scheme, type information is elided in most cases and is embedded into term structure when this is not entirely possible. Our approach obviates types when properties known as definitional genericity and type preservation are satisfied and has the advantage of working even when these conditions are violated.
A Rewriting Logic Approach to Type Inference: Technical Report
Meseguer and Rosu [MR04,MR07] proposed rewriting logic semantics (RLS) as a programing language definitional framework that unifies operational and algebraic denotational semantics. Once a language is defined as an RLS theory, many generic tools are immediately available for use with no additional cost to the designer. These include a formal inductive theorem proving environment, an efficient interpreter, a state space explorer, and even a model checker. RLS has already been used to define a series of didactic and real languages [MR04, MR07], but its benefits in connection with defining and reasoning about type systems have not been fully investigated yet. This paper shows how the same RLS style employed for giving formal definitions of languages can be used to define type systems. The same term-rewriting mechanism used to execute RLS language definitions can now be used to execute type systems, giving type checkers or type inferencers. Since both the language and its type system ar...
More Precise Yet Efficient Type Inference for Logic Programs
Lecture Notes in Computer Science, 2002
Type analyses of logic programs which aim at inferring the types of the program being analyzed are presented in a unified abstract interpretation-based framework. This covers most classical abstract interpretation-based type analyzers for logic programs, built on either top-down or bottom-up interpretation of the program. In this setting, we discuss the widening operator, arguably a crucial one. We present a new widening which is more precise than those previously proposed. Practical results with our analysis domain are also presented, showing that it also allows for efficient analysis.
A First-Order Theory of Types and Polymorphism in Logic Programming
1991
A logic called typed predicate calculus (TPC) that gives declarative meaning to logic programs with type declarations and type inference is introduced. The proper interaction between parametric and inclusion varieties of polymorphism is achieved through a construct called type dependency, which is analogous to implication types but yields more natural and succinct specifications. Unlike other proposals where typing has extra-logical status, in TPC the notion of type-correctness has precise model-theoretic meaning that is independent of any specific type-checking or type-inference procedure. Moreover, many different approaches to typing that were proposed in the past can be studied and compared within the framework of TPC. Another novel feature of TPC is its reflexivity with respect to type declarations; in TPC, these declarations can be queried the same way as any other data. Type reflexivity is useful for browsing knowledge bases and, potentially, for debugging logic programs
Inferring precise polymorphic type dependencies in logic programs
Proceedings of the 10th international ACM SIGPLAN conference on Principles and practice of declarative programming, 2008
We present a new analysis that infers polymorphic type dependencies in logic programs. The analysis infers more precise information than previous type dependency inference analyses. The improvement in precision is achieved by making use of set union as a type constructor and nondeterministic type definitions.
Dependence Analysis Through Type Inference
We introduce a method for dependence analysis in typed functional programming languages. Our approach relies on a type system with simple subtypes for specifying dead code and a type inference algorithm for it. Through a careful seperation of the type system and the problem-specific assumptions we avoid ad hoc rules in the type system. This, combined with the fact that our approach makes the flow information in a program explicit and is based on well-understood concepts makes our approach a good candidate for a general framework for program analysis. Our technique can be used in optimizing compilers, optimization of programs extracted from theorem provers, optimization of modular systems, and software engineering.
Domain construction for mode analysis of typed logic programs
1997
There are many applications where precise mode analysis is required. However, within the framework of abstract interpretation, the precision of an analyser depends, in part, on the expressiveness of the abstract domain and its associated abstraction function. This paper considers abstract domains for polymorphically typed logic programs where each nonvariable symbol is explicitly typed. We show how to construct precise domains and their abstraction functions that re ect the declared structure of terms. This domain construction is modular in that an abstract domain for a type does not depend on modules that import this type. A program is abstracted by replacing the uni cation operations with abstract uni cation operations. The precision of the domains is demonstrated for several examples using G odel programs. Correctness of the method is proven. The domain construction has been implemented in G odel.