| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Creates trivially indexed records from their non-indexed counterpart. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Relation.Binary.Indexed.Heterogeneous.Construct.Trivial |
| 10 |
{i} {I : Set i} where |
| 11 |
|
| 12 |
open import Relation.Binary.Core using (Rel) |
| 13 |
open import Relation.Binary.Bundles using (Setoid; Preorder) |
| 14 |
open import Relation.Binary.Structures using (IsEquivalence; IsPreorder) |
| 15 |
open import Relation.Binary.Indexed.Heterogeneous |
| 16 |
using (IndexedSetoid; IndexedPreorder |
| 17 |
; IsIndexedEquivalence; IsIndexedPreorder) |
| 18 |
|
| 19 |
------------------------------------------------------------------------ |
| 20 |
-- Structures |
| 21 |
|
| 22 |
module _ {a} {A : Set a} where |
| 23 |
|
| 24 |
private |
| 25 |
Aᵢ : I → Set a |
| 26 |
Aᵢ i = A |
| 27 |
|
| 28 |
isIndexedEquivalence : ∀ {ℓ} {_≈_ : Rel A ℓ} → IsEquivalence _≈_ → |
| 29 |
IsIndexedEquivalence Aᵢ _≈_ |
| 30 |
isIndexedEquivalence isEq = record |
| 31 |
{ refl = refl |
| 32 |
; sym = sym |
| 33 |
; trans = trans |
| 34 |
} |
| 35 |
where open IsEquivalence isEq |
| 36 |
|
| 37 |
isIndexedPreorder : ∀ {ℓ₁ ℓ₂} {_≈_ : Rel A ℓ₁} {_∼_ : Rel A ℓ₂} → |
| 38 |
IsPreorder _≈_ _∼_ → |
| 39 |
IsIndexedPreorder Aᵢ _≈_ _∼_ |
| 40 |
isIndexedPreorder isPreorder = record |
| 41 |
{ isEquivalence = isIndexedEquivalence isEquivalence |
| 42 |
; reflexive = reflexive |
| 43 |
; trans = trans |
| 44 |
} |
| 45 |
where open IsPreorder isPreorder |
| 46 |
|
| 47 |
------------------------------------------------------------------------ |
| 48 |
-- Bundles |
| 49 |
|
| 50 |
indexedSetoid : ∀ {a ℓ} → Setoid a ℓ → IndexedSetoid I a ℓ |
| 51 |
indexedSetoid S = record |
| 52 |
{ isEquivalence = isIndexedEquivalence isEquivalence |
| 53 |
} |
| 54 |
where open Setoid S |
| 55 |
|
| 56 |
indexedPreorder : ∀ {a ℓ₁ ℓ₂} → Preorder a ℓ₁ ℓ₂ → |
| 57 |
IndexedPreorder I a ℓ₁ ℓ₂ |
| 58 |
indexedPreorder O = record |
| 59 |
{ isPreorder = isIndexedPreorder isPreorder |
| 60 |
} |
| 61 |
where open Preorder O |