Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function setoid is back. #2240

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ Deprecated names
New modules
-----------

* `Function.Relation.Binary.Equality`
```agda
setoid : Setoid a₁ a₂ → Setoid b₁ b₂ → Setoid _ _
```
and a convenient infix version
```agda
_⇨_ = setoid
```

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

Expand Down
35 changes: 35 additions & 0 deletions src/Function/Relation/Binary/Equality.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- Function Equality setoid
------------------------------------------------------------------------

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

module Function.Relation.Binary.Equality where
JacquesCarette marked this conversation as resolved.
Show resolved Hide resolved

open import Function.Bundles using (Func; _⟨$⟩_)
open import Level using (Level)
open import Relation.Binary.Bundles using (Setoid)

private
variable
a₁ a₂ b₁ b₂ c₁ c₂ : Level

setoid : Setoid a₁ a₂ → Setoid b₁ b₂ → Setoid _ _
JacquesCarette marked this conversation as resolved.
Show resolved Hide resolved
setoid From To = record
{ Carrier = Func From To
; _≈_ = λ f g → ∀ {x} → f ⟨$⟩ x To.≈ g ⟨$⟩ x
JacquesCarette marked this conversation as resolved.
Show resolved Hide resolved
; isEquivalence = record
{ refl = To.refl
JacquesCarette marked this conversation as resolved.
Show resolved Hide resolved
; sym = λ f≈g → To.sym f≈g
; trans = λ f≈g g≈h → To.trans f≈g g≈h
}
}
where
module To = Setoid To

-- most of the time, this infix version is nicer to use
infixr 9 _⇨_
_⇨_ : Setoid a₁ a₂ → Setoid b₁ b₂ → Setoid _ _
_⇨_ = setoid
Loading