// Introduce a constant 'N' and postulate that it is non-negative const N: int; axiom 0 <= N; // Declare a map from integers to integers. // 'a' should be treated as an array of 'N' elements, indexed from 0 to N-1 var a: [int]int; // Returns true iff the elements of 'arr' are small (i.e. values in the range -3N to +3N) function has_small_elements(arr: [int]int): bool { (forall i: int :: (0 <= i && i < N) ==> (-3 * N <= arr[i] && arr[i] <= 3 * N)) } // Sorts 'a' using bucket sort or quick sort, as determined by has_small_elements(a) procedure sort() returns () modifies a; { if (has_small_elements(a)) { // sort 'a' using bucket sort } else { // sort 'a' using quick sort } }