[ add ] filter-∩, filter-map and filter-swap for Data.List.Properties#2942
[ add ] filter-∩, filter-map and filter-swap for Data.List.Properties#2942jamesmckinna merged 5 commits intoagda:masterfrom
filter-∩, filter-map and filter-swap for Data.List.Properties#2942Conversation
jamesmckinna
left a comment
There was a problem hiding this comment.
Thanks very much for the first PR!
With some suggestions for streamlining your submitted code.
|
As for your proposed
That seems good, too, but think that As for direct-style proofs vs. appeal to existing lemmas, and use of function equalities, the latter as you have chosen, does seem nice. If there are opportunities to refactor later, the let's do that later. For now, a nice first contribution! |
* also introduced minor readibility rewrites for `filter-∩` and `filter-swap`
|
I added the |
filter-∩ and filter-swap for Data.List.Propertiesfilter-∩, filter-map and filter-swap for Data.List.Properties
|
And you'll need to add a |
|
Sorry for that oversight - i was so eager to install Done now! Sorry for the many commits, I think squashing them would be best. |
We squash on merge. |
CHANGELOG.md
Outdated
| filter-map : (f : B → A) → filter P? ∘ map f ≗ map f ∘ filter (P? ∘ f) | ||
| filter-∩ : filter (P? ∩? Q?) ≗ filter P? ∘ filter Q? | ||
| filter-swap : filter P? ∘ filter Q? ≗ filter Q? ∘ filter P? |
There was a problem hiding this comment.
Two quick nit picks:
- for each block of additions, we tend to align the
:for readability - just as for the second and third, there's no need to mention the quantification over
P?,Q?etc., neither is it really necessary to mention thefbinding in the first one...
The last point may be more of an individual opinion than canon, but AFAIAC, the reader who wants to know the details of implicit vs. explicit quantification can, and will do so in the source. At the current moment of writing, we don't attempt to machine-check any validity criteria for CHANGELOGs, so they can only be considered advisory, rather than definitive!
Co-authored-by: jamesmckinna <31931406+jamesmckinna@users.noreply.github.com>
I recently was surprised that the standard library doesn't prove these two laws, so I quickly added them.
I hope I followed all guidelines etc.
There is one thing where opinions can differ in style:
filter-swapcould either be proven by directly pattern matching onP? xandQ? xrespectively, but I feel like using propositional equality is more elegant. The downside is the additional module definition (which could maybe be written differently? - I'm new to Agda).Edit:
would also be a nice addition.