Skip to content
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

Is kInduction imprecise? #177

Open
Novak756 opened this issue Apr 19, 2024 · 3 comments
Open

Is kInduction imprecise? #177

Novak756 opened this issue Apr 19, 2024 · 3 comments
Assignees

Comments

@Novak756
Copy link

Hi,
I was wondering if the default kInduction analysis is meant to be precise, because running 2ls --inline --k-induction on this safe program gives VERIFICATION FAILED (result should be SUCCESSFUL).
Meanwhile the default analysis (i.e. just 2ls --inline) at least gives VERIFIFICATION INCONCLUSIVE.

If I had to guess it's the combination of pointers and the Ternary Operator that is causing the problem, but I don't know for sure.
(array_comp(((long *)(array_Q_2)),(((unsigned char) (1U & (FV0))) ? (value_store(((long *)(FV26)),(unsigned int) ((FV1)),(unsigned int) ((BubbleSort_Q_0_Q_temp_Q_1)))) : ((long *)(array_Q_1))),ARRAY_SIZE)))

Version: built from latest commit (c572aa1)

Thanks in advance,
Alex

@viktormalik
Copy link
Collaborator

Hi, in general, k-induction should not return VERIFICATION FAILED if it cannot find a counterexample reachable within the unwinding limit. We've usually experienced this behaviour when the program contained constructions not supported by 2LS (e.g. calls to various functions from the standard library) when 2LS over-approximated the effect of the construction which lead to an incorrect counterexample. Briefly looking at your example, I don't see any such construction but the program is rather difficult to read.

@peterschrammel peterschrammel self-assigned this Apr 26, 2024
@peterschrammel
Copy link
Member

The counterexample output when running in plain BMC mode with 2ls --inline --havoc --unwind 3 --trace bug.c.c is wrong. So, my suspicion is that there is a bug in the SSA translation.

@Novak756
Copy link
Author

Novak756 commented May 11, 2024

Hi,
I tried using cvise and 2ls to differentially reduce the example and got the following result:

array_comp() {
  for (;;)
    return 0;
}
main() {
  if (array_comp())
    __VERIFIER_error();
}

which gives VERIFICATION SUCCESSFUL for --inline but VERIFICATION FAILED for --inline --k-induction, --inline --incremental-bmc and --inline --havoc --unwind 1
Seems pretty clear to me that the error should be unreachable, as array_comp always returns 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants