Beta减少Lambda微积分 [英] Beta reduction of Lambda Calculus

查看:96
本文介绍了Beta减少Lambda微积分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下lambda演算:

I have the following lambda calculus:

1)λx.katze(x)(加菲猫)

1) λx . katze(x)(Garfield)

2)λP.λxP(x)(茶)

2) λP . λx . P(x)(tea)

3)λy.λx喜欢(x,y)(Mia)

3) λy . λx . likes(x, y)(Mia)

如何通过Beta减少来减少它们?

How do I reduce them with the Beta Reduction?

我的解决方案:

1)katze(加菲猫)

1) katze (Garfield)

2)茶

3)喜欢(Mia)

推荐答案

执行beta缩减时,可以使用提供的值将绑定变量替换为lambda函数.表示法是 [param:= value] ,然后选择给出的第一个变量.

When performing beta reduction, you substitute the bound variable to the lambda function with the value supplied. The notation for that is [param := value] and you pick up the first variable that is given.

在这种情况下λx.katze(x)(加菲猫)-> katze(加菲猫)缩小是正确的.我们用 x 变量代替了 Garfield ,并在过程中删除了λx,只保留了表达式.这是将要采取的步骤:

In the case λx . katze(x)(Garfield) -> katze (Garfield) the reduction is correct. We've substituted the x variable for Garfield and removed λx in the process leaving just the expression inside. Here are the steps that would be taken:

λx.katze(x)(加菲猫)

= katze(x)[x:= Garfield]

= katze(加菲猫)

但是,其他两个都不正确.您会忘记自己有一个lambda函数,其中的表达式是另一个lambda函数.由于您有一个单个输入,因此您只需减少一个函数-第一个函数,剩下的一个.您可以将其剥离掉外层而露出内层.

However, the other two are not correct. You are forgetting that you have a lambda function where the expression inside is another lambda function. Since you have a single input, you only have to reduce one function - the first one, leaving the other. You can think of it of peeling off the outer one and exposing the inner.

λP的情况下.λxP(x)(tea)可以更好地表示为(λP.(λx.P(x)))(tea),现在每个lambda函数都用方括号括起来.因为我们只提供一个输入 tea ,所以我们只解析带有参数 P 的外部函数(为清楚起见,保留了方括号):

In the case of λP . λx . P(x)(tea) this can be better represented as (λP . (λx . P(x)))(tea) where now each lambda function is surrounded by brackets. Since we supply a single input tea, we only resolve the outer function with parameter P (leaving the brackets for some clarity):

(λP.(λx.P(x)))(茶)

= (λx.P(x))[P:=茶]

= (λx.P(x))

= λx.茶(x)

或者没有括号:

λP.λxP(x)(茶)

= λx.P(x)[P:=茶]

= λx.茶(x)

对于最后一个功能,当仅给出一个输入时,仍然存在着删除两个功能的相同问题.正确的减少步骤是:

As for the final function, it still has the same problem that you are removing both functions, when only one input is given. The correct reduction steps are:

λy.λx喜欢(x,y)(Mia)

= λx.喜欢(x,y)[y:= Mia]

= λx.喜欢(x,Mia)

这篇关于Beta减少Lambda微积分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆