| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Instantiating homogeneously indexed bundles at a particular index |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Relation.Binary.Indexed.Homogeneous.Construct.At where |
| 10 |
|
| 11 |
open import Level using (Level) |
| 12 |
open import Relation.Binary.Bundles using (Setoid; DecSetoid; Preorder) |
| 13 |
open import Relation.Binary.Indexed.Homogeneous |
| 14 |
using (IRel; IsIndexedEquivalence; IsIndexedDecEquivalence; IsIndexedPreorder |
| 15 |
; IndexedSetoid; IndexedDecSetoid; IndexedPreorder) |
| 16 |
open import Relation.Binary.Structures |
| 17 |
using (IsEquivalence; IsDecEquivalence; IsPreorder) |
| 18 |
|
| 19 |
private |
| 20 |
variable |
| 21 |
a i ℓ ℓ₁ ℓ₂ : Level |
| 22 |
I : Set i |
| 23 |
Aᵢ : I → Set a |
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- Structures |
| 27 |
|
| 28 |
isEquivalence : ∀ {_≈_ : IRel Aᵢ ℓ} → IsIndexedEquivalence Aᵢ _≈_ → |
| 29 |
(index : I) → IsEquivalence (_≈_ {index}) |
| 30 |
isEquivalence isEq index = record |
| 31 |
{ refl = reflᵢ |
| 32 |
; sym = symᵢ |
| 33 |
; trans = transᵢ |
| 34 |
} where open IsIndexedEquivalence isEq |
| 35 |
|
| 36 |
isDecEquivalence : ∀ {_≈_ : IRel Aᵢ ℓ} → IsIndexedDecEquivalence Aᵢ _≈_ → |
| 37 |
(index : I) → IsDecEquivalence (_≈_ {index}) |
| 38 |
isDecEquivalence isEq index = record |
| 39 |
{ isEquivalence = isEquivalence E.isEquivalenceᵢ index |
| 40 |
; _≟_ = E._≟ᵢ_ |
| 41 |
} where module E = IsIndexedDecEquivalence isEq |
| 42 |
|
| 43 |
isPreorder : ∀ {_≈_ : IRel Aᵢ ℓ₁} {_∼_ : IRel Aᵢ ℓ₂} → |
| 44 |
IsIndexedPreorder Aᵢ _≈_ _∼_ → |
| 45 |
(index : I) → IsPreorder (_≈_ {index}) _∼_ |
| 46 |
isPreorder isPreorder index = record |
| 47 |
{ isEquivalence = isEquivalence O.isEquivalenceᵢ index |
| 48 |
; reflexive = O.reflexiveᵢ |
| 49 |
; trans = O.transᵢ |
| 50 |
} where module O = IsIndexedPreorder isPreorder |
| 51 |
|
| 52 |
------------------------------------------------------------------------ |
| 53 |
-- Bundles |
| 54 |
|
| 55 |
setoid : IndexedSetoid I a ℓ → I → Setoid a ℓ |
| 56 |
setoid S index = record |
| 57 |
{ isEquivalence = isEquivalence S.isEquivalenceᵢ index |
| 58 |
} where module S = IndexedSetoid S |
| 59 |
|
| 60 |
decSetoid : IndexedDecSetoid I a ℓ → I → DecSetoid a ℓ |
| 61 |
decSetoid S index = record |
| 62 |
{ isDecEquivalence = isDecEquivalence DS.isDecEquivalenceᵢ index |
| 63 |
} where module DS = IndexedDecSetoid S |
| 64 |
|
| 65 |
preorder : IndexedPreorder I a ℓ₁ ℓ₂ → I → Preorder a ℓ₁ ℓ₂ |
| 66 |
preorder O index = record |
| 67 |
{ isPreorder = isPreorder O.isPreorderᵢ index |
| 68 |
} where module O = IndexedPreorder O |
| 69 |
|
| 70 |
------------------------------------------------------------------------ |
| 71 |
-- Some useful shorthand infix notation |
| 72 |
|
| 73 |
infixr -1 _atₛ_ |
| 74 |
|
| 75 |
_atₛ_ : ∀ {ℓ} → IndexedSetoid I a ℓ → I → Setoid a ℓ |
| 76 |
_atₛ_ = setoid |