aboutsummaryrefslogtreecommitdiff
path: root/Functor/Forgetful
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2026-01-06 10:20:03 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2026-01-06 10:20:03 -0600
commit2a2eeeedbe4d7208d511580f7fed0e30d7f16076 (patch)
treee4a802387735e1c46a9b05cf5d0b571e28728371 /Functor/Forgetful
parent1c0a486856d80ad7d8cb6174c49ad990d5f36088 (diff)
Add functors from categories to preorders to setoids
Diffstat (limited to 'Functor/Forgetful')
-rw-r--r--Functor/Forgetful/Instance/Preorder.agda25
1 files changed, 25 insertions, 0 deletions
diff --git a/Functor/Forgetful/Instance/Preorder.agda b/Functor/Forgetful/Instance/Preorder.agda
new file mode 100644
index 0000000..e6957d2
--- /dev/null
+++ b/Functor/Forgetful/Instance/Preorder.agda
@@ -0,0 +1,25 @@
+{-# OPTIONS --without-K --safe #-}
+
+module Functor.Forgetful.Instance.Preorder where
+
+open import Categories.Category.Instance.Setoids using (Setoids)
+open import Categories.Functor using (Functor)
+open import Category.Instance.Preorders using (Preorders)
+open import Level using (Level)
+open import Relation.Binary.Bundles using (Preorder)
+open import Relation.Binary.Morphism using (PreorderHomomorphism)
+
+-- Get the underlying setoid of a preorder.
+-- This is not the same thing as the setoid induced by _≲_.
+
+Forget : {c ℓ e : Level} → Functor (Preorders c ℓ e) (Setoids c ℓ)
+Forget = let open Preorder.Eq in record
+ { F₀ = setoid
+ ; F₁ = λ F → let open PreorderHomomorphism F in record
+ { to = ⟦_⟧
+ ; cong = cong
+ }
+ ; identity = λ {A} → refl A
+ ; homomorphism = λ {_ _ Z} → refl Z
+ ; F-resp-≈ = λ f≗g → f≗g
+ }