Type inference and semi-unification

F. Henglein
{"title":"Type inference and semi-unification","authors":"F. Henglein","doi":"10.1145/62678.62701","DOIUrl":null,"url":null,"abstract":"The Milner Calculus is the typed &lgr;-calculus underlying the type system for the programming language ML [Har86] and several other strongly typed polymorphic functional languages such as Miranda [Tur86] and SPS [Wan84]. Mycroft [Myc84] extended the problematical typing rule for recursive definitions and proved that the resulting calculus, termed Milner-Mycroft Calculus here, is sound with respect to Milner's [Mil78] semantics and that it preserves the principal typing property [DM82] of the Milner Calculus. The extension is of practical significance in typed logic programming languages [MO84] and, more generally, in any language with (mutually) recursive definitions. Mycroft didn't solve the decidability problem for typings in this calculus, though. This was an open problem independently raised also by Meertens [Mee83]. The decidability question was answered in the affirmative just recently by Kfoury et al. in [KTU88]. We show that the type inference problems in the Milner and the Milner-Mycroft Calculi can be reduced to solving equations and inequations between first-order terms, a problem we have termed semi-unification. We show that semi-unification problems have most general solutions in analogy to unification problems — which translates into principal typing properties for the underlying calculi. In contrast to the (essentially) nonconstructive methods of [KTU88] we present functional specifications, which we prove partially correct, for computing the most general solution of semi-unification problems, and we devise a concrete nondeterministic algorithm on a graph-theoretic representation for computing these most general solutions. Finally, we point out some erroneous statements about the efficiency of polymorphic type checking that have persisted throughout the literature including an incorrect claim, submitted by ourselves, of polynomial time type checking in the Milner-Mycroft Calculus.","PeriodicalId":119710,"journal":{"name":"Proceedings of the 1988 ACM conference on LISP and functional programming","volume":"23 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1988-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"60","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 1988 ACM conference on LISP and functional programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/62678.62701","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 60

Abstract

The Milner Calculus is the typed &lgr;-calculus underlying the type system for the programming language ML [Har86] and several other strongly typed polymorphic functional languages such as Miranda [Tur86] and SPS [Wan84]. Mycroft [Myc84] extended the problematical typing rule for recursive definitions and proved that the resulting calculus, termed Milner-Mycroft Calculus here, is sound with respect to Milner's [Mil78] semantics and that it preserves the principal typing property [DM82] of the Milner Calculus. The extension is of practical significance in typed logic programming languages [MO84] and, more generally, in any language with (mutually) recursive definitions. Mycroft didn't solve the decidability problem for typings in this calculus, though. This was an open problem independently raised also by Meertens [Mee83]. The decidability question was answered in the affirmative just recently by Kfoury et al. in [KTU88]. We show that the type inference problems in the Milner and the Milner-Mycroft Calculi can be reduced to solving equations and inequations between first-order terms, a problem we have termed semi-unification. We show that semi-unification problems have most general solutions in analogy to unification problems — which translates into principal typing properties for the underlying calculi. In contrast to the (essentially) nonconstructive methods of [KTU88] we present functional specifications, which we prove partially correct, for computing the most general solution of semi-unification problems, and we devise a concrete nondeterministic algorithm on a graph-theoretic representation for computing these most general solutions. Finally, we point out some erroneous statements about the efficiency of polymorphic type checking that have persisted throughout the literature including an incorrect claim, submitted by ourselves, of polynomial time type checking in the Milner-Mycroft Calculus.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
类型推理和半统一
米尔纳演算是编程语言ML [Har86]和其他几种强类型多态函数式语言(如Miranda [Tur86]和SPS [Wan84])的类型系统的类型化演算。Mycroft [Myc84]扩展了递归定义的有问题的类型规则,并证明了由此产生的微积分(此处称为Milner-Mycroft微积分)在Milner [Mil78]语义方面是合理的,并且它保留了Milner微积分的主要类型属性[DM82]。这种扩展在类型化逻辑编程语言中具有实际意义[MO84],更一般地说,在任何具有(相互)递归定义的语言中都具有实际意义。不过,麦考夫并没有解决这个微积分中类型的可判定性问题。这也是Meertens [Mee83]独立提出的一个开放性问题。最近,Kfoury等人在[KTU88]中对可决性问题给出了肯定的回答。我们证明了米尔纳和米尔纳-麦考夫微积分中的类型推理问题可以简化为求解一阶项之间的方程和不等式,我们称之为半统一问题。我们表明,半统一问题具有与统一问题类似的最一般的解决方案-这转化为底层微积分的主要类型属性。与[KTU88]的(本质上)非构造方法相反,我们提出了功能规范,我们证明了部分正确,用于计算半统一问题的最一般解,并且我们在图论表示上设计了一个具体的非确定性算法来计算这些最一般解。最后,我们指出了一些关于多态类型检查效率的错误陈述,这些陈述一直存在于整个文献中,包括我们自己提交的关于Milner-Mycroft微积分中多项式时间类型检查的错误主张。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Objects as closures: abstract semantics of object-oriented languages Continuations may be unreasonable Exact real computer arithmetic with continued fractions A unified system of parameterization for programming languages Syntactic closures
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1