Skip to content

Commit fc8f1a0

Browse files
authored
fixes #2520 (#2521)
1 parent bacd8a5 commit fc8f1a0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ Additions to existing modules
332332
* In `Data.List.Relation.Unary.All.Properties`:
333333
```agda
334334
all⊆concat : (xss : List (List A)) → All (Sublist._⊆ concat xss) xss
335+
all⇒dropWhile≡[] : (P? : Decidable P) → All P xs → dropWhile P? xs ≡ []
336+
all⇒takeWhile≗id : (P? : Decidable P) → All P xs → takeWhile P? xs ≡ xs
335337
```
336338

337339
* In `Data.List.Relation.Unary.Any.Properties`:

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ open import Relation.Binary.PropositionalEquality.Core
4747
open import Relation.Nullary.Reflects using (invert)
4848
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
4949
open import Relation.Nullary.Decidable
50-
using (Dec; does; yes; no; _because_; ¬?; decidable-stable)
50+
using (Dec; does; yes; no; _because_; ¬?; decidable-stable; dec-true)
5151
open import Relation.Unary
5252
using (Decidable; Pred; Universal; ∁; _∩_; _⟨×⟩_) renaming (_⊆_ to _⋐_)
5353
open import Relation.Unary.Properties using (∁?)
@@ -461,6 +461,11 @@ all-head-dropWhile P? (x ∷ xs) with P? x
461461
... | yes px = all-head-dropWhile P? xs
462462
... | no ¬px = just ¬px
463463

464+
all⇒dropWhile≡[] : (P? : Decidable P) All P xs dropWhile P? xs ≡ []
465+
all⇒dropWhile≡[] P? [] = refl
466+
all⇒dropWhile≡[] P? (px ∷ pxs) rewrite dec-true (P? _) px
467+
= all⇒dropWhile≡[] P? pxs
468+
464469
take⁺ : n All P xs All P (take n xs)
465470
take⁺ zero pxs = []
466471
take⁺ (suc n) [] = []
@@ -484,6 +489,11 @@ all-takeWhile P? (x ∷ xs) with P? x
484489
... | yes px = px ∷ all-takeWhile P? xs
485490
... | no ¬px = []
486491

492+
all⇒takeWhile≗id : (P? : Decidable P) All P xs takeWhile P? xs ≡ xs
493+
all⇒takeWhile≗id P? [] = refl
494+
all⇒takeWhile≗id P? (px ∷ pxs) rewrite dec-true (P? _) px
495+
= cong (_ ∷_) (all⇒takeWhile≗id P? pxs)
496+
487497
------------------------------------------------------------------------
488498
-- applyUpTo
489499

0 commit comments

Comments
 (0)