简体   繁体   English

自然数和有效简单类型的lambda演算术语之间的映射是什么?

[英]What is a mapping between natural numbers and valid simply typed lambda calculus terms?

Is there any efficient algorithm that maps between well-typed, closed terms of the simply typed lambda calculus and natural numbers? 是否有任何有效的算法可以在简单类型的lambda演算和自然数的良好类型,闭合项之间进行映射? For example, using bruijn indexes (and probably on incorrect order): 例如,使用bruijn索引(可能是错误的顺序):

0 → (λ 0)
1 → (λ (λ (0 1)))
2 → (λ (λ (1 0)))
3 → (λ 0 (λ 0))
4 → (λ (λ 0) 0)
5 → (λ (λ 1) 0)
6 → ... so on

Related questions: is there an algorithm that maps between natural numbers and normalized terms of the simply typed lambda calculus? 相关问题:是否存在一种算法,可以在简单类型的lambda演算的自然数和标准化项之间进行映射? Also, the same questions applied to the untyped lambda calculus. 此外,相同的问题适用于无类型的lambda演算。

The Binary Lambda Calculus defines a binary encoding for any closed term in the untyped lambda calculus, and also suggests a bijection between natural numbers and binary strings, but the former is not surjective. 二元Lambda微积分定义了无类型lambda演算中任何闭合项的二进制编码,并且还建议自然数和二进制字符串之间的双射,但前者不是满射的。 Still, the paper http://arxiv.org/abs/1401.0379 "Counting Terms in the Binary Lambda Calculus" might yield efficient ranking/unranking mappings. 尽管如此,论文http://arxiv.org/abs/1401.0379 “计算Binary Lambda微积分中的术语”可能会产生有效的排名/排名映射。

Due to the highly context-sensitive nature of typed lambda calculus I would be surprised if there were an efficient algorithm, or rather a "natural" efficient algorithm. 由于类型化的lambda演算具有高度上下文敏感性,如果有一种有效的算法,或者更确切地说是“自然的”有效算法,我会感到惊讶。

This paper has nice formulae for counting untyped lambda terms and from that they derive a fairly simple function for enumerating untyped terms. 本文有很好的公式来计算无类型的 lambda术语,并从中得出一个相当简单的函数来枚举无类型的术语。 They also provide a counting function for normal forms which should be easy to adapt to a generating function too. 它们还为普通形式提供计数功能,这也很容易适应生成功能。 Unfortunately, they only make a typed generator function by filtering that which is absurdly expensive (one of the results of the paper is just how absurd it is). 不幸的是,他们只通过过滤那些非常昂贵的类型来生成类型生成器功能(该论文的结果之一就是多么荒谬)。

As for a more efficient way to generate typed terms, my advice would be to generate typing derivations instead of terms and then type checking them. 至于生成类型化术语的更有效方法,我的建议是生成类型派生而不是术语,然后键入检查它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否有可能有效地评估lambda演算术语? - Is it possible to evaluate lambda calculus terms efficiently? Racket 定义的渐进式 lambda 演算的“重复”语法? - The `repeat` syntax of gradual typed lambda calculus defined by Racket? 什么是枚举lambda术语的算法? - What is an algorithm to enumerate lambda terms? 位于A和B之间(包括两个端点)的所有自然数的AND - AND of all natural numbers lying between A and B both inclusive 将自然数转换为三比特字符串的简单算法是什么? - What is a simple algorithm to convert natural numbers to tribit strings? 在算法效率方面,减去ASCII值与简单地减去整数之间有区别吗? - Is there a difference in terms of algorithm efficiency between subtracting ASCII values and simply subtracting an integer? 找到前N个自然数的多个因子的最佳算法是什么? - What is the best algorithm to find number of factors of first N natural numbers? 这个算法将坐标映射到称为的数字是什么? - What is this algorithm mapping coordinates to numbers called? 考虑以下代码片段。 假设A [0…n]是一个数组,其元素是0到n之间的自然数 - Consider the following code fragment. Suppose that A[0…n] is an array whose elements are natural numbers between 0 and n 用C语言编写一个程序,将输出给定数字之间的第一项和大量数字序列的项数 - Write a program in C that will output the first term and the number of terms of the sequence of abundant numbers between given numbers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM