45. Insertion sort is correct
Problem 19 proved that isort returns a sorted list. That is only half of correctness: a function that always returns [] is sorted too. Prove the full specification, SortSpec isort: the result is sorted and it is a permutation of the input.
This is a challenge and it is Mathlib-free. Perm is defined above the editor, from scratch, by four rules: the empty lists are permutations of each other, a common head can be added, two neighbours can be swapped, and permutations compose.
What the judge checks
isort_correct : SortSpec isortThe definitions these names refer to are the read-only lines above the editor. Write any helper lemmas you need before the final theorem.
Running and submitting solutions, the hints and the editorial come with the Academy Pass. The daily problem is open to every account.
\to in the editor, or click:Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.