将翻转lambda转换为SKI术语

时间:2015-03-31 21:55:19

标签: lambda lambda-calculus combinators k-combinator s-combinator

我无法将lambda转换为SKI组合器(我希望这很有意义)。这是我的转换:

/fxy.fyx
/f./x./y.fyx
/f./x.S (/y.fy) (/y.x)
/f./x.S f (/y.x)
/f./x.S f (K x)
/f.S (/x.S f) (/x.K x)
/f.S (/x.S f) K
/f.S (S (/x.S) (/x.f)) K
/f.S (S (K S) (K f)) K
S (/f.S (S (K S) (K f))) (/f.K)
S (/f.S (S (K S) (K f))) (K K)
S (S (/f.S) (/f.S (K S) (K f))) (K K) 
S (S (K S) (/f.S (K S) (K f))) (K K)
S (S (K S) (S (/f.S (K S)) (/f.K f))) (K K)
S (S (K S) (S (/f.S (K S)) K)) (K K)
S (S (K S) (S (S (/f.S) (/f.K S)) K)) (K K)
S (S (K S) (S (S (K S) (/f.K S)) K)) (K K)
S (S (K S) (S (S (K S) (S (/f.K) (/f.S))) K)) (K K)
S (S (K S) (S (S (K S) (S (K K) (K S))) K)) (K K)

如果我在B,C,K,W系统中正确理解,C是翻转的,它在SKI术语中的定义是S (S (K (S (K S) K)) S) (K K)。显然我的答案与C组合子不一样......以下是我用于转换的规则:

K y = /x.y  - K combinator
(SKK) = /x.x  -  I combinator
(S (/x.f) (/x.g)) = (/x.fg)  -  S combinator
y = (/x.yx)  -  eta reduction
/x./y.f = /xy.f  - currying
Note that the S rule can convert longer expressions - for example, λ x.abcdeg can be converted by setting f = abcde.

我错过了什么?

1 个答案:

答案 0 :(得分:4)

一旦答案被接受,我就修改了它,我发现它实际上是错误的。

你的最终结果是正确的,虽然它不是"官方"在教科书中回答,但有可能不同的SKI术语实际上等同于同一个lambda表达式。

openssl rsa -in private_key_file.pem -pubout -outform DER -out java_readable_file.der

根据最左侧的减少顺序,上述推导证明您的最终术语等同于C组合子。