## Dimension Inference under Polymorphic Recursion (1995)

Venue: | In Proc. 7th Conf. Functional Programming Languages and Computer Architecture |

Citations: | 9 - 1 self |

### BibTeX

@INPROCEEDINGS{Rittri95dimensioninference,

author = {Mikael Rittri},

title = {Dimension Inference under Polymorphic Recursion},

booktitle = {In Proc. 7th Conf. Functional Programming Languages and Computer Architecture},

year = {1995},

pages = {147--159},

publisher = {ACM Press}

}

### OpenURL

### Abstract

Numeric types can be given polymorphic dimension parameters, in order to avoid dimension errors and unit errors. The most general dimensions can be inferred automatically. It has been observed that polymorphic recursion is more important for the dimensions than for the proper types. We show that, under polymorphic recursion, type inference amounts to syntactic semi-unification of proper types, followed by equational semi-unification of dimensions. Syntactic semi-unification is unfortunately undecidable, although there are procedures that work well in practice, and proper types given by the programmer can be checked. However, the dimensions form a vector space (provided that their exponents are rational numbers). We give a polynomial-time algorithm that decides if a semi-unification problem in a vector space can be solved and, if so, returns a most general semi-unifier. 1 Introduction We will combine three good things as far as possible: dimension types, polymorphic recursion, and aut...