14 | 14 |
|
15 | 15 |
### Foundational Aspects of Syntax
|
16 | 16 |
|
17 | |
* rating: TODO
|
|
17 |
* rating: 1
|
18 | 18 |
|
19 | |
.
|
|
19 |
The first two pages are an excellent description of the problem.
|
|
20 |
|
|
21 |
In a nutshell, the solution is to add lambda-abstractions to the AST:
|
|
22 |
|
|
23 |
> In this way, the category _variable_ is no longer necessary (being
|
|
24 |
> subsumed by the corresponding notion in the λ-calculus)
|
|
25 |
|
|
26 |
The weakness, IMO, with this solution is that it just "kicks the can to
|
|
27 |
the meta-level". Yes, you have removed the need to worry about binding
|
|
28 |
in your object language. But you still need to reason about binding in
|
|
29 |
your meta-language (here, the lambda calculus.)
|
|
30 |
|
|
31 |
From some older notes I made a while back:
|
|
32 |
|
|
33 |
> "Determining the structure of λ-trees" starts to
|
|
34 |
> get a little murky: when you try to match the pattern
|
|
35 |
>
|
|
36 |
> (∀ (λu. ⊃ (P u) (Q u)))
|
|
37 |
>
|
|
38 |
> against the term
|
|
39 |
>
|
|
40 |
> (∀ (λx. ⊃ (p x x) (q a a)))
|
|
41 |
>
|
|
42 |
> we get a match "by instantiating P with λx.p x x and Q with λx.q a a
|
|
43 |
> and then using α and β-conversion."
|
|
44 |
>
|
|
45 |
> P = λx.p x x
|
|
46 |
> Q = λx.q a a
|
|
47 |
>
|
|
48 |
> What actually is happening here?
|
|
49 |
|
|
50 |
The short answer, I think, is "higher-order unification".
|
|
51 |
|
|
52 |
In the 2nd example, middle of page 3, the object language is the
|
|
53 |
lambda calculus, so it almost seems absurd: it's unclear what the
|
|
54 |
solution is actually aiming to provide to simplify the problem here.
|
|
55 |
|
|
56 |
The next section makes it clearer that the solution is to grapple with
|
|
57 |
the lambda abstractions at the meta-level. Use higher-order unification
|
|
58 |
to work with them. Use a weaker form of beta-reduction in it, to simplify
|
|
59 |
this problem. It's still unclear why, if you are prepared to do this
|
|
60 |
anyway, you want to move the name-binding abstraction to the meta-level.
|
|
61 |
In most cases I imagine you could do the very same thing with binding
|
|
62 |
abstractions in the object language. Perhaps lifting them to the
|
|
63 |
meta-level makes the transformations tidier in some way.
|
|
64 |
|
|
65 |
How to recurse into these lambda abstractions? Define some inference
|
|
66 |
rules at the meta-level, then
|
|
67 |
|
|
68 |
> The hypothetical judgment (the meta-level implication) implicitly
|
|
69 |
> handles the typing context, and the generic judgment (the universal
|
|
70 |
> quantifier) implicitly handles the bound variable names by via the
|
|
71 |
> use of meta-level eigenvariables.
|
|
72 |
|
|
73 |
So if you like to have, or already have, the right mechanisms in your
|
|
74 |
meta-language for handling these things, you can lean on it and re-use
|
|
75 |
it for your object language. If you *don't*, this doesn't help you.
|
20 | 76 |
|
21 | 77 |
### Abstract Syntax for Variable Binders
|
22 | 78 |
|