Deletion of Redundant Unary Type Predicates from Logic Programs

  • J. Gallagher
  • D. A. de Waal
Part of the Workshops in Computing book series (WORKSHOPS COMP.)

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.

Keywords

Clari 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    A.V. Aho, J.E. Hoperoft, and J.D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. [2]
    M. Codish. Abstract Interpretation of Sequential and Concurrent Logic Programs. PhD thesis, The Weizmann Institute of Science, 1991.Google Scholar
  3. [3]
    P.W. Dart and J. Zobel. Transforming typed logic programs into well-typed logic programs. Technical Report 88/11, University of Melbourne, May 1988.Google Scholar
  4. [4]
    S. Debray and R. Ramakrishnan. Canonical computations of logic programs. Technical Report, University of Arizona-Tucson, July 1990.Google Scholar
  5. [5]
    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.Google Scholar
  6. [6]
    H.B. Enderton. A Mathematical Introduction to Logic. Academic Press, New York, 1972.MATHGoogle Scholar
  7. [7]
    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.Google Scholar
  8. [8]
    J. Gallagher. A System for Specialising Logic programs. Technical Report TR-91-32, University of Bristol, November 1991.Google Scholar
  9. [9]
    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.Google Scholar
  10. [10]
    P.M. Hill and J.W. Lloyd. The Gödel report. Technical Report TR-91-02, University of Bristol, March 1991. (preliminary version).Google Scholar
  11. [11]
    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.Google Scholar
  12. [12]
    T. Kanamori. Abstract interpretation based on Alexander templates. Technical Report TR-549, ICOT, March 1990.Google Scholar
  13. [13]
    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.Google Scholar
  14. [14]
    J.W. Lloyd. Foundations of Logic Programming: 2nd Edition. Springer-Verlag, 1987.Google Scholar
  15. [15]
    J.W. Lloyd and J.C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11 (3and4): 217 - 242, 1991.MathSciNetMATHGoogle Scholar
  16. [16]
    C.S. Mellish. Using specialisation to reconstruct two mode inference systems. Technical Report, University of Edinburgh, March 1990.Google Scholar
  17. [17]
    P. Mishra. Towards a theory of types in prolog. In Proceedings of the IEEE International Symposium on Logic Programming, 1984.Google Scholar
  18. [18]
    A. Mycroft. A polymorphic type system. Artificial Intelligence, 23: 295307, 1984.Google Scholar
  19. [19]
    L. Naish. Types and the Intended Meaning of Logic Programs. Technical. Report, University of Melbourne, 1990.Google Scholar
  20. [20]
    D. Sahlin. An Automatic Partial Evaluator for Full Prolog. PhD thesis, The Royal Institute of Technology, 1991.Google Scholar
  21. [21]
    E. Yardeni and E. Shapiro. A type system for logic programs. Journal of Logic Programming, 10 (2): 348 - 375, 1991.MathSciNetCrossRefGoogle Scholar
  22. [22]
    Zobel. Analysis of Logic Programs. PhD thesis, Technical Report 47, University of Melbourne, September 1990.Google Scholar

Copyright information

© Springer-Verlag London 1993

Authors and Affiliations

  • J. Gallagher
    • 1
  • D. A. de Waal
    • 1
  1. 1.Department of Computer ScienceUniversity of BristolBristolUK

Personalised recommendations