Article Directory
1.5 Assignment in context
How to reduce the expression ((f • t) • f) ? According to r relation or ↝↝ r relation, this expression cannot be reduced!
Intuitively, by applying the first sub-expression according to the rule of (f • t) rt , ((f • t) • f) should be reduced to (t•f) . But in the definition of the r relationship, none of them satisfies ((f • t) • f) . We can only reduce expressions in the format similar to (f • B) or (t • B) . In other words, the expression on the right side of • is arbitrary, but the expression on the left side must be f or t .
Now we will use the relationship r -> r expanded to support sub-expression of the statute:
-> r relationship is called r relations compatible closure (compatible closure) Translator's Note: From this beginning, I found a more The appropriate word "closed" is used to translate closure, and the more appropriate word "status" is used to translate reduction
Like r, -->r is a one-step reduction relationship, but it allows any sub-expression to reduce itself. The sub-expression reduced by the r relation is called redex , and the text that wraps the redex is called context.
The –>r relationship includes ((f • t) • f) -->r (t • f) . We can use the following proof tree to demonstrate this conclusion.
And, continuing to reduce this expression, we can finally get t :
Finally, if we define ->->r as the reflexive-transitive closure of –>r , we can get ((f • t) • f) ->- >rt , therefore, ->->r is a natural reduction relation generated by r.
to sum up:
Simple reflexive closure ≍r, equivalent closure ≈ r, or reflexive-transitive closure ↝↝ r relationship will be boring. On the contrary, what we are recently interested in will be compatible closure-->r and its reflexive-transitive closure->->r, because they correspond to typical assignment concepts. In addition, the equivalent closure of –>r=r is associated with expressions that produce the same result, so it is also interesting.
Exercise 1.3
Please explain why (f • ((t • f) • f)) !↝↝ r** rt**.
answer:
(f • ((t • f) • f)) r ((t • f) • f) The protocol cannot be continued.
Exercise 1.4
Please use -->r to make a statute and prove that (f • ((t • f) • f)) →→rt
answer:
(f • ((t • f) • f)) -->r ((t • f) • f) -->r (t • f) -->r t
1.6 Assignment function
→→r brings us closer to the concept of assignment. Since ((f • t) • f) →→rt , we find ((f • t) • f)→→r (t • f) and ((f • t) • f)→→r ((f • t) • f) is also true.
In the assignment, we are interested in whether the B expression is f or t , and any other mapping relations are irrelevant. In order to capture the concept of this assignment, we define the eval r relationship as follows:
Here, we use another symbol to define the relationship, this special symbol is a relationship of implied functions, that is, to maximize each element The relationship mapped to an element. We use function notation because eval r must be a function for it to be meaningful as an evaluator.
Exercise 1.5
Among these relationships: which one is a function? In a non-functional relationship, find the two expressions associated with it.
answer:
r and eval r are functions.
- ≍ r is not a function
(t • B1) ≍r B1
(t • B1) ≍r (t • B1)
- ≈ r is not a function
(t • B1) ≈r B1
(t • B1) ≈r (t • B1)
- ↝↝ r is not a function
(t • B1) ↝↝r (t • B1)
(t • B1) ↝↝r t
- → r is not a function
((t • B1) • (t • B1)) →r (t • (t • B1))
((t • B1) • (t • B1)) →r ((t • B1) • t)
- →→ r is not a function
(t • B1) ↠r (t • B1)
(t • B1) ↠r t
- = r is not a function
(t • B1) =r (t • B1)
(t • B1) =r t
1.7 Symbol summary
first name | definition | Intuitive definition |
---|---|---|
_ | Basic relations of expression grammar members | A single-step specification step without context |
→_ | _ Relations Compatible closed relations with respect to expression grammar | Single step in context |
→→_ | →_Reflexive relationship-transitive closure | Most assignment steps (0 or more) |
=_ | →→_Symmetry of relationship-transitive closure | Equivalent expressions that produce the same result |
eval_ | =_The relationship strictly limits the scope of the result | Comprehensive and complete assignment function |
End of Chapter One