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

查看:17
本文介绍了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?

推荐答案

Lambda 抽象是 λx.M,对于某些变量 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.MN 原则上可以读作 λ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天全站免登陆