| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of pointwise equality for indexed containers |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Data.Container.Indexed.Relation.Binary.Pointwise.Properties where |
| 10 |
|
| 11 |
open import Axiom.Extensionality.Propositional using (Extensionality) |
| 12 |
open import Data.Container.Indexed.Core using (Container; ⟦_⟧) |
| 13 |
open import Data.Container.Indexed.Relation.Binary.Pointwise |
| 14 |
using (Pointwise) |
| 15 |
open import Data.Product.Base using (_,_; Σ-syntax; -,_) |
| 16 |
open import Level using (Level; _⊔_) |
| 17 |
open import Relation.Binary.Core using (Rel) |
| 18 |
open import Relation.Binary.Definitions using (Reflexive; Symmetric; Transitive) |
| 19 |
open import Relation.Binary.PropositionalEquality.Core as ≡ |
| 20 |
using (_≡_; subst; cong) |
| 21 |
|
| 22 |
private variable |
| 23 |
ℓᵉ ℓᵖ ℓˢ ℓˣ : Level |
| 24 |
I O : Set _ |
| 25 |
|
| 26 |
module _ |
| 27 |
(C : Container I O ℓˢ ℓᵖ) {X : I → Set ℓˣ} |
| 28 |
(R : (i : I) → Rel (X i) ℓᵉ) |
| 29 |
{o : O} |
| 30 |
where |
| 31 |
|
| 32 |
refl : (∀ i → Reflexive (R i)) → Reflexive (Pointwise C R o) |
| 33 |
refl R-refl = ≡.refl , λ p → R-refl _ |
| 34 |
|
| 35 |
sym : (∀ i → Symmetric (R i)) → Symmetric (Pointwise C R o) |
| 36 |
sym R-sym (≡.refl , f) = ≡.refl , λ p → R-sym _ (f p) |
| 37 |
|
| 38 |
trans : (∀ i → Transitive (R i)) → Transitive (Pointwise C R o) |
| 39 |
trans R-trans (≡.refl , f) (≡.refl , g) = ≡.refl , λ p → R-trans _ (f p) (g p) |
| 40 |
|
| 41 |
-- If propositional equality is extensional, then `Eq _≡_` and `_≡_` coincide. |
| 42 |
Eq⇒≡ : {C : Container I O ℓˢ ℓᵖ} {X : I → Set ℓˣ} {R : (i : I) → Rel (X i) ℓᵉ} |
| 43 |
{o : O} {xs ys : ⟦ C ⟧ X o} → |
| 44 |
Extensionality ℓᵖ ℓˣ → |
| 45 |
Pointwise C (λ (i : I) → _≡_ {A = X i}) o xs ys → |
| 46 |
xs ≡ ys |
| 47 |
Eq⇒≡ ext (≡.refl , f≈f′) = cong -,_ (ext f≈f′) |