"value": This is actual data or instructions stored on the computer.
You are trying to think about it very specifically from the point of view of a machine that, I am afraid, may confuse you. It’s better to think about it from the point of view of mathematics: value is simply a thing that never changes, for example, the number 42, the letter "H" or the sequence of letters that make up the "Hello World".
Another way to think about it is in terms of mental models. We come up with mental models to indirectly talk about the world; talking about mental models, we make predictions about things in the real world. We write computer programs that help us work with these mental models reliably and in large volumes.
Values are things in the mental model. Bits and bytes are just a coding model in computer architecture.
"variable": this is a way to determine the location of the data, a link to replace the value, but not the data set or instructions stored on the computer.
A variable is simply a name that denotes a value in a specific area of the program. Each time a variable is evaluated, its value must be sought in the environment. There are several implementations of this concept in computer terms:
- The stack frame in an impatient language is an implementation of the environment for finding the values of a local variable each time the subroutine is called.
- The compiler provides environments for finding global scope names when a program is compiled or loaded into memory.
"abstraction" <=> "function" ∈ syntactic form.
Abstraction and function are not equivalent. In the lambda calculus, "abstraction" is a type of syntactic expression, but a function is a value.
One analogy that is not too shabby is names and descriptions versus things. Names and descriptions are part of the language, and things are part of the world. You could say that the meaning of a name or description is what it calls or describes.
Languages contain both simple names for things (for example, 12 is a name for the number twelve), as well as more complex descriptions of things ( 5 + 7 - a description of the number twelve). Lambda abstraction - a description of the function; for example, the expression \x -> x + 7 is a description of a function that adds seven to its argument.
The trick is that when descriptions become very complex, it is not easy to understand what they describe. If I give you 12345 + 67890 , you need to do some work to figure out which number I just described. Computers are machines that are faster and more reliable than we can do.
"application": it accepts the input of "abstraction", and the input of the "lambda expression" leads to the "lambda expression".
An application is simply an expression with two subexpressions that describes the meaning as follows:
- The first subexpression means function.
- The second subexpression means some meaning.
- The application as a whole means a value that leads to the application of the function in (1) to the value from (2).
In formal semantics (and don't be afraid of the word), we often use double brackets ⟦∙⟧ to mean "meaning"; for example ⟦dog⟧ = "meaning of the dog." Using these notation:
⟦e1 e2⟧ = ⟦e1⟧(⟦e2⟧)
where e1 and e2 are any two expressions or terms (any variable, abstraction, or application).
"abstraction" is called abstraction because in the usual definition of a function, we shorten the body of the function (usually longer) into a much shorter form, that is, the identifier of the function, followed by a list of formal parameters. (Although lambda abstractions are anonymous functions, other functions usually have a name.)
Honestly, I never thought about whether the term "abstraction" is suitable for this or why it was chosen. As a rule, with mathematics, he does not pay to ask such questions, unless the terms were very poorly chosen and mislead people.
"constant" ∈ "variable"
"literal" ∈ "value"
The lambda calculus itself does not have the concepts of "permanent" and "literal." But one way to define them is:
- A literal is an expression that, due to the rules of the language, always has the same meaning no matter where it occurs.
- A constant, in a purely functional language, is a variable in the very top area of a program. Each (without shadow) use of this variable will always have the same value in the program.
"formal parameter" ∈ "variable"
"actual parameter" (argument) ∈ "value"
A formal parameter is one of the uses of a variable. In any expression of the form λv.e (where v is a variable and e is an expression), v is a formal variable.
An argument is any expression (not a value!) That occurs as the second subexpression of the application.
a "variable" may have a "value" of "data" => for example. the variable "a" has a value of 3
All expressions have values, not just variables. For example, 5 + 7 is an application, and it has a value of 12.
a "variable" may also have a "value" of a "set of instructions" => for example. the + operator is a variable
The value + is a function - it is a function that adds its arguments. A set of instructions is an implementation of this function.
Think of a function as an abstract table that says, for each combination of argument values, what is the result. The way to enter instructions is as follows:
- For many functions, we cannot literally implement them as a table. If added, this is because the table will be infinitely large.
- Even for functions where we can list cases, we want to implement them much more concisely and efficiently.
But the way you check that the implementation of the function is correct, in a sense, checks that in each case it does the same thing as the "endless table". The two sets of instructions that both verify in this way are indeed two different implementations of the same function.