Skip to content

Commit f5809ab

Browse files
author
Carlos Tomé
authored
Add keep and drop to subsets over lists (#1459)
1 parent 9816023 commit f5809ab

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,15 @@ Other minor additions
483483

484484
* Added new proof to `Data.List.Relation.Binary.Subset.Setoid.Properties`:
485485
```agda
486+
xs⊆x∷xs : xs ⊆ x ∷ xs
487+
∷⁺ʳ : xs ⊆ ys → x ∷ xs ⊆ x ∷ ys
486488
applyUpTo⁺ : m ≤ n → applyUpTo f m ⊆ applyUpTo f n
487489
```
488490

489491
* Added new proof to `Data.List.Relation.Binary.Subset.Propositional.Properties`:
490492
```agda
493+
xs⊆x∷xs : xs ⊆ x ∷ xs
494+
∷⁺ʳ : xs ⊆ ys → x ∷ xs ⊆ x ∷ ys
491495
applyUpTo⁺ : m ≤ n → applyUpTo f m ⊆ applyUpTo f n
492496
```
493497

src/Data/List/Relation/Binary/Subset/Propositional/Properties.agda

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ map⁺ f xs⊆ys =
133133
Prod.map₂ (Prod.map₁ xs⊆ys) ∘
134134
_⟨$⟩_ (Inverse.from (map-∈↔ f))
135135

136+
------------------------------------------------------------------------
137+
-- ∷
138+
139+
xs⊆x∷xs : (xs : List A) x xs ⊆ x ∷ xs
140+
xs⊆x∷xs = Setoidₚ.xs⊆x∷xs (setoid _)
141+
142+
∷⁺ʳ : x xs ⊆ ys x ∷ xs ⊆ x ∷ ys
143+
∷⁺ʳ = Setoidₚ.∷⁺ʳ (setoid _)
144+
136145
------------------------------------------------------------------------
137146
-- _++_
138147

src/Data/List/Relation/Binary/Subset/Setoid/Properties.agda

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ module _ (S : Setoid a ℓ) where
171171
------------------------------------------------------------------------
172172
-- Properties of list functions
173173
------------------------------------------------------------------------
174+
-- ∷
175+
176+
module _ (S : Setoid a ℓ) where
177+
178+
open Subset S
179+
180+
xs⊆x∷xs : xs x xs ⊆ x ∷ xs
181+
xs⊆x∷xs xs x = there
182+
183+
∷⁺ʳ : {xs ys} x xs ⊆ ys x ∷ xs ⊆ x ∷ ys
184+
∷⁺ʳ x xs⊆ys (here p) = here p
185+
∷⁺ʳ x xs⊆ys (there p) = there (xs⊆ys p)
186+
174187
-- ++
175188

176189
module _ (S : Setoid a ℓ) where

0 commit comments

Comments
 (0)