Defines `mergeSort`, a naive stable merge sort algorithm, replaces it via a `@[csimp]` lemma with something faster at runtime, and proves the following results: * `mergeSort_sorted`: `mergeSort` produces a sorted list. * `mergeSort_perm`: `mergeSort` is a permutation of the input list. * `mergeSort_of_sorted`: `mergeSort` does not change a sorted list. * `mergeSort_cons`: proves `mergeSort le (x :: xs) = l₁ ++ x :: l₂` for some `l₁, l₂` so that `mergeSort le xs = l₁ ++ l₂`, and no `a ∈ l₁` satisfies `le a x`. * `mergeSort_stable`: if `c` is a sorted sublist of `l`, then `c` is still a sublist of `mergeSort le l`.
1 line
6 B
Text
1 line
6 B
Text
lean4
|