Skip to content

Commit

Permalink
Add doc comment for qsort
Browse files Browse the repository at this point in the history
  • Loading branch information
lyphyser committed Sep 18, 2024
1 parent 945db5e commit bc17d4c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Init/Data/Array/QSort.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import Init.Data.Nat.Mod

namespace Array

/--
Sorts the array using QuickSort according to function f.
The function can be a ≤, a <, or in fact an arbitrary function (with weaker guarantees).
See [qsort_sorts_of_is_le], [qsort_sorts_of_is_lt], [qsort_sorts], [qsort_sorts_as] for proofs.
--/
@[inline] def qsort (as : Array α) (f: α → α → Bool) (low := 0) (high := as.size - 1) : Array α :=
let rec @[specialize] sort (as : Array α) (low high : Nat)
(hhs: low < high → high < as.size): {as': Array α // as'.size = as.size} :=
Expand Down

0 comments on commit bc17d4c

Please sign in to comment.