Minimum of a list of natural numbers #
Our next example is an algorithm to find the minimum of a non-empty list of natural numbers, with a proof of correctness. The proof of correctness consists of two statements about the algorithm: (1) the minimum is in the list, and (2) the minimum is less than or equal to each element in the list.
To avoid name collisions we will use the name smallest
An example
#eval smallest [7, 8, 1,2,3,4,5] (by decide)