Closed MrChico closed 4 years ago
yeah, the idea is that you should only use sIntN
/sWordN
in the symbolic mode, and once you start the query mode always use freshVar
.
But I do agree that this behavior is rather unexpected. I'll take a look. It should either be supported, or we should get a decent error message.
@MrChico
Looking at this more, it's rather unfortunate that we have this separation of how we create variables in regular symbolic mode and in the query mode. But the reasons are rather historical and the code is hard to untangle now with little benefit.
I checked in some changes though, to improve the error message. You now get the following error for the program you posted:
*Main> trySIntQuery
*** Exception:
*** Data.SBV: Unsupported interactive/query mode feature.
*** Adding a new input variable in query mode: "d"
***
*** Hint: Use freshVar/freshVar_ for introducing new inputs in query mode.
CallStack (from HasCallStack):
error, called at ./Data/SBV/Core/Symbolic.hs:1029:24 in sbv-8.7.5-a974440a:Data.SBV.Core.Symbolic
I hope that's much more explanatory and helpful.
I'm closing this ticket; but please feel free to re-open it, and please continue to report any other oddities you find. Thanks!
Sounds much clearer, nice!
I noticed an oddity when trying out functions like
sInt8, sList...
from Data.SBV.Trans They seem to leave variables undeclared to the solver.freshVar
works well however...This fails:
with the error message:
whereas this succeeds:
am I using this function wrong or is this a bug?