Commit 5b08e81
committed
copilot-core: Preserve proposition quantifiers. Refs #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.1 parent 0845db1 commit 5b08e81
1 file changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
68 | 87 | | |
69 | 88 | | |
70 | 89 | | |
| |||
0 commit comments