-
Notifications
You must be signed in to change notification settings - Fork 112
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
Inconsistency in predicate-based map axioms when using MBQI #735
Comments
The comment from @RustanLeino here suggests how to fix the issue. |
I read the explanation by @RustanLeino. It sounds like the root cause is an inconsistency bug in the type encoding implemented in Boogie. The inconsistency remained hidden because of the incompleteness of quantifier reasoning in typical SMT solvers. Turning MBQI on reduces incompleteness in some examples and revealed the inconsistency.
No. Z3 has many users. It's world does not revolve around Boogie and Dafny, as no doubt @NikolajBjorner will remind you. I suspect that the reason MBQI is turned off by default is that it is expensive. |
Great! I am glad a fix has been discovered. I encourage the Dafny community to put up a PR so we can land the fix pronto. I also encourage the inventors of Boogie type encoding to think about whether other similar bugs are lurking in there. An old-fashioned method is a proof of soundness. |
I don't remember any significant discussion about whether it should be on or off by default. I have found MBQI to be expensive without yielding much in completeness for my Boogie applications. So I have not resisted turning it off by default in Boogie. In general though, I have tried to move Boogie away from heavy customization of command-line options for SMT solvers, instead letting Boogie users drive such customization. |
I'm happy to take a stab at implementing @RustanLeino's suggested fix, and may be able to do some deeper soundness investigations a bit later. |
Regarding Z3's default, here's my understanding: By default, Z3's |
Hehe. Of the two things I mentioned here, the missing parameter(s) of the type constructor seems like a coding bug. (I didn't study the Boogie code just now.) @pruemmer and my paper has all the parameters of The missing antecedent is a logic bug. Looking at the "Function axiom" paragraph of Section 3.0 of the paper, the bug seems to be that an
(Here, I declare |
Ehm, z3 may not revolve around Boogie, but my world certainly revolves around Stan U R. |
oh that one. We hit this when trying Vampire many years ago. |
|
There is another type encoding method that is triggered by -typeEncoding:arguments. Is it possible that this bug is lurking there also? If -typeEncoding:arguments is not used by anybody, should be consider deleting it? |
I have not been able to replicate this issue with The bottom line is that I think all the encoding schemes are worth keeping for now, unless we can be sure that we can translate any Boogie program to a monomorphic encoding. |
As a side remark, our CAV 2021 paper (https://link.springer.com/chapter/10.1007/978-3-030-81688-9_33) generates proofs for a subset of polymorphic Boogie where Regarding Just playing around a bit with
The type quantifier in the SMTLIB2 file is given by: |
One relevant snippet from the original paper:
To me this sounds like a completeness question rather than a soundness one. |
Is there a model theory of a logic with triggers? |
I have not explored the formal details of triggers much, but there is the paper "Reasoning with triggers (Claire Dross, Sylvain Conchon, Johannes Kanig, and Andrei Paskevich; SMT@IJCAR 2012)", which defines a semantics that takes triggers into account. |
Tests all three type encoding modes, and only the predicate mode fails (succeeds in proving false).
Add type-constraining antecedents for each argument of a function when generating the type axiom for that function. These seem to have been intentionally but incorrectly left out in the original implementation. This fixes the missing antecedent issue in #735 and dafny-lang/dafny#4053 but does not yet fix the missing type constructor parameters. I have yet to track down exactly why those are left out.
@atomb : Can I close this issue? |
Oh, yes. I meant to do it in the process of merging that PR. It includes only one of the two changes @RustanLeino suggested, but I think that's enough to fix the inconsistency. |
@atomb : If you intend to implement the other change and wish to track its completion using an issue, you are welcome to reopen this issue or create another issue. |
I think a different issue makes sense. I'll create one. |
While investigating this Dafny issue, I discovered that Boogie seems to be generating map axioms when using the predicate-based encoding for polymorphic types that are inconsistent when MBQI (which is disabled by default) is enabled in the solver. Take the following Boogie program, distilled from the original Dafny example.
When running with the various type encoding flags, and MBQI enabled, I get the following.
Is there some reason it should be expected that these axioms are incompatible with MBQI? And is that why it's disabled by defalut?
Running various solvers on the generated SMT-Lib, several versions of Z3, CVC5, and Vampire all report
unsat
. This happens when enabling MBQI in Z3 or CVC5, and when using Vampire with its default flags. Using Z3 or CVC5 with MBQI disabled results inunknown
.The text was updated successfully, but these errors were encountered: