| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Equality over indexed container extensions parametrised by a setoid |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary using (Setoid) |
| 10 |
|
| 11 |
module Data.Container.Indexed.Relation.Binary.Equality.Setoid |
| 12 |
{ℓⁱ ℓᶜ ℓᵉ} {I : Set ℓⁱ} (S : I → Setoid ℓᶜ ℓᵉ) |
| 13 |
where |
| 14 |
|
| 15 |
open import Function |
| 16 |
open import Level using (Level; _⊔_; suc) |
| 17 |
open import Relation.Binary using (Reflexive; Symmetric; Transitive; IsEquivalence) |
| 18 |
open import Relation.Binary.Core using (Rel) |
| 19 |
open import Data.Container.Indexed.Core using (Container; ⟦_⟧) |
| 20 |
open import Data.Container.Indexed.Relation.Binary.Pointwise using (Pointwise) |
| 21 |
import Data.Container.Indexed.Relation.Binary.Pointwise.Properties |
| 22 |
as Pointwise |
| 23 |
|
| 24 |
open Setoid using (Carrier; _≈_) |
| 25 |
|
| 26 |
private variable |
| 27 |
ℓˢ ℓᵖ : Level |
| 28 |
O : Set _ |
| 29 |
|
| 30 |
------------------------------------------------------------------------ |
| 31 |
-- Definition of equality |
| 32 |
|
| 33 |
module _ (C : Container I O ℓˢ ℓᵖ) (o : O) where |
| 34 |
|
| 35 |
Eq : Rel (⟦ C ⟧ (Carrier ∘ S) o) (ℓᵉ ⊔ ℓˢ ⊔ ℓᵖ) |
| 36 |
Eq = Pointwise C (_≈_ ∘ S) o |
| 37 |
|
| 38 |
------------------------------------------------------------------------ |
| 39 |
-- Relational properties |
| 40 |
|
| 41 |
refl : Reflexive Eq |
| 42 |
refl = Pointwise.refl C _ (Setoid.refl ∘ S) |
| 43 |
|
| 44 |
sym : Symmetric Eq |
| 45 |
sym = Pointwise.sym C _ (Setoid.sym ∘ S) |
| 46 |
|
| 47 |
trans : Transitive Eq |
| 48 |
trans = Pointwise.trans C _ (Setoid.trans ∘ S) |
| 49 |
|
| 50 |
isEquivalence : IsEquivalence Eq |
| 51 |
isEquivalence = record |
| 52 |
{ refl = refl |
| 53 |
; sym = sym |
| 54 |
; trans = trans |
| 55 |
} |
| 56 |
|
| 57 |
setoid : Setoid (ℓˢ ⊔ ℓᵖ ⊔ ℓᶜ) (ℓˢ ⊔ ℓᵖ ⊔ ℓᵉ) |
| 58 |
setoid = record |
| 59 |
{ isEquivalence = isEquivalence |
| 60 |
} |