Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ New modules
Data.List.NonEmpty.Membership.Setoid
```

* `Relation.Binary.Morphism.Construct.On`: given a relation `_∼_` on `B`,
and a function `f : A → B`, construct the canonical `IsRelMonomorphism`
between `_∼_ on f` and `_∼_`, witnessed by `f` itself.

Additions to existing modules
-----------------------------

Expand Down
32 changes: 32 additions & 0 deletions src/Relation/Binary/Morphism/Construct/On.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- Construct monomorphism from a relation and a function via `_on_`
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --safe #-}

open import Relation.Binary.Core using (Rel)

module Relation.Binary.Morphism.Construct.On
{a b ℓ} {A : Set a} {B : Set b} (_∼_ : Rel B ℓ) (f : A → B)
where

open import Function.Base using (id; _on_)
open import Relation.Binary.Morphism.Structures
using (IsRelHomomorphism; IsRelMonomorphism)

------------------------------------------------------------------------
-- Definition

_≈_ : Rel A _
_≈_ = _∼_ on f

isRelHomomorphism : IsRelHomomorphism _≈_ _∼_ f
isRelHomomorphism = record { cong = id }

isRelMonomorphism : IsRelMonomorphism _≈_ _∼_ f
isRelMonomorphism = record
{ isHomomorphism = isRelHomomorphism
; injective = id
}