arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1003.5954cs.PLcs.LOmath.CT
收藏

多阶段规划是广义箭头

Multi-Stage Programs are Generalized Arrows

Adam Megacz

摘要:

受类型限制的λ演算提供了一种用于carbohydrate闭范畴的内部语言的语法。本文建立了一个平行的结果:分期注释,受命名水平的限制,提供了一个语法的内部语言的Freyd类别,这是已知的双射对应箭头。这种联系是通过将多级类型系统解释为从多项式范畴到其重索引的索引函子来实现的。这个结果只适用于多阶段语言,这些语言是(1)同构的,(2)允许跨阶段持久化,(3)在类型化派生中对结构规则的使用没有限制。移除这些限制并重复构造会产生广义箭头,其中Arrow是一种特殊情况。提供了从良好类型的多阶段程序到单阶段Garrow术语的翻译。翻译是由归纳法定义的结构证明,多阶段程序是良好类型的,依赖于信息编码的证明中使用的结构规则。元语言设计者现在可以通过提供从分级语法到广义箭头类型表达式的单一翻译来分解元编程的语法机制。对象语言提供程序只需要以无点样式实现通用箭头类型类的函数。对象语言的使用者可以在这些对象语言上以点式的风格编写元程序,在对象语言和元语言中使用相同的绑定、作用域、抽象和应用机制。本文的主要贡献是图2和图3的Garrow定义,图5中的翻译和定义16的范畴理论语义。伴随的Coq证明形式化了类型系统,翻译过程和关键定理。

英文摘要:

The lambda calculus, subject to typing restrictions, provides a syntax for the internal language of cartesian closed categories. This paper establishes a parallel result: staging annotations, subject to named level restrictions, provide a syntax for the internal language of Freyd categories, which are known to be in bijective correspondence with Arrows. The connection is made by interpreting multi-stage type systems as indexed functors from polynomial categories to their reindexings. This result applies only to multi-stage languages which are (1) homogeneous, (2) allow cross-stage persistence and (3) place no restrictions on the use of structural rules in typing derivations. Removing these restrictions and repeating the construction yields generalized arrows, of which Arrows are a particular case. A translation from well-typed multi-stage programs to single-stage GArrow terms is provided. The translation is defined by induction on the structure of the proof that the multi-stage program is well-typed, relying on information encoded in the proof's use of structural rules. Metalanguage designers can now factor out the syntactic machinery of metaprogramming by providing a single translation from staging syntax into expressions of generalized arrow type. Object language providers need only implement the functions of the generalized arrow type class in point-free style. Object language users may write metaprograms over these object languages in a point-ful style, using the same binding, scoping, abstraction, and application mechanisms in both the object language and metalanguage. This paper's principal contributions are the GArrow definition of Figures 2 and 3, the translation in Figure 5 and the category-theoretic semantics of Definition 16. An accompanying Coq proof formalizes the type system, translation procedure, and key theorems.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑