Open virgil-serbanuta opened 1 year ago
Initial investigation confirms that it is indeed the last step in the proof, i.e. the check implication which sends the partial function to z3. We have discussed with @jberthold a potential design for the smt translation in the booster, which would add assertions over partial definitions in z3
I think in general, we cannot rely on Z3 for handling partial functions, because there is not a good compact way to axiomatize them to Z3 correctly (for how we want them defined).
So if we have some formula \phi(X, Y)
we want to send to Z3, we should also compute the "definedness formula" \ceil(X, Y)
, which can be constructed using SMT attributes (or by inspecting #Ceil
rules. We should first check if not \ceil(X, Y)
is satisfiable, and if it is, then we cannot send \phi(X, Y)
to Z3, we must use some other technique. But if not \ceil(X, Y)
is unsatisfiable, then we can send the formula \phi(X, Y)
to Z3 safely.
This basically amounts to handling definedness checks ourselves manually, instead of relying on Z3, because Z3 cannot handle partial functions correctly for our purposes.
versions:
To reproduce: a.k
spec.k
Command line:
The proof passes, although the claim should fail when
_Value
is0
.Note that the Haskell backend sends partial functions to
z3
(i.e. it sends things like10 /Int I < 0
) without attempting to translate them properly - I think that Z3 division is undefined in the sense that it can be ANY value, while the K division is undefined in the sense that it has NO value.