feat(Algorithms): comparison sort lower bound via decision-tree induction - #770
Open
SamuelSchlesinger wants to merge 1 commit into
Open
feat(Algorithms): comparison sort lower bound via decision-tree induction#770SamuelSchlesinger wants to merge 1 commit into
SamuelSchlesinger wants to merge 1 commit into
Conversation
…tion A comparison program is a free monad over a single comparison query, i.e. a binary decision tree. card_image_run_le_two_pow_of_cost_le bounds its distinct results over a finite comparator family by 2 ^ t whenever every comparator in the family costs at most t comparisons, by structural induction: the family splits at the root comparison. A program that sorts under every hidden permutation order on Fin n therefore takes at least log2(n!) comparisons in the worst case; (n/2) * log2(n/2) follows as a corollary.
SamuelSchlesinger
requested review from
chenson2018,
fmontesi and
sorrachai
as code owners
August 3, 2026 06:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An attempt to prove the comparison sort lower bound of #685 taking, in my view, a more natural proof approach for this model. The original proof analyzes traces of the computation, while this approach takes direct advantage of the inductive structure of the free monad and essentially does induction on the program. At a high level, #685 formalizes the encoding argument whereas we formalize the decision tree argument. The arithmetic estimate of log_2 n! is adapted from #685.
Claude Fable 5 authored this code under my direction and review.