You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
apply-reduction-relation* insensitive to alpha-equivalence #96
I'm working on a model that makes use of Redex's binding forms support (which has been great). However, I ran into something unexpected today: apply-reduction-relation* returned a list of 16 terms, all of which were alpha-equivalent? to one another.
This was even more surprising given that I had looked at the traces output for reducing the term in question which had merged alpha-equivalent terms.
Using this previous commit as a template, I was able to get apply-reduction-relation* behaving the way I expected for my language by using the equivalence and hash constructs from binding-forms.rkt (see here).
(It has occurred to me that maybe this is the desired behavior for apply-reduction-relation*, though I'm not sure why that would be; I would be interested to hear)
I don't think I made this clear in my initial report, but I patched my local version of Redex to consider alpha-equivalence in apply-reduction-relation* (see here) which I'd be happy to submit as a PR if that is indeed the desired behavior.
I believe that the current behavior of `apply-reduction-relation*` is just
the result of an oversight on my part; alpha-equivalence was supposed to be
the notion of equality everywhere possible.
There is make-α-hash in binding-forms.rkt which I missed on my first go around. I can update my patch to use make-α-hash (as well as the code that I copied went off of implementing the same functionality for traces).
I have one bit of uncertainty with making this change, though. The loop inside traverse-reduction-graph uses a path variable for an immutable hash that needs to use alpha-equivalence. I can either convert it to a mutable hash using make-α-hash, or add a make-immutable-α-hash function and use that instead.
I'm uncertain about which way to go because there is a comment suggesting this path variable has been the subject of performance tuning and I want to be careful where I tread in that regard!
Oh, rats! I totally forgot about this and just changed only one part of the problem! I'm sorry about that.
So, no, they aren't closed, because I changed only the one for that specific bug.
Looking at the diff, I think that the fixes to traces and stepper are still needed. But test cases are also needed.
Shall I do that?
And where do we stand with the performance issues? I am guessing that there is not much to be helped there. We knew that alpha stuff would slow various things down, but I can try to investigate if there is a specific file that's problematically slower.
For apply-reduction-relation*, it actually improves performance in my experience. So I don't see any reason to not merge #102, other than the minor issue of using the depricated interface.
#103 is my attempt to make similar changes to judgment forms and metafunctions, but it really hurts performance.
I wasn't able to reproduce the errors I was getting in the model I was working on at the time. I had to remove some binding directives to be able to run the model, which may be related.
The directive
(facet X A ([D S #:refers-to (shadow D X)] ...))
now produces an error message
define-language: found the same binder, X, at different depths, 1 and 0
Redex used to accept this directive, and as far as I could tell interpreted it the way I intended.
Activity
howell commentedon May 23, 2017
any thoughts on this?
I don't think I made this clear in my initial report, but I patched my local version of Redex to consider alpha-equivalence in
apply-reduction-relation*(see here) which I'd be happy to submit as a PR if that is indeed the desired behavior.paulstansifer commentedon May 23, 2017
rfindler commentedon May 23, 2017
paulstansifer commentedon May 23, 2017
howell commentedon May 24, 2017
There is
make-α-hashin binding-forms.rkt which I missed on my first go around. I can update my patch to usemake-α-hash(as well as the code that Icopiedwent off of implementing the same functionality fortraces).I have one bit of uncertainty with making this change, though. The
loopinsidetraverse-reduction-graphuses apathvariable for an immutable hash that needs to use alpha-equivalence. I can either convert it to a mutable hash usingmake-α-hash, or add amake-immutable-α-hashfunction and use that instead.I'm uncertain about which way to go because there is a comment suggesting this
pathvariable has been the subject of performance tuning and I want to be careful where I tread in that regard!rfindler commentedon May 24, 2017
I think we need a
make-immutable-α-hashfunction. Thanks for helping out with this!Update apply-reduction-relation* to be sensitive to alpha-equivalence
wilbowma commentedon Sep 26, 2017
Are this and #102 closed by 24f0c5c?
rfindler commentedon Sep 26, 2017
Oh, rats! I totally forgot about this and just changed only one part of the problem! I'm sorry about that.
So, no, they aren't closed, because I changed only the one for that specific bug.
Looking at the diff, I think that the fixes to
tracesandstepperare still needed. But test cases are also needed.Shall I do that?
And where do we stand with the performance issues? I am guessing that there is not much to be helped there. We knew that alpha stuff would slow various things down, but I can try to investigate if there is a specific file that's problematically slower.
wilbowma commentedon Sep 27, 2017
For apply-reduction-relation*, it actually improves performance in my experience. So I don't see any reason to not merge #102, other than the minor issue of using the depricated interface.
#103 is my attempt to make similar changes to judgment forms and metafunctions, but it really hurts performance.
rfindler commentedon Aug 9, 2018
@howell do you have the example (or one like it) that returned too many things so I can add it to the test suites?
howell commentedon Aug 24, 2018
I wasn't able to reproduce the errors I was getting in the model I was working on at the time. I had to remove some binding directives to be able to run the model, which may be related.
The directive
(facet X A ([D S #:refers-to (shadow D X)] ...))now produces an error message
define-language: found the same binder, X, at different depths, 1 and 0Redex used to accept this directive, and as far as I could tell interpreted it the way I intended.
wilbowma commentedon Mar 20, 2020
Think this should have been closed by #102
rfindler commentedon Mar 21, 2020
Thanks!