-
Notifications
You must be signed in to change notification settings - Fork 33
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
Wrong model for arrays #929
Comments
Note: from dev meeting this looks like this is an extensionality issue; we should look at extensionality witness techniques |
I believe we already implement the (* nouvelles disegalites par instantiation du premier
axiome d'exentionnalite *)
let extensionality accu la _class_of =
List.fold_left
(fun ((env, acc) as accu) (a, _, dep,_) ->
match a with
| A.Distinct(false, [r;s]) ->
begin
match X.type_info r, X.term_extract r, X.term_extract s with
| Ty.Tfarray (ty_k, ty_v), (Some t1, _), (Some t2, _) ->
let i = E.fresh_name ty_k in
let g1 = E.mk_term (Sy.Op Sy.Get) [t1;i] ty_v in
let g2 = E.mk_term (Sy.Op Sy.Get) [t2;i] ty_v in
let d = E.mk_distinct ~iff:false [g1;g2] in
let acc = Conseq.add (d, dep) acc in
let env =
{env with new_terms =
E.Set.add g2 (E.Set.add g1 env.new_terms) } in
env, acc
| _ -> accu
end
| _ -> accu
) accu la Each time Our implementation of
Then we know that I think the only way to perform this kind of reasoning in our current implementation is to perform splits during the model generation. |
This PR fixes the issue OCamlPro#929 about model arrays. Our implementation of `ArrayEx` is complete but we do not split on literals `a = b` where `a` and `b` are any arrays of the problem. Doing these splits during the search proof would be a bad idea because we do not need them to be complete. In the example of the issue OCamlPro#929, we obtain an equality of the form `(store a1 x y) = (store a2 x y)` and we know that `(select a1 x) = (select a2 x)`. We never try to decide `a1 = a2`.
This PR fixes the issue OCamlPro#929 about model arrays. Our implementation of `ArrayEx` is complete but we do not split on literals `a = b` where `a` and `b` are any arrays of the problem. Doing these splits during the search proof would be a bad idea because we do not need them to be complete. In the example of the issue OCamlPro#929, we obtain an equality of the form `(store a1 x y) = (store a2 x y)` and we know that `(select a1 x) = (select a2 x)`. We never try to decide `a1 = a2`. Notice that I update the set of arrays by tracking literals `Eq` of origin `Subst`. We know that this design is fragile because it could happen that substitutions are not sent to theories. The worst that can happen is to produced wrong models for arrays in very tricky cases. A better implementation consists in using our new global domains system to track `selects` in `Adt_rel` and use the keys of this map instead of `arrays`. I did not opt to this implementation to keep this PR simple and atomic.
This PR fixes the issue OCamlPro#929 about model arrays. Our implementation of `ArrayEx` is complete but we do not split on literals `a = b` where `a` and `b` are any arrays of the problem. Doing these splits during the search proof would be a bad idea because we do not need them to be complete. In the example of the issue OCamlPro#929, we obtain an equality of the form `(store a1 x y) = (store a2 x y)` and we know that `(select a1 x) = (select a2 x)`. We never try to decide `a1 = a2`. Notice that I update the set of arrays by tracking literals `Eq` of origin `Subst`. We know that this design is fragile because it could happen that substitutions are not sent to theories. The worst that can happen is to produced wrong models for arrays in very tricky cases. A better implementation consists in using our new global domains system to track `selects` in `Adt_rel` and use the keys of this map instead of `arrays`. I did not opt to this implementation to keep this PR simple and atomic.
This PR fixes the issue OCamlPro#929 about model arrays. Our implementation of `ArrayEx` is complete but we do not split on literals `a = b` where `a` and `b` are any arrays of the problem. Doing these splits during the search proof would be a bad idea because we do not need them to be complete. In the example of the issue OCamlPro#929, we obtain an equality of the form `(store a1 x y) = (store a2 x y)` and we know that `(select a1 x) = (select a2 x)`. We never try to decide `a1 = a2`. Notice that I update the set of arrays by tracking literals `Eq` of origin `Subst`. We know that this design is fragile because it could happen that substitutions are not sent to theories. The worst that can happen is to produced wrong models for arrays in very tricky cases. A better implementation consists in using our new global domains system to track `selects` in `Adt_rel` and use the keys of this map instead of `arrays`. I did not opt to this implementation to keep this PR simple and atomic.
This is not an extensionality witness (edit: to clarify; this is one half of an extensionality witness since it only implements In other words, The advantage of extensionality witness is that there is no need to special case rules for arrays and everything reduces to reasoning on the indices. When we seen an equality |
I am not sure this is true; we reply
I think the expectation is that when a theory learns that two variables are equal, it must ultimately propagate the information to the union-find so that the appropriate substitutions are performed. (Note: I cannot test with |
FWIW, if I manually introduce an extensionality witness for arrays
then Alt-Ergo correctly replies |
The current model produced by Alt-Ergo for the input
555.smt2
is wrong:The model is
But it should be
My first thought was that Alt-Ergo didn't produce an appropriate case-split in
Arrays_rel
but it seems to be the very purpose of the fieldsplits
in its environment.After a quick check, it seems Alt-Ergo discovers the equality
a0 = a1
but the equality never reaches the union-find.The text was updated successfully, but these errors were encountered: