Two parts: part (a) is the simplified code, part (b) is the complicated Java code… (a): /* VerifyThis 2017, Challenge 1, using CIVL * Based on simplified version of code. * N is upper bound on n (the length of the array). * Verified for N=5 (i.e., all arrays up to length 5). * Verification time: N=4 (upper bound): ~30 seconds. * Verified all array indexes are within bounds, and at termination * array a is sorted and is a premutation of original array A. * Stephen Siegel */ $input int N = 5; // upper bound on n $input int n; // size of array $assume(1<=n && n<=N); $input int A[n]; // input: constant, fixed forever /* Counts the number of occurences of val in the array * starting at p consisting of n ints */ int count(int n, int *p, int val) { int result = 0; for (int i=0; i= 0 && a[j] > x) { a[j+2] = a[j]; j = j-1; } a[j+2] = x; while (j >=0 && a[j]>y) { a[j+1] = a[j]; j = j-1; } a[j+1] = y; i = i+2; } if (i==n-1) { y=a[i]; j=i-1; while (j>=0 && a[j]>y) { a[j+1] = a[j]; j = j-1; } a[j+1] = y; } // array a is sorted... $assert($forall (int i : 0..n-2) a[i]<=a[i+1]); // first attempt at permutation. This does not quite // prove permutation, but it does show all elements // occuring in a also occur in A, and vice versa... $assert($forall (int i : 0..n-1) ($exists (int j : 0..n-1) a[i]==A[j])); $assert($forall (int i : 0..n-1) ($exists (int j : 0..n-1) A[i]==a[j])); // this gets it exactly right... for (i=0; i $input int N = 5; // upper bound on n $input int n; // size of array $assume(1<=n && n<=N); $input int A[n]; $input int LEFT; $input int RIGHT; $assume(2<=LEFT && LEFT < RIGHT && RIGHT