Typing as functional-logic evaluation

  • Authors:
  • Francisco J. López-Fraguas;Enrique Martin-Martin

  • Affiliations:
  • Universidad Complutense de Madrid, Madrid, Spain;Universidad Complutense de Madrid, Madrid, Spain

  • Venue:
  • PEPM '13 Proceedings of the ACM SIGPLAN 2013 workshop on Partial evaluation and program manipulation
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present a transformational approach to type inference for functional logic programs. More concretely, we give a broad set of examples showing how, given a functional logic program P, we can synthesize a remarkably simple and natural functional logic program P' such that the evaluation of expressions with respect to P' corresponds to typing the expressions in the original P. We start developing those ideas for the case of type inference with standard Hindley-Milner types, and after that we consider some variations, like local definitions with different degrees of polymorphism, existential types and type checking in the presence of polymorphic recursion. For the basic case of Hindley-Milner types we provide also a formalization of the transformation and proofs of its correctness. Besides its potential applicability to the implementation of different type systems, or to the educational use of the synthesized typing programs to explain different type inference/checking processes, the paper demonstrates vividly the expressive power of functional logic languages, as well as some of their limitations for metaprogramming purposes, that we have overcome by providing a suitable set of metalogical functions to inspect, classify and manipulate expressions according to their structure, similar to well known Prolog metapredicates for such purposes.