Debian Codegraph @

src/Data/Product/Relation/Binary/Pointwise/Dependent/WithK.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Properties that are related to pointwise lifting of binary
5 -- relations to sigma types and make use of heterogeneous equality
6 ------------------------------------------------------------------------
7
8 {-# OPTIONS --with-K --safe #-}
9
10 module Data.Product.Relation.Binary.Pointwise.Dependent.WithK where
11
12 open import Data.Product.Base using (Σ; uncurry; _,_)
13 open import Data.Product.Relation.Binary.Pointwise.Dependent
14 open import Function.Base using (id)
15 open import Function.Bundles using (Inverse)
16 open import Level using (Level)
17 open import Relation.Binary.Core using (_⇒_)
18 open import Relation.Binary.HeterogeneousEquality as ≅ using (_≅_)
19 open import Relation.Binary.Indexed.Heterogeneous using (IndexedSetoid)
20 open import Relation.Binary.PropositionalEquality.Core as ≡ using (_≡_)
21 import Relation.Binary.PropositionalEquality.Properties as ≡
22
23 private
24 variable
25 a b : Level
26 I : Set a
27 A : I → Set a
28
29 ------------------------------------------------------------------------
30 -- The propositional equality setoid over sigma types can be
31 -- decomposed using Pointwise
32
33 Pointwise-≡⇒≡ : Pointwise A _≡_ (λ x y → x ≅ y) ⇒ _≡_
34 Pointwise-≡⇒≡ (≡.refl , ≅.refl) = ≡.refl
35
36 ≡⇒Pointwise-≡ : _≡_ ⇒ Pointwise A _≡_ (λ x y → x ≅ y)
37 ≡⇒Pointwise-≡ ≡.refl = (≡.refl , ≅.refl)
38
39 Pointwise-≡↔≡ : Inverse (setoid (≡.setoid I) (≅.indexedSetoid A)) (≡.setoid (Σ I A))
40 Pointwise-≡↔≡ = record
41 { to = id
42 ; to-cong = Pointwise-≡⇒≡
43 ; from = id
44 ; from-cong = ≡⇒Pointwise-≡
45 ; inverse = (λ {(≡.refl , ≅.refl) → ≡.refl}) , λ {≡.refl → (≡.refl , ≅.refl)}
46 }