Setoid.Relations.Discrete¶
Discrete Relations on Setoids¶
This is the Setoid.Relations.Discrete module of the Agda Universal Algebra Library.
"Discrete" here means binary, as opposed to the arbitrary-arity relations of Setoid.Relations.Continuous.
The centre of the module is the kernel of a setoid function: the relation on
the domain holding of two elements just when the function sends them to elements
that are equal in the codomain. It appears in three shapes, because three are
wanted downstream: fker as a binary relation,
fkerPred as a predicate on pairs, and fkerlift
with its level raised. Also here are function-equality, pointwise
equality of setoid functions, and Im_โ_, the assertion that a
function's image lands inside a given subset.
Kernels of homomorphisms, which are these kernels together with compatibility with the operations, are in Setoid.Homomorphisms.Kernels.
Here is a function that is useful for defining pointwise equality of functions wrt a given equality.
open _โถ_ renaming ( to to _โจ$โฉ_ ) module _ {๐ด : Setoid ฮฑ ฯแต}{๐ต : Setoid ฮฒ ฯแต} where open Setoid ๐ด using () renaming ( Carrier to A ; _โ_ to _โโ_ ) open Setoid ๐ต using () renaming ( Carrier to B ; _โ_ to _โโ_ ) function-equality : BinaryRel (๐ด โถ ๐ต) (ฮฑ โ ฯแต) function-equality f g = โ x โ f โจ$โฉ x โโ g โจ$โฉ x
Here is useful notation for asserting that the image of a function (the first argument) is contained in a predicate, the second argument (a "subset" of the codomain).
Im_โ_ : (๐ด โถ ๐ต) โ Pred B โ โ Type (ฮฑ โ โ) Im f โ S = โ x โ f โจ$โฉ x โ S
Kernels on setoids¶
Given setoids ๐ด and ๐ต (with carriers A and B, resp), the kernel of a function f :
๐ด โถ ๐ต is defined informally by {(x , y) โ A ร A : f โจ$โฉ x โโ f โจ$โฉ y}.
fker : (๐ด โถ ๐ต) โ BinaryRel A ฯแต fker g x y = g โจ$โฉ x โโ g โจ$โฉ y fkerPred : (๐ด โถ ๐ต) โ Pred (A ร A) ฯแต fkerPred g (x , y) = g โจ$โฉ x โโ g โจ$โฉ y open IsEquivalence fkerlift : (๐ด โถ ๐ต) โ (โ : Level) โ BinaryRel A (โ โ ฯแต) fkerlift g โ x y = Lift โ (g โจ$โฉ x โโ g โจ$โฉ y) -- The *identity relation* (equivalently, the kernel of a 1-to-1 function) 0rel : {โ : Level} โ BinaryRel A (ฯแต โ โ) 0rel {โ} = ฮป x y โ Lift โ (x โโ y)