Skip to content

Commit d13d1ef

Browse files
fixes #2466 (#2478)
Co-authored-by: MatthewDaggitt <[email protected]>
1 parent fc54cfb commit d13d1ef

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ Additions to existing modules
125125

126126
* In `Data.List.Membership.Setoid.Properties`:
127127
```agda
128+
∉⇒All[≉] : x ∉ xs → All (x ≉_) xs
129+
All[≉]⇒∉ : All (x ≉_) xs → x ∉ xs
128130
Any-∈-swap : Any (_∈ ys) xs → Any (_∈ xs) ys
129131
All-∉-swap : All (_∉ ys) xs → All (_∉ xs) ys
130132
∈-map∘filter⁻ : y ∈₂ map f (filter P? xs) → ∃[ x ] x ∈₁ xs × y ≈₂ f x × P x

src/Data/List/Membership/Setoid/Properties.agda

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ module _ (S : Setoid c ℓ) where
7575
∉-resp-≋ : {x} (x ∉_) Respects _≋_
7676
∉-resp-≋ xs≋ys v∉xs v∈ys = v∉xs (∈-resp-≋ (≋-sym xs≋ys) v∈ys)
7777

78+
-- x ∉_ is equivalent to All (x ≉_)
79+
80+
∉⇒All[≉] : {x xs} x ∉ xs All (x ≉_) xs
81+
∉⇒All[≉] = All.¬Any⇒All¬ _
82+
83+
All[≉]⇒∉ : {x xs} All (x ≉_) xs x ∉ xs
84+
All[≉]⇒∉ = All.All¬⇒¬Any
85+
7886
-- index is injective in its first argument.
7987

8088
index-injective : {x₁ x₂ xs} (x₁∈xs : x₁ ∈ xs) (x₂∈xs : x₂ ∈ xs)
@@ -93,7 +101,7 @@ module _ (S : Setoid c ℓ) where
93101

94102
private
95103
∉×∈⇒≉ : {x y xs} All (y ≉_) xs x ∈ xs x ≉ y
96-
∉×∈⇒≉ = All.lookupWith λ y≉z x≈z x≈y y≉z (trans (sym x≈y) x≈z)
104+
∉×∈⇒≉ ≉s x∈xs x≈y = All[≉]⇒∉ S ≉s (∈-resp-≈ S x≈y x∈xs)
97105

98106
unique⇒irrelevant : Binary.Irrelevant _≈_ {xs} Unique xs Unary.Irrelevant (_∈ xs)
99107
unique⇒irrelevant ≈-irr _ (here p) (here q) =

0 commit comments

Comments
 (0)