Skip to content
Snippets Groups Projects
Commit 26204e75 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Add lemma `map_cross_split`.

parent 64843223
No related branches found
No related tags found
1 merge request!274Make filter lemmas for maps and sets consistent + add cross split property for maps
Pipeline #48293 passed
...@@ -2226,6 +2226,31 @@ Proof. ...@@ -2226,6 +2226,31 @@ Proof.
destruct (m1 !! i), (m2 !! i); simpl; repeat (destruct (f _)); naive_solver. destruct (m1 !! i), (m2 !! i); simpl; repeat (destruct (f _)); naive_solver.
Qed. Qed.
Lemma map_cross_split {A} (m ma mb mc md : M A) :
ma ## mb mc ## md
ma mb = m mc md = m
mac mad mbc mbd,
mac ## mad mbc ## mbd
mac ## mbc mad ## mbd
mac mad = ma mbc mbd = mb mac mbc = mc mad mbd = md.
Proof.
intros Hab_disj Hcd_disj Hab Hcd.
exists (filter (λ kx, is_Some (mc !! kx.1)) ma),
(filter (λ kx, ¬is_Some (mc !! kx.1)) ma),
(filter (λ kx, is_Some (mc !! kx.1)) mb),
(filter (λ kx, ¬is_Some (mc !! kx.1)) mb).
split_and!; [auto using map_disjoint_filter_complement, map_disjoint_filter,
map_filter_union_complement..| |].
- rewrite <-map_filter_union, Hab, <-Hcd by done.
apply map_eq; intros k. apply option_eq; intros x.
rewrite map_filter_lookup_Some, lookup_union_Some, <-not_eq_None_Some by done.
rewrite map_disjoint_alt in Hcd_disj; naive_solver.
- rewrite <-map_filter_union, Hab, <-Hcd by done.
apply map_eq; intros k. apply option_eq; intros x.
rewrite map_filter_lookup_Some, lookup_union_Some, <-not_eq_None_Some by done.
rewrite map_disjoint_alt in Hcd_disj; naive_solver.
Qed.
(** ** Properties of the [union_list] operation *) (** ** Properties of the [union_list] operation *)
Lemma map_disjoint_union_list_l {A} (ms : list (M A)) (m : M A) : Lemma map_disjoint_union_list_l {A} (ms : list (M A)) (m : M A) :
ms ## m Forall (.## m) ms. ms ## m Forall (.## m) ms.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment