Skip to content

Commit e2adecc

Browse files
committed
[ add ] Data.List.Fresh.Membership.DecSetoid
1 parent b4aa4eb commit e2adecc

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ New modules
100100

101101
* `Algebra.Properties.Semiring`.
102102

103+
* `Data.List.Fresh.Membership.DecSetoid`.
104+
103105
* `Data.List.Relation.Binary.Permutation.Algorithmic{.Properties}` for the Choudhury and Fiore definition of permutation, and its equivalence with `Declarative` below.
104106

105107
* `Data.List.Relation.Binary.Permutation.Declarative{.Properties}` for the least congruence on `List` making `_++_` commutative, and its equivalence with the `Setoid` definition.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
------------------------------------------------------------------------
2+
-- The Agda standard library
3+
--
4+
-- Decidable setoid membership over fresh lists
5+
------------------------------------------------------------------------
6+
7+
{-# OPTIONS --cubical-compatible --safe #-}
8+
9+
open import Relation.Binary.Bundles using (DecSetoid)
10+
11+
module Data.List.Fresh.Membership.DecSetoid {a ℓ} (DS : DecSetoid a ℓ) where
12+
13+
open import Level using (Level)
14+
open import Data.List.Fresh.Relation.Unary.Any using (any?)
15+
import Data.List.Fresh.Membership.Setoid as MembershipSetoid
16+
open import Relation.Binary.Core using (Rel)
17+
open import Relation.Binary.Definitions using (Decidable)
18+
open import Relation.Nullary.Decidable using (¬?)
19+
20+
open DecSetoid DS using (setoid; _≟_) renaming (Carrier to A)
21+
22+
private
23+
variable
24+
r : Level
25+
R : Rel A r
26+
27+
28+
------------------------------------------------------------------------
29+
-- Re-export contents of Setoid membership
30+
open MembershipSetoid setoid public
31+
32+
------------------------------------------------------------------------
33+
-- Other operations
34+
infix 4 _∈?_ _∉?_
35+
36+
_∈?_ : Decidable (_∈_ {R = R})
37+
x ∈? xs = any? (x ≟_) xs
38+
39+
_∉?_ : Decidable (_∉_ {R = R})
40+
x ∉? xs = ¬? (x ∈? xs)

0 commit comments

Comments
 (0)