summaryrefslogtreecommitdiff
path: root/src/Data/Setoid
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2022-12-06 13:22:10 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2022-12-06 13:22:10 +0000
commit522eb40ab39800f75daa704ae56c18953c4885e7 (patch)
treed138f2a66dd1c5021503d7ac17d3a871a3d4a948 /src/Data/Setoid
parentea2bf19e41aa0f9b4133ea20cd04e5fb3fd002eb (diff)
Migrate to use idris-setoid library.
Diffstat (limited to 'src/Data/Setoid')
-rw-r--r--src/Data/Setoid/Either.idr37
-rw-r--r--src/Data/Setoid/Indexed.idr48
2 files changed, 0 insertions, 85 deletions
diff --git a/src/Data/Setoid/Either.idr b/src/Data/Setoid/Either.idr
deleted file mode 100644
index 682ac5a..0000000
--- a/src/Data/Setoid/Either.idr
+++ /dev/null
@@ -1,37 +0,0 @@
-module Data.Setoid.Either
-
-import public Data.Setoid
-
-public export
-data Either : (0 r : Rel a) -> (0 s : Rel b) -> Rel (Either a b) where
- Left : forall r, s . r x y -> Either r s (Left x) (Left y)
- Right : forall r, s . s x y -> Either r s (Right x) (Right y)
-
-public export
-[eitherRefl] Reflexive a rel => Reflexive b rel' => Reflexive (Either a b) (Either rel rel') where
- reflexive {x = (Left x)} = Left reflexive
- reflexive {x = (Right x)} = Right reflexive
-
-public export
-[eitherSym] Symmetric a rel => Symmetric b rel' => Symmetric (Either a b) (Either rel rel') where
- symmetric (Left eq) = Left $ symmetric eq
- symmetric (Right eq) = Right $ symmetric eq
-
-public export
-[eitherTrans] Transitive a rel => Transitive b rel'
- => Transitive (Either a b) (Either rel rel') where
- transitive (Left eq) (Left eq') = Left $ transitive eq eq'
- transitive (Right eq) (Right eq') = Right $ transitive eq eq'
-
-public export
-EitherEquivalence : Setoid.Equivalence a rel -> Setoid.Equivalence b rel'
- -> Setoid.Equivalence (Either a b) (Either rel rel')
-EitherEquivalence eq eq' = MkEquivalence
- { refl = MkReflexive $ reflexive @{eitherRefl @{eq.refl} @{eq'.refl}}
- , sym = MkSymmetric $ symmetric @{eitherSym @{eq.sym} @{eq'.sym}}
- , trans = MkTransitive $ transitive @{eitherTrans @{eq.trans} @{eq'.trans}}
- }
-
-public export
-EitherSetoid : Setoid -> Setoid -> Setoid
-EitherSetoid x y = MkSetoid _ _ $ EitherEquivalence x.equivalence y.equivalence
diff --git a/src/Data/Setoid/Indexed.idr b/src/Data/Setoid/Indexed.idr
deleted file mode 100644
index a04b647..0000000
--- a/src/Data/Setoid/Indexed.idr
+++ /dev/null
@@ -1,48 +0,0 @@
-module Data.Setoid.Indexed
-
-import public Data.Setoid
-
-%default total
-
-public export
-IRel : {a : Type} -> (a -> Type) -> Type
-IRel {a = a} x = (i : a) -> x i -> x i -> Type
-
-public export
-IReflexive : {a : Type} -> (x : a -> Type) -> IRel x -> Type
-IReflexive x rel = (i : a) -> Reflexive (x i) (rel i)
-
-public export
-ISymmetric : {a : Type} -> (x : a -> Type) -> IRel x -> Type
-ISymmetric x rel = (i : a) -> Symmetric (x i) (rel i)
-
-public export
-ITransitive : {a : Type} -> (x : a -> Type) -> IRel x -> Type
-ITransitive x rel = (i : a) -> Transitive (x i) (rel i)
-
-public export
-IEquivalence : {a : Type} -> (x : a -> Type) -> IRel x -> Type
-IEquivalence x rel = (i : a) -> Setoid.Equivalence (x i) (rel i)
-
-public export
-record ISetoid (a : Type) where
- constructor MkISetoid
- 0 U : a -> Type
- 0 relation : IRel U
- equivalence : IEquivalence U relation
-
-public export
-fromIndexed : (a -> Setoid) -> ISetoid a
-fromIndexed x = MkISetoid (\i => (x i).U) (\i => (x i).relation) (\i => (x i).equivalence)
-
-public export
-(.index) : ISetoid a -> a -> Setoid
-(.index) x i = MkSetoid (x.U i) (x.relation i) (x.equivalence i)
-
-public export
-reindex : (a -> b) -> ISetoid b -> ISetoid a
-reindex f x = MkISetoid (x.U . f) (\i => x.relation $ f i) (\i => x.equivalence $ f i)
-
-public export
-isetoid : (a -> Type) -> ISetoid a
-isetoid u = MkISetoid u (\_ => Equal) (\_ => equiv)