Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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`, lift to various `IsRelHomomorphism`s between
`_∼_ on f` and `_∼_`.

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

Expand Down
35 changes: 35 additions & 0 deletions src/Relation/Binary/Morphism/Construct/On.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- Construct Morphisms 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
}

module ι = IsRelMonomorphism isRelMonomorphism