Draft: Add law `map_fold_foldr` to `FinMap` interface.
See the discussion at https://mattermost.mpi-sws.org/iris/pl/dmdsga9stjgebfwwnjmike56do
This rule expresses a form of "parametricity": it says that regardless of A
, B
, f
, and b
, the function map_fold f b m
will always traverse the map m
in the same order. Namely the order of converting the map into a list.
This law holds for all instances of FinMap
we currently have, and I think without weird non-constructive axioms (that allow one to define non-parametric functions) it is impossible to define a FinMap
instance that does not satisfy this law.
/cc @johannes @ivanbakel
Merge request reports
Activity
1317 1327 Proof. rewrite elem_of_map_to_set. naive_solver. Qed. 1318 1328 1319 1329 (** ** The fold operation *) 1320 Lemma map_fold_foldr {A B} (R : relation B) `{!PreOrder R} (l : list (K * A)) It was a rather obscure lemma and seemed only useful to prove the insert lemmas. (Perhaps it should have been
Local
to signal that...)The new lemma with an equality and without the commutativity requirement seems to be much more useful on its own.
Do we have any uses of the old lemma in the reverse dependencies?
Edited by Robbert Krebbers
mentioned in merge request !566 (merged)
Closing in favor of !566 (merged).