algorithm,sorting,data-structures,quicksort,hoare-logic

The algorithm is correct. You're partitioning the subarray A[p..r] using A[p] as the pivot. So the pivot is 1 and not 5. Hoare-Partition(A=[1,3,9,8,2,7,5], p=0, r=6) results in: x = A[p] = 1 i = -1 j = 7 repeat: j = j - 1 = 6; A[j] = 5 j...

proof,formal-methods,post-conditions,proof-of-correctness,hoare-logic

This question seems so simple that I am getting completely lost, what exactly is it asking for? The question is asking for you to formally prove that the program behaves as specified, by the rigorous application of a set of rules decided on in advance (as opposed to reading...

Here're some encodings, the syntax for ite requires 3 parameters, the first of which is the conditional, the second is the true case, and the third is the false case (rise4fun link: http://rise4fun.com/Z3/qW3B ): ; original example for { x< 40 } x :=x+10 { x < 50} (push) (declare-const...