Printing of Cryptol newtypes in counterexamples throws away too much information #2119
Labels
subsystem: cryptol-saw-core
Issues related to Cryptol -> saw-core translation with cryptol-saw-core
tech debt
Issues that document or involve technical debt
topics: error-handling
Issues involving the way SAW responds to an error condition
topics: error-messages
Issues involving the messages SAW produces on error
usability
An issue that impedes efficient understanding and use
Milestone
If your model has a Cryptol newtype in it (recall that newtypes are records) it gets embedded into saw-core as a tuple and throws away the record field names. This translation, however, also throws away the field ordering; the fields get sorted alphabetically before or during the translation.
The result of this is that when a counterexample containing a newtype gets printed, it comes out as a tuple of unlabeled values whose order does not (in general) match the original declaration. Once you realize what's going on, it's possible to sort this out by hand. It's not reasonable to expect the user to do that though, and also before you figure out what's going on the results are just incomprehensible.
It's not clear to me if we ought to throw away less information when translating to saw-core (that is, add record types and maybe other things to saw-core, which is a fairly big deal) or if this ought to get fixed by introducing a mechanism to lift saw-core counterexample values back to their source-level language. (That is also likely a fairly big deal, because it almost certainly involves substantial structural changes, and might still also require carrying more information around in saw-core.)
However, I think something needs to be done about it.
The text was updated successfully, but these errors were encountered: