Well-typed narrowing with extra variables in functional-logic programming

  • Authors:
  • Francisco López-Fraguas;Enrique Martin-Martin;Juan Rodríguez-Hortalá

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

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

Quantified Score

Hi-index 0.00

Visualization

Abstract

Narrowing is the usual computation mechanism in functional-logic programming (FLP), where bindings for free variables are found at the same time that expressions are reduced. These free variables may be already present in the goal expression, but they can also be introduced during computations by the use of program rules with extra variables. However, it is known that narrowing in FLP generates problems from the point of view of types, problems that can only be avoided using type information at run-time. Nevertheless, most FLP systems use static typing based on Damas-Milner type system and they do not carry any type information in execution, thus ill-typed reductions may be performed in these systems. In this paper we prove, using the let-narrowing relation as the operational mechanism, that types are preserved in narrowing reductions provided the substitutions used preserve types. Based on this result, we prove that types are also preserved in narrowing reductions without type checks at run-time when higher order (HO) variable bindings are not performed and most general unifiers are used in unifications, for programs with transparent patterns. Then we characterize a restricted class of programs for which no binding of HO variables happens in reductions, identifying some problems encountered in the definition of this class. To conclude, we use the previous results to show that a simulation of needed narrowing via program transformation also preserves types.