Skip to content

Commit 6633371

Browse files
authored
Add all⊆concat (agda#2513)
* Fixes agda#2509 * remove parentheses
1 parent 1fdafef commit 6633371

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ Additions to existing modules
315315
([] , [])
316316
```
317317

318+
* In `Data.List.Relation.Unary.All.Properties`:
319+
```agda
320+
all⊆concat : (xss : List (List A)) → All (Sublist._⊆ concat xss) xss
321+
```
322+
318323
* In `Data.List.Relation.Unary.Any.Properties`:
319324
```agda
320325
concatMap⁺ : Any (Any P ∘ f) xs → Any P (concatMap f xs)

src/Data/List/Relation/Unary/All/Properties.agda

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import Data.List.Membership.Setoid as SetoidMembership
2020
import Data.List.Properties as List
2121
import Data.List.Relation.Binary.Equality.Setoid as ≋
2222
open import Data.List.Relation.Binary.Pointwise.Base using (Pointwise; []; _∷_)
23-
open import Data.List.Relation.Binary.Subset.Propositional using (_⊆_)
23+
import Data.List.Relation.Binary.Sublist.Propositional as Sublist
24+
import Data.List.Relation.Binary.Sublist.Propositional.Properties
25+
as Sublist
26+
import Data.List.Relation.Binary.Subset.Propositional as Subset
2427
open import Data.List.Relation.Unary.All as All using
2528
( All; []; _∷_; lookup; updateAt
2629
; _[_]=_; here; there
@@ -385,6 +388,11 @@ concat⁻ : ∀ {xss} → All P (concat xss) → All (All P) xss
385388
concat⁻ {xss = []} [] = []
386389
concat⁻ {xss = xs ∷ xss} pxs = ++⁻ˡ xs pxs ∷ concat⁻ (++⁻ʳ xs pxs)
387390

391+
all⊆concat : (xss : List (List A)) All (Sublist._⊆ concat xss) xss
392+
all⊆concat [] = []
393+
all⊆concat (xs ∷ xss) =
394+
Sublist.++⁺ʳ (concat xss) Sublist.⊆-refl ∷ All.map (Sublist.++⁺ˡ xs) (all⊆concat xss)
395+
388396
------------------------------------------------------------------------
389397
-- snoc
390398

@@ -675,10 +683,10 @@ module _ (p : A → Bool) where
675683
------------------------------------------------------------------------
676684
-- All is anti-monotone.
677685

678-
anti-mono : xs ⊆ ys All P ys All P xs
686+
anti-mono : xs Subset.⊆ ys All P ys All P xs
679687
anti-mono xs⊆ys pys = All.tabulate (lookup pys ∘ xs⊆ys)
680688

681-
all-anti-mono : (p : A Bool) xs ⊆ ys T (all p ys) T (all p xs)
689+
all-anti-mono : (p : A Bool) xs Subset.⊆ ys T (all p ys) T (all p xs)
682690
all-anti-mono p xs⊆ys = all⁻ p ∘ anti-mono xs⊆ys ∘ all⁺ p _
683691

684692
------------------------------------------------------------------------

0 commit comments

Comments
 (0)