Text substitution based interpreter: recursive definition and some additional instructions for lambda calculus

Source: Internet
Author: User
Tags definition empty

This one is connected to the back of the first lambda calculus. Tell me something about maths.

Often something that seems easy to understand, once described correctly, becomes extremely troublesome. In software engineering, there is a similar situation: 20% of the code to achieve the core functionality, leaving 80% of the code to deal with the boundary situation. As a result, most of the text in the so-called exact description illustrates the boundary situation, with only a few words in the core concept-like a patched suit, completely invisible. The emergence of this phenomenon is either the human brain is flawed, difficult and accurate understanding of the concept, that is, humans are too stupid, or the language system has problems, it is difficult to express the concept of simplicity, and the invention of the new language system of human still very stupid. No wonder "God laughs when man thinks." This section intends to describe the meaning of some symbols in the $\lambda$ calculus as rigorously as possible, hoping that it will not be too cumbersome.

Recursive definition

The list $list$ of real numbers is generally defined as: \BEGIN{EQUATION*}\BEGIN{ARRAY}{LCL} List &=& {nil} \ &|& \left<r, list\right> \end{array}\end{equation*} where nil is an empty list, $\left<a, b\right>$ represents a two-tuple containing $a$ and $b$, $R $ represents a collection of real numbers.

This grammar actually defines a set $list$, and I rewrite the $list$ definition with the notation of the set operation: \BEGIN{EQUATION*}\BEGIN{ARRAY}{LCL} List &=& \{{nil}\} \ &\ cup& \{\left<r, l\right> | r \in R, l \in list\} \end{array} \end{equation*} This is a recursive definition. Recursive definitions are difficult to understand for people who have not been exposed to it. We now think that the recursive definition is very intuitive, maybe just {\bf used to} This kind of thing. What is difficult to understand in a recursive definition is that we use the defined object itself where we describe the definition.

For example, I now want to know what $list$ is. I have $list$ this symbol in my mind, but I don't know what $list$ represents. Then I looked at the definition and saw that the second line in the definition was $list$, but I didn't know what $list$ was.

So, in order to explain exactly what a recursive definition is, I use a constructive method to define $list$.

First, the base situation is the empty list nil, which constructs a set containing only nil, recorded as $list_0$. \[list_0 = \{{nil}\} \] Add an element to nil to generate a linked list that contains only one element. The collection of all the linked lists that contain only one element and then $list_0$ is the collection of all the elements that are less than or equal to 1, recorded as $list_1$. \BEGIN{EQUATION*}\BEGIN{ARRAY}{LCL} list_1 &=& \{{nil}\} \ &\cup& \{\left<r, l\right> | r \in R, l \in list_0\} \end{array} \end{equation*} and so on, you can construct a collection of linked lists that contain all elements less than or equal to 2 $list_2$, and the collection of all the elements that are less than or equal to 3, $list_3$ ... In general, you can construct a collection of linked lists that contain all the number of elements less than or equal to $i$ ($i >0$) $list_i$: \BEGIN{EQUATION*}\BEGIN{ARRAY}{LCL} list_i &=& \{{nil}\} \ \ &\cup& \{\left<r, l\right> | r \in R, l \in list_{i-1}\} \end{array} \end{equation* when the $i$ tends to infinity, we get a collection of linked lists $List $: \[List = \lim_{i \rightarrow \infty}{list_i} \] By the way, this is the limit, and perhaps the explanation of what the limits of the set mean, the limit is not convergent and so on. However, it is in his own right to understand what it means. As you can see, a recursive definition is a definition that involves "infinity." Many things are troublesome once they are involved in infinity.

What happens when $i$ tends to infinity in the definition of $list_i$? Because when the $i$ tends to infinity there is $list_i = list_{i-1} = list$, so we get the recursive definition of $list$.

The following describes the syntax of the $\lambda$ calculus in the same way: \BEGIN{EQUATION*}\BEGIN{ARRAY}{LCL} m_0 &=& X \ m_i &=& x \ &\cup& \ {\lambda X.M | x \in x, M \in m_{i-1}\} \ &\cup& \{(M \ n) | m \in m_{i-1}, n \in m_{i-1}\} \ M &=&\dis Playstyle \lim_{i \rightarrow \infty}{m_i} \end{array} \end{equation*}

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/project/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.