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

Soundness and empty types #881

Open
jhjourdan opened this issue Oct 4, 2023 · 0 comments
Open

Soundness and empty types #881

jhjourdan opened this issue Oct 4, 2023 · 0 comments

Comments

@jhjourdan
Copy link
Collaborator

Why3 assumes that every type is non-empty, and so do all the SMT solvers.

However, for several reasons, it seems like we need to support empty types:

  • The "never" type (! in Rust), and friends like Infaillible are use in crucial places in the standard library (see the Try trait).
  • Types with invariants may be empty if the invariant is absurd. In Invariant cleanup #880, we are in the process of removing the is_inhabited law, which guaranteed that types with invariants are not empty. The reasons are:
    • It is cumbersome to prove inhabitedness of type invariants, like Why3 does, (because many types do not have easy ways to exhibit inhabitants, both in Pearlite and in Why3 logic language)
    • Sometimes, invariants are purposely not provably uninhabited. This is the case of the Map iterator, which can be uninhabited if the pre and post-conditions of the closure do not match.
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

No branches or pull requests

1 participant