Skip to content
Snippets Groups Projects
Commit 4fe7821b authored by Ralf Jung's avatar Ralf Jung Committed by Robbert Krebbers
Browse files

add snoc lemmas to big-list ops

parent 596e8767
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,9 @@ Section list.
revert f. induction l1 as [|x l1 IH]=> f /=; first by rewrite left_id.
by rewrite IH assoc.
Qed.
Lemma big_opL_snoc f l x :
([^o list] ky l ++ [x], f k y) ([^o list] ky l, f k y) `o` f (length l) x.
Proof. rewrite big_opL_app big_opL_singleton Nat.add_0_r //. Qed.
Lemma big_opL_unit l : ([^o list] ky l, monoid_unit) (monoid_unit : M).
Proof. induction l; rewrite /= ?left_id //. Qed.
......
......@@ -91,6 +91,9 @@ Section sep_list.
([ list] ky l1 ++ l2, Φ k y)
⊣⊢ ([ list] ky l1, Φ k y) ([ list] ky l2, Φ (length l1 + k) y).
Proof. by rewrite big_opL_app. Qed.
Lemma big_sepL_snoc Φ l x :
([ list] ky l ++ [x], Φ k y) ⊣⊢ ([ list] ky l, Φ k y) Φ (length l) x.
Proof. by rewrite big_opL_snoc. Qed.
Lemma big_sepL_submseteq `{BiAffine PROP} (Φ : A PROP) l1 l2 :
l1 ⊆+ l2 ([ list] y l2, Φ y) [ list] y l1, Φ y.
......@@ -423,6 +426,24 @@ Section sep_list2.
- by rewrite -assoc IH.
Qed.
Lemma big_sepL2_snoc Φ x1 x2 l1 l2 :
([ list] ky1;y2 (l1 ++ [x1]);(l2 ++ [x2]), Φ k y1 y2) ⊣⊢
([ list] ky1;y2 l1;l2, Φ k y1 y2) Φ (length l1) x1 x2.
Proof.
apply (anti_symm ()); last first.
- apply wand_elim_l'. rewrite big_sepL2_app. apply wand_mono; last done.
rewrite big_sepL2_singleton Nat.add_0_r. done.
- rewrite big_sepL2_app_inv_l. apply exist_elim=>l2l. apply exist_elim=>l2r.
apply pure_elim_l=>Hl2.
apply (pure_elim (length [x1] = length l2r)).
{ rewrite !big_sepL2_length sep_elim_r. done. }
simpl. destruct l2r as [? l2r|]; first done.
destruct l2r as [|]; last done. intros _.
apply app_inj_tail in Hl2 as [-> ->].
apply sep_mono_r.
rewrite big_sepL2_singleton Nat.add_0_r. done.
Qed.
(** The lemmas [big_sepL2_mono], [big_sepL2_ne] and [big_sepL2_proper] are more
generic than the instances as they also give [li !! k = Some yi] in the premise. *)
Lemma big_sepL2_mono Φ Ψ l1 l2 :
......
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