我对lambda-calculus很新,我正在尝试进行以下练习,但我无法解决它。
uncurry(curry E) = E
有人可以帮助我吗?
答案 0 :(得分:2)
假设以下定义(您需要检查它们是否与您的定义匹配)
// creates a pair of two values
pair := λx.λy.λf. fxy
// selects the first element of the pair
first := λp. p(λx.λy. x)
// selects the second element of the pair
second := λp. p(λx.λy. y)
// currys f
curry := λf.λx.λy . f (pair x y)
// uncurrys f
uncurry := λf.λp . f (first p) (second p)
你显示
uncurry(curry E) = E
将上述定义插入咖喱和取消
uncurry(curry E)
导致
(λf.λp . f (first p) (second p)) ( (λf.λx.λy . f (pair x y)) E)
然后使用lambda-caluclus的缩减规则减少上述术语,即使用:
http://en.wikipedia.org/wiki/Lambda_calculus http://www.mathstat.dal.ca/~selinger/papers/lambdanotes.pdf
应该导致
E
如果你写下每个减少步骤,你就证明了
uncurry(curry E) = E
这里是一个草图,它应该是什么样子:
uncurry(curry E) = // by curry-, uncurry-definion
(λf.λp . f (first p) (second p)) ( (λf.λx.λy . f (pair x y)) E) = // by pair-definiton
(λf.λp . f (first p) (second p)) ( (λf.λx.λy . f (λx.λy.λf. fxy x y)) E) = // 2 alpha-conversions
(λf.λp . f (first p) (second p)) ( (λf.λx.λy . f (λa.λb.λf. fab x y)) E) = // 2 beta-reductions
(λf.λp . f (first p) (second p)) ( (λf.λx.λy . f (λf. fxy)) E) = // ...
...
...
... = // β-reduction
E