Debian Codegraph @

src/Data/Vec/Membership/DecSetoid.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Decidable setoid membership over vectors.
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 open import Relation.Binary.Bundles using (DecSetoid)
10
11 module Data.Vec.Membership.DecSetoid {c ℓ} (DS : DecSetoid c ℓ) where
12
13 open import Data.Vec.Base using (Vec)
14 open import Data.Vec.Relation.Unary.Any using (any?)
15 open import Relation.Nullary.Decidable using (Dec)
16 open DecSetoid DS renaming (Carrier to A)
17
18 ------------------------------------------------------------------------
19 -- Re-export contents of propositional membership
20
21 open import Data.Vec.Membership.Setoid setoid public
22
23 ------------------------------------------------------------------------
24 -- Other operations
25
26 infix 4 _∈?_
27
28 _∈?_ : ∀ x {n} (xs : Vec A n) → Dec (x ∈ xs)
29 x ∈? xs = any? (x ≟_) xs