Idris2/libs/contrib/Data/Nat/Order/Relation.idr
Nick Drozd 61b9a3e4e5
Define and implement Relation interfaces (#1472)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-07-09 09:06:27 +01:00

19 lines
471 B
Idris

||| An example implementation for the Tolerance relation.
module Data.Nat.Order.Relation
import Control.Relation
Adjacent : (a, b : Nat) -> Type
Adjacent a b = Either (a = b) $ Either (a = S b) (b = S a)
Reflexive Nat Adjacent where
reflexive = Left Refl
Symmetric Nat Adjacent where
symmetric (Left x_eq_y) = Left $ sym x_eq_y
symmetric (Right $ Left prf) = Right $ Right prf
symmetric (Right $ Right prf) = Right $ Left prf
Tolerance Nat Adjacent where