| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of refinement types |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Data.Refinement.Properties where |
| 10 |
|
| 11 |
open import Data.Refinement.Base |
| 12 |
open import Level using (Level; _⊔_) |
| 13 |
open import Relation.Binary.Definitions using (DecidableEquality) |
| 14 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl; cong) |
| 15 |
import Relation.Nullary.Decidable.Core as Dec |
| 16 |
|
| 17 |
private |
| 18 |
variable |
| 19 |
a p : Level |
| 20 |
A : Set a |
| 21 |
P : A → Set p |
| 22 |
v w : [ x ∈ A ∣ P x ] |
| 23 |
|
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- Basic properties |
| 27 |
|
| 28 |
value-injective : value v ≡ value w → v ≡ w |
| 29 |
value-injective refl = refl |
| 30 |
|
| 31 |
module _ (eq? : DecidableEquality A) where |
| 32 |
|
| 33 |
infix 4 _≟_ |
| 34 |
_≟_ : DecidableEquality [ x ∈ A ∣ P x ] |
| 35 |
v ≟ w = Dec.map′ value-injective (cong value) (eq? (value v) (value w)) |