| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Decidable setoid membership over lists |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Bundles using (DecSetoid) |
| 10 |
|
| 11 |
module Data.List.Membership.DecSetoid {a ℓ} (DS : DecSetoid a ℓ) where |
| 12 |
|
| 13 |
open import Data.List.Relation.Unary.Any using (any?) |
| 14 |
open import Relation.Binary.Definitions using (Decidable) |
| 15 |
open import Relation.Nullary.Decidable using (¬?) |
| 16 |
|
| 17 |
open DecSetoid DS |
| 18 |
|
| 19 |
------------------------------------------------------------------------ |
| 20 |
-- Re-export contents of propositional membership |
| 21 |
|
| 22 |
open import Data.List.Membership.Setoid (DecSetoid.setoid DS) public |
| 23 |
|
| 24 |
------------------------------------------------------------------------ |
| 25 |
-- Other operations |
| 26 |
|
| 27 |
infix 4 _∈?_ _∉?_ |
| 28 |
|
| 29 |
_∈?_ : Decidable _∈_ |
| 30 |
x ∈? xs = any? (x ≟_) xs |
| 31 |
|
| 32 |
_∉?_ : Decidable _∉_ |
| 33 |
x ∉? xs = ¬? (x ∈? xs) |