DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B5101: precondition might fail at a call

Catalog status: active. Default severity: error. Stable name: precondition. Family: Contracts and termination.

At this call the prover could not show that the callee's precondition holds for the actual parameters. The secondary label shows the precondition. Preconditions are the caller's obligation: the callee's proof assumes them.

Example (Vada)

   function Half (N : Integer) return Integer is (N / 2)
     with Pre => N mod 2 = 0;
   ...
   X := Half (X + 1);   --  X + 1 is odd when X is even

Example (Varc)

    fn half(n: Integer) -> Integer
        requires n %% 2 == 0
    = n / 2;
    ...
    x = half(x + 1);   // x + 1 is odd when x is even

What to do

Establish the precondition before the call (a test, an assertion the prover can show, or a stronger precondition on the calling subprogram), or weaken the callee's precondition if it asks for more than it needs.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See contracts and termination, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.