-
Notifications
You must be signed in to change notification settings - Fork 15
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 field projectors for recursive structs in Lean backend #194
Conversation
656150e
to
7238177
Compare
The output looks good. I just want to investigate the problem of generating simplification lemmas (see #185) before merging this. |
It seems that for structures, Lean 4 automatically adds the attribute |
Following some experimentations, it seems we need to add |
There is an interesting discussion here as to why recursive structures are not supported: |
After some discussions: we will mark the projectors as |
This is done in e76ef95 |
Lean structures cannot be recursive. For this reason, recursive Rust structs are extracted to inductives with one constructor.
Similarly to what is already done for Coq, this PR generates projectors which allows to retrieve the expected behavior of structs once extracted to Lean. The translation function is similar to the one for Coq, however, there are some minor differences throughout the function, which is why I duplicated the code instead of making
extract_type_decl_lean_record_field_projectors
backend-generic.This PR also removes the rewriting of Lean field projectors for recursive structs into let-bindings, to instead use the newly generated projectors.
I tested this feature with the following Rust code, which should be added to the testsuite once the refactoring of Aeneas tests (#182) is complete.
Fixes #185