-
Notifications
You must be signed in to change notification settings - Fork 6
Meta-variables move de Bruijn indexes across scopes #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It turns out we were punning expression variables and type variables in Oxide. I believe we do it at a level where we are no longer using meta-variables, so I will likely add a helper:
such that it lets you reuse named/global variables, but will fail on metavariables. |
I have a tentative solution for this problem, yet, the majority of the issues are in getting the tests to still pass after this change. The crux of the problem is that we now have all sorts of ways things can be structurally different but semantically the same. This makes the equality tests we want tedious to write. Here are a couple of ways in which equivalent things look different: DSubstFor There are at least 3 ways in which different
That is, we want to equate:
SSubstElemIn the
This introduces more things to equate:
GSubstWhen comparing That is, in the case of
Likewise, keys that attach a null substitution to some named variable should also be ignorable, equating:
I have written a set of helpers to check for "equivalence" of DSusbt/SSubstElem/GSubst/Subst/ULCExps, in the context of ULCExp. It could almost all be generic, apart from the fact that the object language will likely embed a "variable" constructor, which may contain de Bruijn indices we'd want to notice when equating the "elems". |
I'm starting to poke at this. Currently fancy variables So I'm planning to split this into two variable types, one that is the same but without meta-variables, and one that includes meta-variables and is isomorphic to the current type. I also think it's very doable to have an equality operator that coincides with extensional equality, so I'll work on that next. |
As a heads up, I'm working on a patch to UVMHS that would attach delayed substitutions to meta-variables.
Essentially at the moment, meta-variables are scope-unaware, and so substituting
⌊0⌋
for𝔪:x
in:yields:
which is likely not what you'd want, and makes meta-variables somewhat unfit for unification algorithms.
The fix would essentially attach a substitution to meta-variables, so that the above term should now be constructed as (picking a somewhat arbitrary syntax for the attached delayed substitution):
and meta-variable substitution would thus yield:
which is likely what you intended.
This heads up is:
𝕐
to a version parameterized by its scope and its term language, i.e.𝕐 s t
.I expect the second point to be the most intrusive for users of
𝕐
, though ideally you always know whichs
andt
a variable is about and you're not mixing up variables between different scope types or term types.I'm not quite close to proposing this patch, but I want to give people some time to think about whether this won't mess their code.
The text was updated successfully, but these errors were encountered: