Created
November 12, 2018 13:21
-
-
Save jfdm/b6b0f7276fd9433293b2728673059753 to your computer and use it in GitHub Desktop.
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
module Sorted | |
data LessThanOrEq : (x,y : type) | |
-> Type | |
where | |
IsLessThan : Ord type => {x,y : type} -> (prf : compare x y = LT) -> LessThanOrEq x y | |
IsEqual : Ord type => {x,y : type} -> (prf : compare x y = EQ) -> LessThanOrEq x y | |
data IsSorted : (list : List type) | |
-> Type | |
where | |
Empty : IsSorted Nil | |
Single : IsSorted [x] | |
Pair : (prf : LessThanOrEq x y) | |
-> IsSorted (y::rest) | |
-> IsSorted (x::y::rest) | |
prf : Ord a => (xs : List a) -> {auto prf : IsSorted xs} -> IsSorted xs | |
prf xs {prf} = prf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment