Abstract
In this paper, program transformation is proposed as a way of handling type information efficiently. A typed program is translated to an untyped program, with regular unary predicates replacing the types, and then an attempt is made to eliminate as many of the unary type literals as possible. The method is as follows: first a query-answer transformation of the program with a given goal is made. This gives a specification of the calls to each literal in the program arising in the computation of the goal. The set of calls defines the context of the literal in the computation. Any literal can be eliminated if its answers are implied by its context. We define a procedure for eliminating literals defined by regular programs, a class which includes the type literals. A regular approximation of the query-answer program is made, and then decidable properties of regular programs are used to check for the elimination of the literal. The method can be compared with type-checking, since the elimination procedure also shows whether some type literal fails, indicating a “badly-typed” clause. Our aim however is not to construct a type system, but rather to show that simple types can be handled using a general framework of program analysis and transformation.
Work supported by ESPRIT Project PRINCE (P5246)
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
A.V. Aho, J.E. Hoperoft, and J.D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.
M. Codish. Abstract Interpretation of Sequential and Concurrent Logic Programs. PhD thesis, The Weizmann Institute of Science, 1991.
P.W. Dart and J. Zobel. Transforming typed logic programs into well-typed logic programs. Technical Report 88/11, University of Melbourne, May 1988.
S. Debray and R. Ramakrishnan. Canonical computations of logic programs. Technical Report, University of Arizona-Tucson, July 1990.
D.A. de Waal and J. Gallagher. Regular Approximations Applied to the Specialisation of a Proof Procedure. Technical Report CSTR-92-19, University of Bristol, May 1992.
H.B. Enderton. A Mathematical Introduction to Logic. Academic Press, New York, 1972.
T. Frühwirth. Type inference by program transformation and partial evaluation. In H. Abramson and M.H. Rogers, editors, Meta-Programming in Logic Programming, 1988.
J. Gallagher. A System for Specialising Logic programs. Technical Report TR-91-32, University of Bristol, November 1991.
J. Gallagher and D.A. de Waal. Regular Approximations of Logic Programs and Their Uses. Technical Report CSTR-92-06, University of Bristol, March 1992.
P.M. Hill and J.W. Lloyd. The Gödel report. Technical Report TR-91-02, University of Bristol, March 1991. (preliminary version).
N. Jones. Flow analysis of lazy higher order functional programs. In S. Abramsky and C. Hankin, editors, Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.
T. Kanamori. Abstract interpretation based on Alexander templates. Technical Report TR-549, ICOT, March 1990.
T. Kanamori and H. Seki. Verification of Prolog programs using an extension of execution. In E. Shapiro, editor, Lecture Note in Computer Science, 225, pages 475-489, Springer-Verlag, 1986.
J.W. Lloyd. Foundations of Logic Programming: 2nd Edition. Springer-Verlag, 1987.
J.W. Lloyd and J.C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11 (3and4): 217 - 242, 1991.
C.S. Mellish. Using specialisation to reconstruct two mode inference systems. Technical Report, University of Edinburgh, March 1990.
P. Mishra. Towards a theory of types in prolog. In Proceedings of the IEEE International Symposium on Logic Programming, 1984.
A. Mycroft. A polymorphic type system. Artificial Intelligence, 23: 295307, 1984.
L. Naish. Types and the Intended Meaning of Logic Programs. Technical. Report, University of Melbourne, 1990.
D. Sahlin. An Automatic Partial Evaluator for Full Prolog. PhD thesis, The Royal Institute of Technology, 1991.
E. Yardeni and E. Shapiro. A type system for logic programs. Journal of Logic Programming, 10 (2): 348 - 375, 1991.
Zobel. Analysis of Logic Programs. PhD thesis, Technical Report 47, University of Melbourne, September 1990.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1993 Springer-Verlag London
About this chapter
Cite this chapter
Gallagher, J., de Waal, D.A. (1993). Deletion of Redundant Unary Type Predicates from Logic Programs. In: Lau, KK., Clement, T.P. (eds) Logic Program Synthesis and Transformation. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3560-9_11
Download citation
DOI: https://doi.org/10.1007/978-1-4471-3560-9_11
Publisher Name: Springer, London
Print ISBN: 978-3-540-19806-2
Online ISBN: 978-1-4471-3560-9
eBook Packages: Springer Book Archive