-
Notifications
You must be signed in to change notification settings - Fork 18
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
subst captures variables when substitution is with a bound variable #61
Comments
I'm surprised if this is a recent change in behavior. I think this is in fact by design. The locally nameless representation only supports substituting terms that are well formed in the sense that all bound variables occur in a term together with an enclosing binder. That is |
Yeah, the example constructed is somewhat artificial for brevity -- I discovered this behaviour in the implementation of contextual metavariables. concrete example being:
Regardless, if this is intended behaviour, I can imagine a guard is appropriate that verifies that bound variables don't occur in the term that we substitute with. Something akin to |
I think that's hard to do because the typeclass |
as of 7ce8463
subst
checks that variables substituted for are free but doesn't do anything to avoid captureunbound-generics/src/Unbound/Generics/LocallyNameless/Subst.hs
Lines 103 to 124 in 7ce8463
this means that we take terms from pi-forall (https://github.com/sweirich/pi-forall/blob/729c9f4e348bd94090b0415e3391ad8bb1d89305/full/src/Syntax.hs) and run the following:
We see that
Var 0@0
is captured by the case, the correct result would be<aname> Case (Var 0@0) [Match (<(PatCon "True" [])> Var 1@0)]
The text was updated successfully, but these errors were encountered: