Skip to content
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

Support for limited extraction of indexed effects #2851

Merged
merged 33 commits into from
Mar 17, 2023

Conversation

aseemr
Copy link
Collaborator

@aseemr aseemr commented Mar 14, 2023

@mtzguido
Copy link
Member

Hi Aseem, I tried this out a bit. It fails for me when extracting examples/layeredeffects/LL.fst, though it's not demanded by the Makefile but maybe that's just a typo?

$ ./bin/fstar.exe examples/layeredeffects/LL.fst --codegen OCaml
Extracted module FStar.Pervasives.Native
Extracted module FStar.Monotonic.Pure
Unexpected error; please file a bug report, ideally with a minimized version of the source program that triggered the error.
Failure("This should not happen (should have been handled at Tm_abs level for effect LL.EXN)")

Removing the inline_for_extraction_ qualifier on get_flt_stexnmakes it work. Looking at the code I'm confused on whether reification is triggered by areify(orreify___E`), or by the meta monadics.. is it a mix? Could it always just be the Meta_monadic nodes?

@aseemr
Copy link
Collaborator Author

aseemr commented Mar 16, 2023

Thanks for testing Guido, much appreciated!

This reify___M thing was quite ugly and the root cause of this failure. The issue is, with reify___M and reify is that we have to match on both everywhere we want to check for reify.

The reason I had added reify___M in the first place was that, in the smtencoding when we get reify e, I wanted to not encode this when e has an indexed effect. But the term itself does not have the effect of e, so reify___M as an assume val was trying to emulate it.

I have now removed this reify___M altogether, adding an option lident to reify syntax which is filled by the typechecker. And then checked in smtencoding. If this option is not set, then to be safe, we encode reify e abstractly (and in fact Bug2641.fst relies on it being abstract).

With this change, LL also works. It had a double reify, and normalizer was getting stuck.

I also added DM4F_layered5 which is also double layered. Added these two to the CI.

@aseemr aseemr merged commit 71facac into master Mar 17, 2023
@aseemr aseemr deleted the _aseem_indexed_effects_extraction branch March 17, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants