| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Several kinds of "relatedness" for containers such as equivalences, |
| 5 |
-- surjections and bijections |
| 6 |
------------------------------------------------------------------------ |
| 7 |
|
| 8 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 9 |
|
| 10 |
module Data.Container.Related where |
| 11 |
|
| 12 |
open import Data.Container.Core using (Container; ⟦_⟧) |
| 13 |
open import Data.Container.Membership using (_∈_) |
| 14 |
import Function.Related.Propositional as Related |
| 15 |
open import Level using (_⊔_) |
| 16 |
open import Relation.Binary.Bundles using (Preorder; Setoid) |
| 17 |
|
| 18 |
open Related public |
| 19 |
using (Kind; SymmetricKind) |
| 20 |
renaming ( implication to subset |
| 21 |
; reverseImplication to superset |
| 22 |
; equivalence to set |
| 23 |
; injection to subbag |
| 24 |
; reverseInjection to superbag |
| 25 |
; bijection to bag |
| 26 |
) |
| 27 |
|
| 28 |
[_]-Order : ∀ {s p ℓ} → Kind → Container s p → Set ℓ → |
| 29 |
Preorder (s ⊔ p ⊔ ℓ) (s ⊔ p ⊔ ℓ) (p ⊔ ℓ) |
| 30 |
[ k ]-Order C X = Related.InducedPreorder₂ k (_∈_ {C = C} {X = X}) |
| 31 |
|
| 32 |
[_]-Equality : ∀ {s p ℓ} → SymmetricKind → Container s p → Set ℓ → |
| 33 |
Setoid (s ⊔ p ⊔ ℓ) (p ⊔ ℓ) |
| 34 |
[ k ]-Equality C X = Related.InducedEquivalence₂ k (_∈_ {C = C} {X = X}) |
| 35 |
|
| 36 |
infix 4 _≲[_]_ |
| 37 |
_≲[_]_ : ∀ {s p x} {C : Container s p} {X : Set x} → |
| 38 |
⟦ C ⟧ X → Kind → ⟦ C ⟧ X → Set (p ⊔ x) |
| 39 |
_≲[_]_ {C = C} {X} xs k ys = Preorder._≲_ ([ k ]-Order C X) xs ys |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
------------------------------------------------------------------------ |
| 44 |
-- DEPRECATED |
| 45 |
------------------------------------------------------------------------ |
| 46 |
-- Please use the new names as continuing support for the old names is |
| 47 |
-- not guaranteed. |
| 48 |
|
| 49 |
-- Version 2.0 |
| 50 |
|
| 51 |
infix 4 _∼[_]_ |
| 52 |
_∼[_]_ = _≲[_]_ |
| 53 |
{-# WARNING_ON_USAGE _∼[_]_ |
| 54 |
"Warning: _∼[_]_ was deprecated in v2.0. Please use _≲[_]_ instead. " |
| 55 |
#-} |