← Back

Modules

Leios

  • Abstract
  • Base
  • Blocks
  • Config
  • Defaults
  • FFD
  • Foreign.BaseTypes
  • Foreign.HsTypes
  • Foreign.Types
  • Foreign.Util
  • KeyRegistration
  • Network
  • Prelude
  • Protocol
  • Short
  • Short.Decidable
  • Short.Trace.Verifier
  • Short.Trace.Verifier.Test
  • Simplified
  • Simplified.Deterministic
  • SpecStructure
  • Traces
  • Voting
  • VRF
1234567891011121314151617181920212223242526272829303132333435363738394041
------------------------------------------------------------------------
-- The Agda standard library
--
-- Functions and definitions for sorting lists
------------------------------------------------------------------------
 
-- See `Data.List.Relation.Unary.Sorted` for the property of a list
-- being sorted.
 
{-# OPTIONS --cubical-compatible --safe #-}
 
open import Data.List.Base using (List)
open import Relation.Binary.Bundles using (DecTotalOrder)
 
module Data.List.Sort
{a ℓ₁ ℓ₂} (O : DecTotalOrder a ℓ₁ ℓ₂)
where
 
open DecTotalOrder O renaming (Carrier to A)
 
------------------------------------------------------------------------
-- Re-export core definitions
 
open import Data.List.Sort.Base totalOrder public
using (SortingAlgorithm)
 
------------------------------------------------------------------------
-- An instance of a sorting algorithm
 
open import Data.List.Sort.MergeSort O using (mergeSort)
 
abstract
sortingAlgorithm : SortingAlgorithm
sortingAlgorithm = mergeSort
 
open SortingAlgorithm sortingAlgorithm public
using
( sort -- : List A → List A
; sort-↭ -- : ∀ xs → sort xs ↭ xs
; sort-↗ -- : ∀ xs → Sorted (sort xs)
)