Debian Codegraph @

src/Data/List/Relation/Binary/Disjoint/Setoid.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Pairs of lists that share no common elements (setoid equality)
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 open import Relation.Binary.Bundles using (Setoid)
10
11 module Data.List.Relation.Binary.Disjoint.Setoid {c ℓ} (S : Setoid c ℓ) where
12
13 open import Level using (_⊔_)
14 open import Relation.Nullary.Negation using (¬_)
15 open import Function.Base using (_∘_)
16 open import Data.List.Base using (List; []; [_]; _∷_)
17 open import Data.List.Relation.Unary.Any using (here; there)
18 open import Data.Product.Base using (_×_; _,_)
19 open import Relation.Binary.Core using (Rel)
20
21 open Setoid S renaming (Carrier to A)
22 open import Data.List.Membership.Setoid S using (_∈_; _∉_)
23
24 ------------------------------------------------------------------------
25 -- Definition
26
27 Disjoint : Rel (List A) (ℓ ⊔ c)
28 Disjoint xs ys = ∀ {v} → ¬ (v ∈ xs × v ∈ ys)
29
30 ------------------------------------------------------------------------
31 -- Operations
32
33 contractₗ : ∀ {x xs ys} → Disjoint (x ∷ xs) ys → Disjoint xs ys
34 contractₗ x∷xs∩ys=∅ (v∈xs , v∈ys) = x∷xs∩ys=∅ (there v∈xs , v∈ys)
35
36 contractᵣ : ∀ {xs y ys} → Disjoint xs (y ∷ ys) → Disjoint xs ys
37 contractᵣ xs#y∷ys (v∈xs , v∈ys) = xs#y∷ys (v∈xs , there v∈ys)