Lambda Tutorial (2016)

栏目: IT技术 · 发布时间: 4年前

内容简介:These web pages provide a practical introduction to lambda reduction, with a few pointers to more esoteric issues. I'm a linguist, and I have linguists in mind for my audience, so linguistic issues will be emphasized (e.g., a discussion of the interaction

Lambda tutorial

These web pages provide a practical introduction to lambda reduction, with a few pointers to more esoteric issues. I'm a linguist, and I have linguists in mind for my audience, so linguistic issues will be emphasized (e.g., a discussion of the interaction of lambda with other binding operators such as "exists" and "forall").

Browser issues : If your browser can handle JavaScript 1.2, and if you have JavaScript turned on, you will be able to evaluate examples by clicking on a button, and to make up your own examples to try; otherwise, the examples will just sit there. For instance, try clicking on the "Reduce" button:You should see the string "(it works)" appear in the second window. This is a live program written in JavaScript---you can type any expression into the input box and try reducing it (you need to spell out "lambda" in the input, the program will convert it to " λ " in the output). Character problems : As of May 2003, Internet Explorer doesn't seem to be able to print the forall or the exists symbols in the first paragraph above (you may see an empty box). But Opera and Mozilla (both with free versions) seem to do ok. Finally, Mozilla can't deal with the lambda symbol (" λ ") in JavaScript output, so for now all the lambdas are spelled out when they are in examples.

Goal : Church's λ -calculus provides a convenient way of representing meanings, whether meanings of programs or of expressions in English or some other natural language. As a result, it is ubiquitous in computer science, logic, and formal approaches to the semantics of natural language. The λ -calculus consists of two things: a formal language and an associated notion of REDUCTION (roughly equivalent to "computation"). In the context of the lambda calculus, reduction is specifically called λ -reduction. What these pages will attempt to do is teach you how to perform λ -reduction accurately and confidently.

Other sources : I recommend Hankin's Lambda Calculi : A Guide for Computer Scientists (Oxford) for a readable survey, and Barendregt's The Lambda Calculus (Elsevier) for a more complete reference work. Barendregt and Barendsen's shorter introduction to the lambda calculus is also excellent , and accessible electronically for free (if the citeseer link ceases to work, I've cached a copyhere; note for some mysterious reason pages 2, 3 and 4 are blank). Selinger has an excellent set of lecture notes covering many logical and computational aspects of the lambda calculus here . For a more linguistic perspective, chapter 2 of Carpenter's Type-Logical Semantics (MIT Press) presents a λ -calculus within a framework for describing natural language. The following is too fun not to mention: David Keenan, To dissect a mockingbird: a graphical notation for the lambda calculus with animated reduction .

Acknowledgements : Saber Ben Salem made a number of helpful suggestions.

Contents of this document:

    Binding: free versus bound
    β -reduction (the heavy lifting)
    α -reduction (alphabetic variants)
    Examples and practice
    Order of combination versus order of reduction; convergence
    Various alternative notational conventions
    The semantics of the λ -operator
    Scheme reference code

Binding: free versus bound

λ is a binding operator, just like backwards E ("∃") or upside down A ("∀"). Consequently, it always binds something (a variable), taking scope over some expression that (usually) contains occurrences of the bound variable. More practically, λ always occurs in the following configuration:

( λ var body)
Here, "var" is the variable bound by the lambda operator, and "body" is the constituent that the lambda operator has scope over.

For instance:

( λ x (* (+ 3 x) (- x 4)))
Here "x" is the variable (the one immediately after the binding operator), and the body is "(* (+ 3 x) (- x 4))". The body contains two occurrences of "x", and both are bound by the λ operator; any variable token that is not bound is free .
( λ x (* (+ y x) (- x z)))
In this form, the tokens of "y" and of "z" are both free.

Freedom is always relative to a particular expression. If the preceding expression is embedded within a larger one, the free variables can come to be bound:

(∃ y ( λ x (* (+ y x) (- x z))))
In this case, the "y" has been bound, and only the "z" remains free.

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

免费:商业的未来

免费:商业的未来

Chris Anderson / 中信出版集团 / 2015-10-1 / 35.40

《免费》,这是一个商业模式不断被颠覆、被改写的时代。一种商业模式既可以统摄未来市场,也可以挤垮当前市场——在我们这个现代经济社会里,这并不是一件不可能的事情。“免费”就是这样的一种商业模式,它代表了互联网时代的商业未来。 “免费”商业模式是一种建立在以电脑字节为基础上的经济学,而非过去建立在物理原子基础上的经济学。在原子经济中,随着时间的推移,我们周围的物品都在逐渐升值。但是在字节经济的网络......一起来看看 《免费:商业的未来》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换