-
Notifications
You must be signed in to change notification settings - Fork 62
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
Redux fails to find triggers for some pure autolemma #181
Comments
Yes. Currently, Redux does not support special operators such as I notice that Z3 does support it: the following verifies with /*@
lemma_auto void list_distinct_indices<t>(list<t> xs, t y, t z);
requires y != z && mem(y, xs) == true;
ensures index_of(y, xs) != index_of(z, xs);
lemma_auto void lists_equal<t>(list<t> list1, list<t> list2);
requires true;
ensures (head(list1) == head(list2) && tail(list1) == tail(list2) && length(list1) == length(list2)) == (list1 == list2);
lemma void list_distinct_indices_test<t>(list<t> xs, t y, t z)
requires y != z && mem(y, xs) == true;
ensures index_of(y, xs) != index_of(z, xs);
{}
lemma void lists_equal_test<t>(list<t> list1, list<t> list2)
requires true;
ensures (head(list1) == head(list2) && tail(list1) == tail(list2) && length(list1) == length(list2)) == (list1 == list2);
{}
@*/ A workaround in Redux is to introduce a pure function that wraps the special operator. This verifies: /*@
fixpoint bool eq<t>(t x, t y) { return x == y; }
lemma_auto void list_distinct_indices<t>(list<t> xs, t y, t z);
requires y != z && mem(y, xs) == true;
ensures !eq(index_of(y, xs), index_of(z, xs));
lemma_auto void lists_equal<t>(list<t> list1, list<t> list2);
requires true;
ensures (head(list1) == head(list2) && tail(list1) == tail(list2) && length(list1) == length(list2)) == eq(list1, list2);
lemma void test1<t>(list<t> xs, t y, t z)
requires y != z && mem(y, xs) == true;
ensures !eq(index_of(y, xs), index_of(z, xs));
{}
lemma void test2<t>(list<t> list1, list<t> list2)
requires true;
ensures (head(list1) == head(list2) && tail(list1) == tail(list2) && length(list1) == length(list2)) == eq(list1, list2);
{}
@*/ |
Thank you for the two solutions. Unfortunately, Z3 won't halt with my current project, but that might have a different reason. The workaround you suggested works great. However, I noticed that maintaining the order of the two lemmas is important, because the following causes an other error:
The log says Using specialized |
Indeed. As it happens, I've been working on #125 the last few days, and I think I'm quite close to finishing it, so this should be fixed soon. |
Hi Bart,
there is an internal error "Redux could not find suitable triggers for axiom ..." with some pure autolemmas, for example the following ones:
I tried to provide a trigger myself like
lemma_auto(index_of(y, xs) != index_of(z, xs))
, but this only causes an other error: "Redux supports only symbol applications at the top level of axiom triggers.".Best regards,
Elias
The text was updated successfully, but these errors were encountered: