-
Notifications
You must be signed in to change notification settings - Fork 124
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
Fast F2 polynomial arithmetic #923
Conversation
@@ -257,12 +260,22 @@ prepareQuery sym ProverCommand { .. } = | |||
simulate args = | |||
do let lPutStrLn = M.withLogger logPutStrLn | |||
when pcVerbose (lPutStrLn "Simulating...") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This following sequence feels like a bit of a hack. Binding the top-level decls of the module using EWhere
does seem to work, but feels pretty dirty. Any ideas how to handle this better, @brianhuffman, @yav?
I haven't thought of any especially better way to handle the primitive redirection. We'll just have to be sure we don't rely too much on CAFs being evaluated only once. |
cfee6a7
to
7bf93c1
Compare
Ths allows larger concrete bitvector values before falling back on the "sparse" representation. This is a bit of a bandaid for the underlying problem, which I have some ideas how to fix later.
a new `Cryptol::Reference` module. Change the evaluator API slightly so that primitives can be bound to expressions, in addition to values. We can use this to inject the reference implementations of the above operations into the symbolic evaluators. Because of the exact way evaluation environments are piped around, the bound expression will be evaluated in the environment that the primitive symbol is declared. So, we can't just reference the name of the reference implementation when we inject it. Instead, we abuse the `EWhere` construct to add local definitions corresponding to the entire module. This works, but is a bit unsatisfying, as any top-level CAFs will not be shared across different invocations. This doesn't matter for these functions, but might for e.g, AES.
the reference implementations. The `:check` commands are really the only ones of interest for correctness of the algorithms. The `:prove` commands end up just checking the reference implementation against itself, but this checks that the primitive redirection code is working properly.
"Loading module" message. This is used when we implicitly load reference implementation modules.
Updates to track Cryptol PRs GaloisInc/cryptol#923 and GaloisInc/cryptol#940
Add new primitives for
pmult
,pdiv
andpmod
. Currently, these are exposed in the prelude via new symbols namedfast_pmult
,fast_pdiv
andfast_pmod
. The plan is to relocate the current in-Cryptol implementations to a reference implementation module and continue to use these definitions for the symbolic backends, along the lines suggested in #922.These still require additional testing, but seem to work correctly on a limited selection of tests.