summaryrefslogtreecommitdiff
path: root/src/Data/Setoid/Indexed.idr
blob: df5606d33eec53305a4cbaf279bdc06feeb4ade5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)