Skip to content

Commit 69c93f5

Browse files
authored
[ add ] some properties connecting ∈ and ++ inherited from Any (#1756)
1 parent 7d0dd94 commit 69c93f5

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,16 @@ Other minor changes
17741774
lookup-transpose⁺ : ∀ n (ass : List⁺ (Stream A)) → lookup n (transpose⁺ ass) ≡ List⁺.map (lookup n) ass
17751775
```
17761776

1777+
* Added new corollaries in `Data.List.Membership.Setoid.Properties`:
1778+
```
1779+
∈-++⁺∘++⁻ : ∀ {v} xs {ys} (p : v ∈ xs ++ ys) → [ ∈-++⁺ˡ , ∈-++⁺ʳ xs ]′ (∈-++⁻ xs p) ≡ p
1780+
∈-++⁻∘++⁺ : ∀ {v} xs {ys} (p : v ∈ xs ⊎ v ∈ ys) → ∈-++⁻ xs ([ ∈-++⁺ˡ , ∈-++⁺ʳ xs ]′ p) ≡ p
1781+
∈-++↔ : ∀ {v xs ys} → (v ∈ xs ⊎ v ∈ ys) ↔ v ∈ xs ++ ys
1782+
∈-++-comm : ∀ {v} xs ys → v ∈ xs ++ ys → v ∈ ys ++ xs
1783+
∈-++-comm∘++-comm : ∀ {v} xs {ys} (p : v ∈ xs ++ ys) → ∈-++-comm ys xs (∈-++-comm xs ys p) ≡ p
1784+
∈-++↔++ : ∀ {v} xs ys → v ∈ xs ++ ys ↔ v ∈ ys ++ xs
1785+
```
1786+
17771787
NonZero/Positive/Negative changes
17781788
---------------------------------
17791789

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ open import Data.Nat.Base using (suc; z≤n; s≤s; _≤_; _<_)
2222
open import Data.Nat.Properties using (≤-trans; n≤1+n)
2323
open import Data.Product as Prod using (∃; _×_; _,_ ; ∃₂; proj₁; proj₂)
2424
open import Data.Product.Relation.Binary.Pointwise.NonDependent using (_×ₛ_)
25-
open import Data.Sum.Base using (_⊎_; inj₁; inj₂)
25+
open import Data.Sum.Base using (_⊎_; inj₁; inj₂; [_,_]′)
2626
open import Function.Base using (_$_; flip; _∘_; id)
27+
open import Function.Inverse using (_↔_)
2728
open import Level using (Level)
2829
open import Relation.Binary as B hiding (Decidable)
2930
open import Relation.Binary.PropositionalEquality as P using (_≡_)
@@ -163,6 +164,27 @@ module _ (S : Setoid c ℓ) where
163164
∈-++⁻ : {v} xs {ys} v ∈ xs ++ ys (v ∈ xs) ⊎ (v ∈ ys)
164165
∈-++⁻ = Any.++⁻
165166

167+
∈-++⁺∘++⁻ : {v} xs {ys} (p : v ∈ xs ++ ys)
168+
[ ∈-++⁺ˡ , ∈-++⁺ʳ xs ]′ (∈-++⁻ xs p) ≡ p
169+
∈-++⁺∘++⁻ = Any.++⁺∘++⁻
170+
171+
∈-++⁻∘++⁺ : {v} xs {ys} (p : v ∈ xs ⊎ v ∈ ys)
172+
∈-++⁻ xs ([ ∈-++⁺ˡ , ∈-++⁺ʳ xs ]′ p) ≡ p
173+
∈-++⁻∘++⁺ = Any.++⁻∘++⁺
174+
175+
∈-++↔ : {v xs ys} (v ∈ xs ⊎ v ∈ ys) ↔ v ∈ xs ++ ys
176+
∈-++↔ = Any.++↔
177+
178+
∈-++-comm : {v} xs ys v ∈ xs ++ ys v ∈ ys ++ xs
179+
∈-++-comm = Any.++-comm
180+
181+
∈-++-comm∘++-comm : {v} xs {ys} (p : v ∈ xs ++ ys)
182+
∈-++-comm ys xs (∈-++-comm xs ys p) ≡ p
183+
∈-++-comm∘++-comm = Any.++-comm∘++-comm
184+
185+
∈-++↔++ : {v} xs ys v ∈ xs ++ ys ↔ v ∈ ys ++ xs
186+
∈-++↔++ = Any.++↔++
187+
166188
∈-insert : xs {ys v w} v ≈ w v ∈ xs ++ [ w ] ++ ys
167189
∈-insert xs = Any.++-insert xs
168190

0 commit comments

Comments
 (0)