| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Closure of a unary relation with respect to a preorder |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Bundles using (Preorder) |
| 10 |
|
| 11 |
module Relation.Unary.Closure.Preorder {a r e} (P : Preorder a e r) where |
| 12 |
|
| 13 |
open import Relation.Unary using (Pred) |
| 14 |
|
| 15 |
open Preorder P |
| 16 |
|
| 17 |
-- Specialising the results proven generically in `Base`. |
| 18 |
import Relation.Unary.Closure.Base _∼_ as Base |
| 19 |
open Base public |
| 20 |
using (□; ◇; Closed; curry; uncurry) |
| 21 |
hiding (module □; module ◇) |
| 22 |
|
| 23 |
module □ {t} {T : Pred Carrier t} where |
| 24 |
|
| 25 |
reindex : ∀ {x y} → x ∼ y → □ T x → □ T y |
| 26 |
reindex = Base.□.reindex trans |
| 27 |
|
| 28 |
extract : ∀ {x} → □ T x → T x |
| 29 |
extract = Base.□.extract refl |
| 30 |
|
| 31 |
duplicate : ∀ {x} → □ T x → □ (□ T) x |
| 32 |
duplicate = Base.□.duplicate trans |
| 33 |
|
| 34 |
closed : ∀ {t} {T : Pred Carrier t} → Closed (□ T) |
| 35 |
closed = Base.□.closed trans |
| 36 |
|
| 37 |
open Base.□ public using (map) |
| 38 |
|
| 39 |
module ◇ {t} {T : Pred Carrier t} where |
| 40 |
|
| 41 |
reindex : ∀ {x y} → x ∼ y → ◇ T x → ◇ T y |
| 42 |
reindex = Base.◇.reindex trans |
| 43 |
|
| 44 |
pure : ∀ {x} → T x → ◇ T x |
| 45 |
pure = Base.◇.pure refl |
| 46 |
|
| 47 |
join : ∀ {x} → ◇ (◇ T) x → ◇ T x |
| 48 |
join = Base.◇.join trans |
| 49 |
|
| 50 |
closed : Closed (◇ T) |
| 51 |
closed = Base.◇.closed trans |
| 52 |
|
| 53 |
open Base.◇ public using (map; run) |