-
Notifications
You must be signed in to change notification settings - Fork 72
copilot-theorem: Reject existentially quantified propositions in What4 backend. Refs #254.
#596
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
copilot-theorem: Reject existentially quantified propositions in What4 backend. Refs #254.
#596
Conversation
|
Change Manager: CI job fails. Please check. |
|
Sigh, newer GHCs appear not to require the |
c1ae322 to
5722aca
Compare
|
This is quite bizarre. The GHC 8.10.4 CI build fails with the following: The output does not give me any indication of why the |
|
Change Manager: Please rebase on top of the latest commit on |
5722aca to
d601401
Compare
|
Thankfully, restarting the CI appears to have fixed the test suite issues observed earlier. |
|
Implementor: Fix implemented, review requested. |
|
Change Manager: Please see the reviews and comments above. |
Which review comments in particular are you referring to? |
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.
Change Manager: Please address the change requests / comments below.
d601401 to
2ee9332
Compare
|
Implementor: Fix implemented, review requested. |
|
Change Manager: @RyanGlScott Please rebase on top of the latest master, review the new comments, split the commit that affects multiple libraries into one commit per library with the appropriate summary line indicating the library affected, and rephrase the commit messages to avoid the use of |
…#254. Currently, `copilot-language` remembers whether a proposition (i.e., a stream of booleans) is quantified universally (i.e., using `forAll`) or existentially (i.e., using `exists`). When translating from `copilot-language` to `copilot-core`, however, the quantifier is discarded. This means that a `copilot-core` `Property` does not record any quantifier information at all, making it impossible for downstream libraries that use `copilot-core` to handle universal quantification differently from existential quantification. This commit changes the `copilot-core` API to preserve quantifier information. Specifically, it introduces a `Prop` data type in `copilot-core` (largely inspired by a data type of the same name in `copilot-language`) to record a proposition's quantifier, and it changes the `propertyExpr :: Expr Bool` field of `copilot-core`'s `Property` data type to `propertyProp :: Prop`. This commit also introduces an `extractProp :: Prop -> Expr Bool` function for retrieving the underlying boolean expression. Generally, this function should not be used, as different quantifiers usually require different treatment, and misuse of the `extractProp` function can potentially lead to unsoundness. There are a handful of places where the use of `extractProp` is justified, however. In each such place, a comment should be left to justify why the use of `extractProp` is sound.
…uage#254. Currently, `copilot-language` remembers whether a proposition (i.e., a stream of booleans) is quantified universally (i.e., using `forAll`) or existentially (i.e., using `exists`). When translating from `copilot-language` to `copilot-core`, however, the quantifier is discarded. This means that a `copilot-core` `Property` does not record any quantifier information at all, making it impossible for downstream libraries that use `copilot-core` to handle universal quantification differently from existential quantification. Now that `copilot-core` preserves quantifier information in its API, this commit updates `copilot-language` to respect quantifiers when translating into `copilot-core`.
…-Language#254. Currently, `copilot-language` remembers whether a proposition (i.e., a stream of booleans) is quantified universally (i.e., using `forAll`) or existentially (i.e., using `exists`). When translating from `copilot-language` to `copilot-core`, however, the quantifier is discarded. This means that a `copilot-core` `Property` does not record any quantifier information at all, making it impossible for downstream libraries that use `copilot-core` to handle universal quantification differently from existential quantification. Now that `copilot-core` preserves quantifier information in its API, this commit updates `copilot-prettyprinter` to pretty-print quantifier information appropriately.
…age#254. Currently, `copilot-language` remembers whether a proposition (i.e., a stream of booleans) is quantified universally (i.e., using `forAll`) or existentially (i.e., using `exists`). When translating from `copilot-language` to `copilot-core`, however, the quantifier is discarded. This means that a `copilot-core` `Property` does not record any quantifier information at all, making it impossible for downstream libraries that use `copilot-core` to handle universal quantification differently from existential quantification. Now that `copilot-core` preserves quantifier information in its API, this commit updates `copilot-theorem` to make use of quantifier information when proving theorems.
2ee9332 to
d5b70f2
Compare
|
Implementor: Fix implemented, review requested. |
…4 backend. Refs Copilot-Language#254. The functions in `Copilot.Theorem.What4` (e.g., `prove`) take a proposition and attempt to prove that it is valid at all possible time steps. Currently, these functions do this regardless of whether the proposition is universally quantified or existentially quantified, which is unsound. The reason that this happens is because the functions call `extractProp` on the proposition being proven, causing the proposition's quantifier not to be taken into account. This commit removes the unsound uses of `extractProp` and instead checks if the proposition was actually quantified universally (i.e., with a `Forall`), which is the intended use case for `Copilot.Theorem.What4`. If the proposition was instead quantified existentially (i.e., with an `Exists`), then a `ProveException` will be thrown. Warnings have been added to Haddocks of the relevant functions that can potentially throw a `ProveException`.
d5b70f2 to
700508a
Compare
|
Implementor: Fix implemented, review requested. |
|
Change Manager: Verified that:
|
The functions in
Copilot.Theorem.What4(e.g.,prove) take a proposition and attempt to prove that it is valid at all possible time steps. Currently, these functions do this regardless of whether the proposition is universally quantifiedor existentially quantified, which is unsound. The reason that this happens is because the functions call
extractPropon the proposition being proven, causing the proposition's quantifier not to be taken into account.This commit removes the unsound uses of
extractPropand instead checks if the proposition was actually quantified universally (i.e., with aForall), which is the intended use case forCopilot.Theorem.What4. If the proposition was instead quantified existentially (i.e., with anExists), then aProveExceptionwill be thrown. Warnings have been added to Haddocks of the relevant functions that can potentially throw aProveException.Fixes #254.