Documentation

HexBasic.Sort

@[irreducible]
def Hex.List.merge {α : Type u_1} (le : ααBool) (xs ys : List α) :
List α

Kernel-reducible stable merge.

Equations
Instances For
    theorem Hex.List.merge_eq {α : Type u_1} (le : ααBool) (xs ys : List α) :
    merge le xs ys = xs.merge ys le
    def Hex.List.sort {α : Type u_1} (xs : List α) (le : ααBool) :
    List α

    Stable merge sort with structural recursion and exposed implementation helpers. The fuel is the input length, which bounds the depth of its halving recursion.

    Equations
    Instances For
      def Hex.List.sort.go {α : Type u_1} (le : ααBool) :
      NatList αList α
      Equations
      Instances For
        @[simp]
        theorem Hex.List.sort_eq {α : Type u_1} (le : ααBool) (xs : List α) :
        sort xs le = xs.mergeSort le

        The exposed sort agrees with core's stable merge sort for every comparator.

        @[csimp]

        Compiled code keeps core's efficient merge-sort implementation.