-
Notifications
You must be signed in to change notification settings - Fork 147
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
Better handling of unexpected operations in bounds-checking #349
Comments
This would be a nontrivial amount of work, and I'm not convinced it'll be worth it. The way to do it is to replace the fiat-crypto/src/Experiments/SimplyTypedArithmetic.v Lines 4552 to 4573 in a90c2b5
It should only take 5 minutes to write a procedure that lets you know if a given expression uses any of those (either in Ltac or in Gallina). (I'm not opposed to having better error messages, I am just hesitant to spend the 3-6 hours I expect it take to write the code that pushes the relevant error messages through partial reduction :-/ ) |
Hmm, okay. No worries if it's that much work. I thought it might be easier. I'm curious about what this 5-minute procedure is, though. I figured out where my problem was coming from[0] by printing the nested ltacs in [0] I think |
The 5-minute procedure only works if you have the reduced reified term in hand, and it wouldn't've caught [0] But, uh, I could make the error messages for bad bounds include the reduced syntax tree, post-bounds-analysis, if that'd be useful? Re [0]: It's because I was operating under the (now clearly mistaken) assumption that the relevant output types were | ident.Z_cast2 range => fun _ => ZRange.type.option.Some range or | ident.Z_cast2 (r1, r2) => fun _ => (Some r1, Some r2) (they are the same) |
Oh, urg, getting "not unifiable" is also not supposed to happen. You're supposed to get a unification failure that contains a description of the error in the term that's not unifying. Let me fix that. |
This should fix mit-plv#349 (or at least most of it).
Closed by #351 |
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [mit-plv#351, mit-plv#349, mit-plv#350] != [mit-plv#103, mit-plv#108, mit-plv#110] index 0: mit-plv#351 != mit-plv#103 (slice 0 44, [mit-plv#345]) != (slice 0 44, [mit-plv#100]) index 0: mit-plv#345 != mit-plv#100 (add 64, [mit-plv#58, mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#58, mit-plv#98]) (add 64, [mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#98]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, mit-plv#331])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [(or 64, [mit-plv#91, mit-plv#93]), (mul 64, [(or 64, [mit-plv#91, mit-plv#93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [mit-plv#91, mit-plv#93])])])
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [mit-plv#351, mit-plv#349, mit-plv#350] != [mit-plv#103, mit-plv#108, mit-plv#110] index 0: mit-plv#351 != mit-plv#103 (slice 0 44, [mit-plv#345]) != (slice 0 44, [mit-plv#100]) index 0: mit-plv#345 != mit-plv#100 (add 64, [mit-plv#58, mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#58, mit-plv#98]) (add 64, [mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#98]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, mit-plv#331])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [(or 64, [mit-plv#91, mit-plv#93]), (mul 64, [(or 64, [mit-plv#91, mit-plv#93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [mit-plv#91, mit-plv#93])])])
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [#351, #349, #350] != [#103, #108, #110] index 0: #351 != #103 (slice 0 44, [#345]) != (slice 0 44, [#100]) index 0: #345 != #100 (add 64, [#58, #95, #343]) != (add 64, [#58, #98]) (add 64, [#95, #343]) != (add 64, [#98]) (add 64, [#95, (mul 64, [#95, #331])]) != (add 64, [(mul 64, [#3, #95])]) (add 64, [#95, (mul 64, [#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, #95])]) (add 64, [(or 64, [#91, #93]), (mul 64, [(or 64, [#91, #93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [#91, #93])])])
If
ZRange.ident.interp
returnsNone
for the bounds of some operation in my code, it would be nice to get some message saying which operation it was--currently I just get "not unifiable" fromsolve_rop
and I'm struggling to make it show me where exactly theNone
comes from.The text was updated successfully, but these errors were encountered: