-
Notifications
You must be signed in to change notification settings - Fork 146
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
Difficulty adding a rewrite rule #1617
Comments
This should work in theory, but this part of the code is ad-hoc and unsatisfactory. I have some debugging suggestions at #1609 (comment). If you're down to implement that suggestion, you should get better error messages, and then I can plausibly direct you a bit more. But it looks like maybe the problem is that the machinery is unfolding something it shouldn't be? Regarding the shorter error message, rules like |
I see - I was getting confused about what the problem was here, because I made the incorrect assumption that if For context: I defined
The error message:
It seems like the issue is related to the fact that I have an identifier that the rewriter recognizes on the left hand side, and a regular function on the right hand side. Do I need to somehow inform the rewriter that these things are equal? |
For some reason, |
Oh, no, nevermind, there must be a symmetry somewhere, I think the unfolding is expected. I think what's happening is that you're seeing a failure to prove |
What if instead of adding |
Alternatively, stick something like |
This works, thank you! I assume your second suggestion works as well, since it seems equivalent. |
Never mind, your second suggestion does not appear to work. Not exactly that, anyway; perhaps something similar would work. |
I don't know how to close this without making a comment, so here is a comment |
I'm trying to add a Karatsuba template to fiat-crypto, but bounds analysis isn't smart enough to get the proper bounds for Karatsuba. In particular, I have written a function
adk_mul
(stands for 'arbitrary-degree karatsuba'), the outputs of which I would like to put some tight bounds on. My idea to accomplish this is as follows:adk_mul
as a basic identifier - one of the things in theall_ident_named_interped
list in Language/IdentifierParameters.vadk_mul
function.adk_mul
identifier. The idea is that this rule will be triggered after the correct bounds are already established for the outputs of theadk_mul
function.I'm struggling with accomplishing part 3. When I try to add this rule, I get a lengthy error message which is mysterious to me.
Note that the
adk_mul
andident_adk_mul
functions are defined in Arithmetic/ADK.v.I tried to reduce the size of the error message and hopefully get something that's comprehensible. It turns out that even trying to add this rule (using a subexpression of the expression that occurred in the rule that I'm trying to add) causes this error message. This error message is much shorter, but I still have no idea what's going on there.
Is there a way to fix these issues, and get the rewrite rule to work? Or should I take a different approach entirely to getting the right bounds for karatsuba multiplication?
The text was updated successfully, but these errors were encountered: