应用和抽象的Lambda演算优先级 [英] lambda calculus precedence of application and abstraction

查看:104
本文介绍了应用和抽象的Lambda演算优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Application has higher precedence than abstraction.

从这个意义上讲,lambda演算抽象是什么?我对优先级感到困惑吗?

In this sense, what is lambda calculus abstraction? I'm confused at what there is to have precedence over?

推荐答案

对于某些变量x和任意项M,Lambda抽象为λx.M. 对于某些任意术语MN,应用程序为(MN).

Lambda abstraction is λx.M, for some variable x and arbitrary term M.
Application is (MN), for some arbitrary terms M and N.

优先权是一个问题,如果一个以上的读数是可能的,则应首先执行几个操作中的哪一个,因为该术语由于省略了方括号而变得模棱两可.例如,在算术中,按惯例乘法优先于加法,这意味着5+2×3读为5+(2×3)而不是(5+2)×3.首先对乘法运算符求值,并将最接近它的项绑定在一起,然后将加法运算放在第二位,并嵌入乘法项.

Precdence is the question which of several operation is to be performed first if more than one reading is possible because the term is ambiguous due to ommission of brackets. For example in arithmetic, multiplication by convention has precedence over addition, which means that 5+2×3 is read as 5+(2×3) and not as (5+2)×3. The multiplication operator is evaluated first and binds the terms closest to it, and addition comes secondary, embedding the multiplication term.

W.r.t.对于lambda演算,约定应用程序具有比抽象程序更高的优先级的约定意味着,在有疑问的情况下,由于省略了方括号,您将首先尝试形成一个应用程序,然后才执行抽象程序,因此应用程序绑定"更强,并且具有抽象术语将在以后形成并包含申请条款.

W.r.t. to lambda calculus, the convention that application has higher precedence than abstraction means that in case of doubt because brackets have been ommitted, you will first try to form an application and only afterwards perform abstraction, so application "binds" stronger, and an abstraction term will be formed later and subsume the application term.

例如,λx.M N原则上可以理解为λx.(MN)(λx.M)M,但是由于应用程序的优先级高于应用程序,因此您首先要形成可能的应用程序(MN),然后再构成抽象λx.(MN).如果相反,也就是说,如果抽象优先于应用程序,则您将首先尝试形成抽象术语(λx.M),然后使用具有您已经获得的术语((λx.M)M)的应用程序. 因此,通过定义该应用程序优先于抽象λx.M N = λx.(MN)而不是((λx.M)M).

E.g., λx.M N could in principle be read as either λx.(MN) or (λx.M)M, but since application has precedence over application, you first form the possible application (MN) and then the abstraction λx.(MN). If it were the other way round, i.e. if abstraction had precedence over application, then you would first try to form an abstraction term (λx.M), then application with the term you already got ((λx.M)M).
So by defining that application has precedence over abstraction, λx.M N = λx.(MN), and not ((λx.M)M).

这篇关于应用和抽象的Lambda演算优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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