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`.
9 lines
169 B
Text
9 lines
169 B
Text
import Lake
|
|
open Lake DSL
|
|
|
|
package "mergeSortBenchmark" where
|
|
-- add package configuration options here
|
|
|
|
@[default_target]
|
|
lean_exe "mergeSort" where
|
|
root := `Bench
|