summaryrefslogtreecommitdiff
path: root/src/Data/Setoid/Indexed.idr
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2022-11-29 14:36:13 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2022-11-29 14:36:13 +0000
commitb21e69503571272a5f35cf84c731994f3e921a3a (patch)
tree79f04a283d8873317b0c91bebbcd283a66edbc93 /src/Data/Setoid/Indexed.idr
parentd35c9f4eea009a5d3edd57c9165e49b8a7a66334 (diff)
Move indexed setoids and functions out of Soat.
Diffstat (limited to 'src/Data/Setoid/Indexed.idr')
-rw-r--r--src/Data/Setoid/Indexed.idr36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Data/Setoid/Indexed.idr b/src/Data/Setoid/Indexed.idr
new file mode 100644
index 0000000..df5606d
--- /dev/null
+++ b/src/Data/Setoid/Indexed.idr
@@ -0,0 +1,36 @@
+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
+isetoid : (a -> Type) -> ISetoid a
+isetoid u = MkISetoid u (\_ => Equal) (\_ => equiv)