Type Inference by Coinductive Logic Programming

  • Authors:
  • Davide Ancona;Giovanni Lagorio;Elena Zucca

  • Affiliations:
  • DISI, Univ. of Genova, Genova, Italy 16146;DISI, Univ. of Genova, Genova, Italy 16146;DISI, Univ. of Genova, Genova, Italy 16146

  • Venue:
  • Types for Proofs and Programs
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We propose a novel approach to constraint-based type inference based on coinductive logic. Constraint generation corresponds to translation into a conjunction of Horn clauses P , and constraint satisfaction is defined in terms of the coinductive Herbrand model of P . We illustrate the approach by formally defining this translation for a small object-oriented language similar to Featherweight Java, where type annotations in field and method declarations can be omitted. In this way, we obtain a very precise type inference and provide new insights into the challenging problem of type inference for object-oriented programs. Since the approach is deliberately declarative, we define in fact a formal specification for a general class of algorithms, which can be a useful road map to researchers. Furthermore, despite we consider here a particular language, the methodology could be used in general for providing abstract specifications of type inference for different kinds of programming languages.