// verifast_options{disable_overflow_check target:ILP32} extern void abort(void);//@ requires true; //@ ensures true; extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); void reach_error() //@ requires false; //@ ensures true; { __assert_fail("0", "recHanoi03-2.c", 3, "reach_error"); } /* * recHanoi.c * * Created on: 17.07.2013 * Author: Stefan Wissert */ extern int __VERIFIER_nondet_int(void);//@ requires true; //@ ensures true; /* * This function returns the optimal amount of steps, * needed to solve the problem for n-disks */ int hanoi(int n) //@ requires true; //@ ensures (((((((3 <= result) && (n <= 2)) || (126 < result)) || (((n + 11) <= result) && (31 <= result))) || ((result == 1) && (n == 1))) || ((7 <= result) && (n <= 3))) || ((15 <= result) && (n <= 4))); { if (n == 1) { return 1; } return 2 * (hanoi(n-1)) + 1; } int main() //@ requires module(recHanoi03_2__verifast_instrumented_modified, true); //@ ensures junk(); { int n = __VERIFIER_nondet_int(); if (n < 1 || n > 31) { return 0; } int result = hanoi(n); if (result >= n) { return 0; } else { ERROR: {reach_error();abort();} } }