fact: Definition sort_by {T} (size : T -> Q) (ls : list T) : list T := match ls with | nil => nil | default :: _ => List.map (fun '(idx, _) => nth idx ls default) (NatIndexQSort.sort (List.combine (seq 0 (length ls)) (List.map size ls))) end.
imports: Coq.Strings.String Coq.Structures.Orders Coq.micromega.Lia Coq.Bool.Bool Coq.Sorting.Mergesort Coq.QArith.QArith Coq.QArith.Qround Coq.QArith.Qabs Coq.QArith.Qminmax Coq.NArith.NArith Coq.ZArith.ZArith Coq.Arith.Arith Coq.Lists.List PerformanceExperiments.LetIn