| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of lists made up entirely of decidably unique elements |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Data.List.Base using ([]; _∷_; deduplicate) |
| 10 |
import Data.List.Relation.Unary.Unique.DecSetoid as Unique |
| 11 |
open import Data.List.Relation.Unary.All.Properties using (all-filter) |
| 12 |
open import Data.List.Relation.Unary.Unique.Setoid.Properties |
| 13 |
open import Level |
| 14 |
open import Relation.Binary.Bundles using (DecSetoid) |
| 15 |
|
| 16 |
module Data.List.Relation.Unary.Unique.DecSetoid.Properties where |
| 17 |
|
| 18 |
private |
| 19 |
variable |
| 20 |
a ℓ : Level |
| 21 |
|
| 22 |
------------------------------------------------------------------------ |
| 23 |
-- deduplicate |
| 24 |
|
| 25 |
module _ (DS : DecSetoid a ℓ) where |
| 26 |
|
| 27 |
open DecSetoid DS renaming (setoid to S) |
| 28 |
open Unique DS |
| 29 |
|
| 30 |
deduplicate-! : ∀ xs → Unique (deduplicate _≟_ xs) |
| 31 |
deduplicate-! [] = [] |
| 32 |
deduplicate-! (x ∷ xs) = all-filter _ (deduplicate _≟_ xs) ∷ filter⁺ S _ (deduplicate-! xs) |