-
Notifications
You must be signed in to change notification settings - Fork 18
Deftorel pass #206
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
base: main
Are you sure you want to change the base?
Deftorel pass #206
Conversation
|
I’m trying to merge this into the lean4 branch, but trying to update the |
|
Just ran the tests locally again to make sure, it all seems fine to me. I haven't changed either of them, so thats very weird. |
|
Also, for visibility (I put this in #207 but not here). After some testing on the rocq output, it seems like some recursive functions turning into relations do not pass as it doesn't pass the strictly positive condition. Lean will likely exhibit a similar error on the function utf8. |
That function definition is in |
Fair enough, but did some more quick testing and it happens to most recursive functions (subst_typevar and subst_typeuse for example) |
|
Maybe we need to push harder to make them translate as functions. At least when the premises are on identical patterns like in and they are all booleans or otherwise, it should be possible to translate that as if-then-else, shouldn’t it? |
Yes, that was one of the things I was thinking of doing as well, for premises that are boolean conditions. I wanted a more general approach first though to see if it worked. In some functions by the way, you can also transform some of the if premises into let premises (look at growmem for example) and any iterpr with boolean conditions could be List.all |
…he recursive functions themselves.
…that removes ones that have reference to the return expression.
|
With the new changes, the fallthrough premises no longer cause a (big) problem. Wasm 3.0 was compiled in Rocq (with some spec changes for partial funcs). |
This pull request is made to introduce the pass "deftorel". This pass does as the name suggests: convert specific function definitions to relations.
Example:
to
This pass does not ensure the created relations that handle the fallthrough semantics have unique name (yet).
Currently a draft as its not meant to be mergable yet, since more testing should be done to ensure it does the right thing. But for now it should give a way to track what is happening with this pass.
Validates up to Wasm 3.0. Have not tested it in Rocq, but will probably not compile due to name clashes.
Some todos:
This would be possible for boolean conditions but not for anything else. Maybe thats fine?