⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@bhargavkulk
Copy link

@bhargavkulk bhargavkulk commented Jan 23, 2026

I have added the file InsertionSort.lean in this PR. I am aware that List.insertionSort exists, but it is not instrumented with tick, which does not make it possible to write the complexity proof. I have chosen the worst case time bound as n^2 but the same proof discharges for n(n+1)/2. I know I have not added the required documentation in this PR, but I first want to get an OK for the actual proofs implemented.

I think insertion sort, while a very simple algorithm, merits its inclusion because more complicated sorts implemented in the standard libraries of programming languages (like "TimSort" in Python) use insertion sort to quickly sort smaller sub-arrays as insertion sort is faster than divide-and-conquer based comparison sorts like merge and quick sort for very small arrays. I believe that the proofs in this file would aid future proofs about these hybrid in-actual-use sorts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant