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

Introduce an attribute to unrefine type arguments #3406

Merged
merged 8 commits into from
Aug 29, 2024

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Aug 25, 2024

This PR allows to tag certain type implicits with the @@@unrefine attribute, causing the unifier to attempt to peel away all refinements of the type before instantiating the uvar. With this, if x is nat, the equality x == x will happen at type int instead of nat as currently happens. This can be desirable if we try to relate this fact to, say, 0 == 0, which defaults to int as 0 is an int literal.

This is potentially controversial and can break some code, see also the do_not_unrefine attribute to fix some regressions. Hence, this logic is only enabled if --debug __unrefine is passed (I will turn this into an extension flag --ext, but the extension mechanism is currently inefficient and I don't want to slow down F*).

@mtzguido mtzguido merged commit 4734765 into FStarLang:master Aug 29, 2024
2 checks passed
@mtzguido mtzguido deleted the unrefine branch August 29, 2024 23:38
@mtzguido mtzguido mentioned this pull request Aug 30, 2024
@TWal
Copy link
Contributor

TWal commented Aug 30, 2024

If I understand correctly, nothing is changing unless we have the option --debug __unrefine passed to fstar.exe?

@mtzguido
Copy link
Member Author

It's now --ext __unrefine (so it doesn't trigger the common debug output), but yes, this should not be noticeable at all. It can be a breaking change so I'd like to get some experience with it before considering making it default.

If you're curious, you're welcome to try it! It does make many things simpler for me in some Pulse code.

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.

2 participants