-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix Cryptol to SAW newtype translation #1597
Conversation
First thought: I don't think we should discard EDIT: looking closer, I see this is in a different context than I was originally thinking, so maybe this is OK actually. |
I do think we should have a few more involved tests here, to make sure the infrastructure actually works all the way through proofs. |
Ah, right. That does seem potentially important.
Without the code that drops the
This made me think if we only create these "identity constructors" for newtypes that take and return the underlying record, we're going to end up with code that expects the newtype but now instead has the underlying record type. Getting rid of the newtypes seemed like one way to avoid that... but perhaps there are others that allow us to still have custom typeclass instances? (Do we need to generate a trivial inductive type or similar for newtypes? That would mean we're not using those identity functions, though...) |
In the particular context of |
Per robdockins: I think we can safely ignore the ntConstraints here. They arise from the "well formed" side conditions on types mentioned in the newtype fields.
30b8a46
to
c94fd5b
Compare
@robdockins added an integration tests that imports and proves some basic properties about newtype-related functions, deleted the unwanted comment on constraints that was not relevant. If we have some additional tests in mind or specs using newtypes we want to import as well let me know and I'll see what I can do =) |
Initial attempt to fix translation of Cryptol newtypes to SAW (e.g., see #1494).
Essentially, as we are translating Cryptol to SAW, for each
newtype Foo = { bar : Bar }
, we add a binding forFoo
in the SAW term environment to an identity function of type{ bar : Bar } -> { bar : Bar }
, and when we're comparing types for equality we throw away the newtype wrapper just as we do for user-defined type aliases (see helper here).Should we test this more? Are there some examples already using newtypes we can throw in CI somewhere?
Main technical component I'm still not sure about is what (if anything) to do with a Cryptol
Newtype
'sntConstraints
(i.e., this note). The reference interpreter doesn't do anything with them (which makes sense to me in that context)... but should we do something here?