Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ Additions to existing modules
∈⇒≤product : All NonZero ns → n ∈ ns → n ≤ product ns
concatMap-++ : concatMap f (xs ++ ys) ≡ concatMap f xs ++ concatMap f ys
filter-≐ : P ≐ Q → filter P? ≗ filter Q?

partition-is-foldr : partition P? ≗ foldr (λ x → if does (P? x) then Product.map₁ (x ∷_)
else Product.map₂ (x ∷_))
([] , [])
```

* In `Data.List.Relation.Unary.Any.Properties`:
Expand Down
8 changes: 8 additions & 0 deletions src/Data/List/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,14 @@ module _ {P : Pred A p} (P? : Decidable P) where
... | true = Product.map s≤s m≤n⇒m≤1+n ih
... | false = Product.map m≤n⇒m≤1+n s≤s ih

partition-is-foldr : partition P? ≗ foldr (λ x → if does (P? x) then Product.map₁ (x ∷_)
else Product.map₂ (x ∷_))
([] , [])
partition-is-foldr [] = refl
partition-is-foldr (x ∷ xs) with ih ← partition-is-foldr xs | does (P? x)
... | true = cong (Product.map₁ (x ∷_)) ih
... | false = cong (Product.map₂ (x ∷_)) ih

------------------------------------------------------------------------
-- _ʳ++_

Expand Down