Commit 397250e0 authored by Robbert Krebbers's avatar Robbert Krebbers

Improve and document split_and tactics.

parent 1fb156c3
...@@ -476,7 +476,7 @@ Section discrete. ...@@ -476,7 +476,7 @@ Section discrete.
Qed. Qed.
Definition discrete_extend_mixin : CMRAExtendMixin A. Definition discrete_extend_mixin : CMRAExtendMixin A.
Proof. Proof.
intros n x y1 y2 ??; exists (y1,y2); split_ands; auto. intros n x y1 y2 ??; exists (y1,y2); split_and?; auto.
apply (timeless _), dist_le with n; auto with lia. apply (timeless _), dist_le with n; auto with lia.
Qed. Qed.
Definition discreteRA : cmraT := Definition discreteRA : cmraT :=
......
...@@ -104,13 +104,13 @@ Definition validity_ra : RA (discreteC T). ...@@ -104,13 +104,13 @@ Definition validity_ra : RA (discreteC T).
Proof. Proof.
split. split.
- intros ??? [? Heq]; split; simpl; [|by intros (?&?&?); rewrite Heq]. - intros ??? [? Heq]; split; simpl; [|by intros (?&?&?); rewrite Heq].
split; intros (?&?&?); split_ands'; split; intros (?&?&?); split_and!;
first [rewrite ?Heq; tauto|rewrite -?Heq; tauto|tauto]. first [rewrite ?Heq; tauto|rewrite -?Heq; tauto|tauto].
- by intros ?? [? Heq]; split; [done|]; simpl; intros ?; rewrite Heq. - by intros ?? [? Heq]; split; [done|]; simpl; intros ?; rewrite Heq.
- intros ?? [??]; naive_solver. - intros ?? [??]; naive_solver.
- intros x1 x2 [? Hx] y1 y2 [? Hy]; - intros x1 x2 [? Hx] y1 y2 [? Hy];
split; simpl; [|by intros (?&?&?); rewrite Hx // Hy]. split; simpl; [|by intros (?&?&?); rewrite Hx // Hy].
split; intros (?&?&z&?&?); split_ands'; try tauto. split; intros (?&?&z&?&?); split_and!; try tauto.
+ exists z. by rewrite -Hy // -Hx. + exists z. by rewrite -Hy // -Hx.
+ exists z. by rewrite Hx ?Hy; tauto. + exists z. by rewrite Hx ?Hy; tauto.
- intros [x px ?] [y py ?] [z pz ?]; split; simpl; - intros [x px ?] [y py ?] [z pz ?]; split; simpl;
...@@ -135,7 +135,7 @@ Lemma validity_update (x y : validityRA) : ...@@ -135,7 +135,7 @@ Lemma validity_update (x y : validityRA) :
( z, x z validity_car x z y validity_car y z) x ~~> y. ( z, x z validity_car x z y validity_car y z) x ~~> y.
Proof. Proof.
intros Hxy. apply discrete_update. intros Hxy. apply discrete_update.
intros z (?&?&?); split_ands'; try eapply Hxy; eauto. intros z (?&?&?); split_and!; try eapply Hxy; eauto.
Qed. Qed.
Lemma to_validity_valid (x : A) : Lemma to_validity_valid (x : A) :
......
...@@ -156,7 +156,7 @@ Section iprod_cmra. ...@@ -156,7 +156,7 @@ Section iprod_cmra.
intros n f f1 f2 Hf Hf12. intros n f f1 f2 Hf Hf12.
set (g x := cmra_extend_op n (f x) (f1 x) (f2 x) (Hf x) (Hf12 x)). set (g x := cmra_extend_op n (f x) (f1 x) (f2 x) (Hf x) (Hf12 x)).
exists ((λ x, (proj1_sig (g x)).1), (λ x, (proj1_sig (g x)).2)). exists ((λ x, (proj1_sig (g x)).1), (λ x, (proj1_sig (g x)).2)).
split_ands; intros x; apply (proj2_sig (g x)). split_and?; intros x; apply (proj2_sig (g x)).
Qed. Qed.
Canonical Structure iprodRA : cmraT := Canonical Structure iprodRA : cmraT :=
CMRAT iprod_cofe_mixin iprod_cmra_mixin iprod_cmra_extend_mixin. CMRAT iprod_cofe_mixin iprod_cmra_mixin iprod_cmra_extend_mixin.
......
...@@ -75,7 +75,7 @@ Proof. ...@@ -75,7 +75,7 @@ Proof.
- intros [mz Hmz]. - intros [mz Hmz].
destruct mx as [x|]; [right|by left]. destruct mx as [x|]; [right|by left].
destruct my as [y|]; [exists x, y|destruct mz; inversion_clear Hmz]. destruct my as [y|]; [exists x, y|destruct mz; inversion_clear Hmz].
destruct mz as [z|]; inversion_clear Hmz; split_ands; auto; destruct mz as [z|]; inversion_clear Hmz; split_and?; auto;
cofe_subst; eauto using cmra_includedN_l. cofe_subst; eauto using cmra_includedN_l.
- intros [->|(x&y&->&->&z&Hz)]; try (by exists my; destruct my; constructor). - intros [->|(x&y&->&->&z&Hz)]; try (by exists my; destruct my; constructor).
by exists (Some z); constructor. by exists (Some z); constructor.
......
...@@ -101,7 +101,7 @@ Lemma step_closed s1 s2 T1 T2 S Tf : ...@@ -101,7 +101,7 @@ Lemma step_closed s1 s2 T1 T2 S Tf :
step (s1,T1) (s2,T2) closed S Tf s1 S T1 Tf step (s1,T1) (s2,T2) closed S Tf s1 S T1 Tf
s2 S T2 Tf tok s2 T2 . s2 S T2 Tf tok s2 T2 .
Proof. Proof.
inversion_clear 1 as [???? HR Hs1 Hs2]; intros [?? Hstep]??; split_ands; auto. inversion_clear 1 as [???? HR Hs1 Hs2]; intros [?? Hstep]??; split_and?; auto.
- eapply Hstep with s1, Frame_step with T1 T2; auto with sts. - eapply Hstep with s1, Frame_step with T1 T2; auto with sts.
- set_solver -Hstep Hs1 Hs2. - set_solver -Hstep Hs1 Hs2.
Qed. Qed.
...@@ -240,7 +240,7 @@ Proof. ...@@ -240,7 +240,7 @@ Proof.
+ rewrite (up_closed (up _ _)); auto using closed_up with sts. + rewrite (up_closed (up _ _)); auto using closed_up with sts.
+ rewrite (up_closed (up_set _ _)); + rewrite (up_closed (up_set _ _));
eauto using closed_up_set, closed_ne with sts. eauto using closed_up_set, closed_ne with sts.
- intros x y ?? (z&Hy&?&Hxz); exists (unit (x y)); split_ands. - intros x y ?? (z&Hy&?&Hxz); exists (unit (x y)); split_and?.
+ destruct Hxz;inversion_clear Hy;constructor;unfold up_set; set_solver. + destruct Hxz;inversion_clear Hy;constructor;unfold up_set; set_solver.
+ destruct Hxz; inversion_clear Hy; simpl; + destruct Hxz; inversion_clear Hy; simpl;
auto using closed_up_set_empty, closed_up_empty with sts. auto using closed_up_set_empty, closed_up_empty with sts.
...@@ -326,7 +326,7 @@ Lemma sts_op_auth_frag s S T : ...@@ -326,7 +326,7 @@ Lemma sts_op_auth_frag s S T :
Proof. Proof.
intros; split; [split|constructor; set_solver]; simpl. intros; split; [split|constructor; set_solver]; simpl.
- intros (?&?&?); by apply closed_disjoint' with S. - intros (?&?&?); by apply closed_disjoint' with S.
- intros; split_ands. set_solver+. done. constructor; set_solver. - intros; split_and?. set_solver+. done. constructor; set_solver.
Qed. Qed.
Lemma sts_op_auth_frag_up s T : Lemma sts_op_auth_frag_up s T :
tok s T sts_auth s sts_frag_up s T sts_auth s T. tok s T sts_auth s sts_frag_up s T sts_auth s T.
...@@ -381,7 +381,7 @@ when we have RAs back *) ...@@ -381,7 +381,7 @@ when we have RAs back *)
move:(EQ' Hcl2)=>{EQ'} EQ. inversion_clear EQ as [|? ? ? ? HT HS]. move:(EQ' Hcl2)=>{EQ'} EQ. inversion_clear EQ as [|? ? ? ? HT HS].
destruct Hv as [Hv _]. move:(Hv Hcl2)=>{Hv} [/= Hcl1 [Hclf Hdisj]]. destruct Hv as [Hv _]. move:(Hv Hcl2)=>{Hv} [/= Hcl1 [Hclf Hdisj]].
apply Hvf in Hclf. simpl in Hclf. clear Hvf. apply Hvf in Hclf. simpl in Hclf. clear Hvf.
inversion_clear Hdisj. split; last (exists Tf; split_ands); [done..|]. inversion_clear Hdisj. split; last (exists Tf; split_and?); [done..|].
apply (anti_symm ()). apply (anti_symm ()).
+ move=>s HS2. apply elem_of_intersection. split; first by apply HS. + move=>s HS2. apply elem_of_intersection. split; first by apply HS.
by apply subseteq_up_set. by apply subseteq_up_set.
...@@ -392,7 +392,7 @@ when we have RAs back *) ...@@ -392,7 +392,7 @@ when we have RAs back *)
- intros (Hcl1 & Tf & Htk & Hf & Hs). - intros (Hcl1 & Tf & Htk & Hf & Hs).
exists (sts_frag (up_set S2 Tf) Tf). exists (sts_frag (up_set S2 Tf) Tf).
split; first split; simpl;[|done|]. split; first split; simpl;[|done|].
+ intros _. split_ands; first done. + intros _. split_and?; first done.
* apply closed_up_set; last by eapply closed_ne. * apply closed_up_set; last by eapply closed_ne.
move=>s Hs2. move:(closed_disjoint _ _ Hcl2 _ Hs2). move=>s Hs2. move:(closed_disjoint _ _ Hcl2 _ Hs2).
set_solver +Htk. set_solver +Htk.
...@@ -404,7 +404,7 @@ Lemma sts_frag_included' S1 S2 T : ...@@ -404,7 +404,7 @@ Lemma sts_frag_included' S1 S2 T :
closed S2 T closed S1 T S2 S1 up_set S2 closed S2 T closed S1 T S2 S1 up_set S2
sts_frag S1 T sts_frag S2 T. sts_frag S1 T sts_frag S2 T.
Proof. Proof.
intros. apply sts_frag_included; split_ands; auto. intros. apply sts_frag_included; split_and?; auto.
exists ; split_ands; done || set_solver+. exists ; split_and?; done || set_solver+.
Qed. Qed.
End stsRA. End stsRA.
...@@ -143,7 +143,7 @@ Next Obligation. ...@@ -143,7 +143,7 @@ Next Obligation.
assert ( x2', y {n2} x1 x2' x2 x2') as (x2'&Hy&?). assert ( x2', y {n2} x1 x2' x2 x2') as (x2'&Hy&?).
{ destruct Hxy as [z Hy]; exists (x2 z); split; eauto using cmra_included_l. { destruct Hxy as [z Hy]; exists (x2 z); split; eauto using cmra_included_l.
apply dist_le with n1; auto. by rewrite (assoc op) -Hx Hy. } apply dist_le with n1; auto. by rewrite (assoc op) -Hx Hy. }
clear Hxy; cofe_subst y; exists x1, x2'; split_ands; [done| |]. clear Hxy; cofe_subst y; exists x1, x2'; split_and?; [done| |].
- apply uPred_weaken with n1 x1; eauto using cmra_validN_op_l. - apply uPred_weaken with n1 x1; eauto using cmra_validN_op_l.
- apply uPred_weaken with n1 x2; eauto using cmra_validN_op_r. - apply uPred_weaken with n1 x2; eauto using cmra_validN_op_r.
Qed. Qed.
...@@ -273,7 +273,7 @@ Global Instance impl_proper : ...@@ -273,7 +273,7 @@ Global Instance impl_proper :
Global Instance sep_ne n : Proper (dist n ==> dist n ==> dist n) (@uPred_sep M). Global Instance sep_ne n : Proper (dist n ==> dist n ==> dist n) (@uPred_sep M).
Proof. Proof.
intros P P' HP Q Q' HQ n' x ??; split; intros (x1&x2&?&?&?); cofe_subst x; intros P P' HP Q Q' HQ n' x ??; split; intros (x1&x2&?&?&?); cofe_subst x;
exists x1, x2; split_ands; try (apply HP || apply HQ); exists x1, x2; split_and?; try (apply HP || apply HQ);
eauto using cmra_validN_op_l, cmra_validN_op_r. eauto using cmra_validN_op_l, cmra_validN_op_r.
Qed. Qed.
Global Instance sep_proper : Global Instance sep_proper :
...@@ -564,17 +564,17 @@ Qed. ...@@ -564,17 +564,17 @@ Qed.
Global Instance sep_assoc : Assoc () (@uPred_sep M). Global Instance sep_assoc : Assoc () (@uPred_sep M).
Proof. Proof.
intros P Q R n x ?; split. intros P Q R n x ?; split.
- intros (x1&x2&Hx&?&y1&y2&Hy&?&?); exists (x1 y1), y2; split_ands; auto. - intros (x1&x2&Hx&?&y1&y2&Hy&?&?); exists (x1 y1), y2; split_and?; auto.
+ by rewrite -(assoc op) -Hy -Hx. + by rewrite -(assoc op) -Hy -Hx.
+ by exists x1, y1. + by exists x1, y1.
- intros (x1&x2&Hx&(y1&y2&Hy&?&?)&?); exists y1, (y2 x2); split_ands; auto. - intros (x1&x2&Hx&(y1&y2&Hy&?&?)&?); exists y1, (y2 x2); split_and?; auto.
+ by rewrite (assoc op) -Hy -Hx. + by rewrite (assoc op) -Hy -Hx.
+ by exists y2, x2. + by exists y2, x2.
Qed. Qed.
Lemma wand_intro_r P Q R : (P Q) R P (Q - R). Lemma wand_intro_r P Q R : (P Q) R P (Q - R).
Proof. Proof.
intros HPQR n x ?? n' x' ???; apply HPQR; auto. intros HPQR n x ?? n' x' ???; apply HPQR; auto.
exists x, x'; split_ands; auto. exists x, x'; split_and?; auto.
eapply uPred_weaken with n x; eauto using cmra_validN_op_l. eapply uPred_weaken with n x; eauto using cmra_validN_op_l.
Qed. Qed.
Lemma wand_elim_l P Q : ((P - Q) P) Q. Lemma wand_elim_l P Q : ((P - Q) P) Q.
......
...@@ -267,7 +267,7 @@ Section spec. ...@@ -267,7 +267,7 @@ Section spec.
( l P Q, (P - Q) (recv l P - recv l Q)). ( l P Q, (P - Q) (recv l P - recv l Q)).
Proof. Proof.
intros HN. exists (λ l, CofeMor (recv N heapN l)). exists (λ l, CofeMor (send N heapN l)). intros HN. exists (λ l, CofeMor (recv N heapN l)). exists (λ l, CofeMor (send N heapN l)).
split_ands; cbn. split_and?; cbn.
- intros. apply: always_intro. apply impl_intro_l. rewrite -newchan_spec. - intros. apply: always_intro. apply impl_intro_l. rewrite -newchan_spec.
rewrite comm always_and_sep_r. apply sep_mono_r. apply forall_intro=>l. rewrite comm always_and_sep_r. apply sep_mono_r. apply forall_intro=>l.
apply wand_intro_l. rewrite right_id -(exist_intro l) const_equiv // left_id. apply wand_intro_l. rewrite right_id -(exist_intro l) const_equiv // left_id.
......
...@@ -476,7 +476,7 @@ Lemma insert_subset_inv {A} (m1 m2 : M A) i x : ...@@ -476,7 +476,7 @@ Lemma insert_subset_inv {A} (m1 m2 : M A) i x :
m1 !! i = None <[i:=x]> m1 m2 m1 !! i = None <[i:=x]> m1 m2
m2', m2 = <[i:=x]>m2' m1 m2' m2' !! i = None. m2', m2 = <[i:=x]>m2' m1 m2' m2' !! i = None.
Proof. Proof.
intros Hi Hm1m2. exists (delete i m2). split_ands. intros Hi Hm1m2. exists (delete i m2). split_and?.
- rewrite insert_delete. done. eapply lookup_weaken, strict_include; eauto. - rewrite insert_delete. done. eapply lookup_weaken, strict_include; eauto.
by rewrite lookup_insert. by rewrite lookup_insert.
- eauto using insert_delete_subset. - eauto using insert_delete_subset.
......
...@@ -220,7 +220,7 @@ Proof. done. Qed. ...@@ -220,7 +220,7 @@ Proof. done. Qed.
Program Instance sum_finite `{Finite A, Finite B} : Finite (A + B)%type := Program Instance sum_finite `{Finite A, Finite B} : Finite (A + B)%type :=
{| enum := (inl <$> enum A) ++ (inr <$> enum B) |}. {| enum := (inl <$> enum A) ++ (inr <$> enum B) |}.
Next Obligation. Next Obligation.
intros. apply NoDup_app; split_ands. intros. apply NoDup_app; split_and?.
- apply (NoDup_fmap_2 _). by apply NoDup_enum. - apply (NoDup_fmap_2 _). by apply NoDup_enum.
- intro. rewrite !elem_of_list_fmap. intros (?&?&?) (?&?&?); congruence. - intro. rewrite !elem_of_list_fmap. intros (?&?&?) (?&?&?); congruence.
- apply (NoDup_fmap_2 _). by apply NoDup_enum. - apply (NoDup_fmap_2 _). by apply NoDup_enum.
...@@ -237,7 +237,7 @@ Program Instance prod_finite `{Finite A, Finite B} : Finite (A * B)%type := ...@@ -237,7 +237,7 @@ Program Instance prod_finite `{Finite A, Finite B} : Finite (A * B)%type :=
Next Obligation. Next Obligation.
intros ??????. induction (NoDup_enum A) as [|x xs Hx Hxs IH]; simpl. intros ??????. induction (NoDup_enum A) as [|x xs Hx Hxs IH]; simpl.
{ constructor. } { constructor. }
apply NoDup_app; split_ands. apply NoDup_app; split_and?.
- by apply (NoDup_fmap_2 _), NoDup_enum. - by apply (NoDup_fmap_2 _), NoDup_enum.
- intros [? y]. rewrite elem_of_list_fmap. intros (?&?&?); simplify_eq. - intros [? y]. rewrite elem_of_list_fmap. intros (?&?&?); simplify_eq.
clear IH. induction Hxs as [|x' xs ?? IH]; simpl. clear IH. induction Hxs as [|x' xs ?? IH]; simpl.
...@@ -271,7 +271,7 @@ Next Obligation. ...@@ -271,7 +271,7 @@ Next Obligation.
intros ????. induction n as [|n IH]; simpl; [apply NoDup_singleton |]. intros ????. induction n as [|n IH]; simpl; [apply NoDup_singleton |].
revert IH. generalize (list_enum (enum A) n). intros l Hl. revert IH. generalize (list_enum (enum A) n). intros l Hl.
induction (NoDup_enum A) as [|x xs Hx Hxs IH]; simpl; auto; [constructor |]. induction (NoDup_enum A) as [|x xs Hx Hxs IH]; simpl; auto; [constructor |].
apply NoDup_app; split_ands. apply NoDup_app; split_and?.
- by apply (NoDup_fmap_2 _). - by apply (NoDup_fmap_2 _).
- intros [k1 Hk1]. clear Hxs IH. rewrite elem_of_list_fmap. - intros [k1 Hk1]. clear Hxs IH. rewrite elem_of_list_fmap.
intros ([k2 Hk2]&?&?) Hxk2; simplify_eq/=. destruct Hx. revert Hxk2. intros ([k2 Hk2]&?&?) Hxk2; simplify_eq/=. destruct Hx. revert Hxk2.
......
...@@ -85,7 +85,7 @@ Proof. ...@@ -85,7 +85,7 @@ Proof.
rewrite elem_of_list_intersection in Hx; naive_solver. } rewrite elem_of_list_intersection in Hx; naive_solver. }
intros [(l&?&?) (k&?&?)]. assert (x list_intersection l k) intros [(l&?&?) (k&?&?)]. assert (x list_intersection l k)
by (by rewrite elem_of_list_intersection). by (by rewrite elem_of_list_intersection).
exists (list_intersection l k); split; [exists l, k|]; split_ands; auto. exists (list_intersection l k); split; [exists l, k|]; split_and?; auto.
by rewrite option_guard_True by eauto using elem_of_not_nil. by rewrite option_guard_True by eauto using elem_of_not_nil.
- unfold elem_of, hashset_elem_of, intersection, hashset_intersection. - unfold elem_of, hashset_elem_of, intersection, hashset_intersection.
intros [m1 ?] [m2 ?] x; simpl. intros [m1 ?] [m2 ?] x; simpl.
...@@ -95,7 +95,7 @@ Proof. ...@@ -95,7 +95,7 @@ Proof.
intros [(l&?&?) Hm2]; destruct (m2 !! hash x) as [k|] eqn:?; eauto. intros [(l&?&?) Hm2]; destruct (m2 !! hash x) as [k|] eqn:?; eauto.
destruct (decide (x k)); [destruct Hm2; eauto|]. destruct (decide (x k)); [destruct Hm2; eauto|].
assert (x list_difference l k) by (by rewrite elem_of_list_difference). assert (x list_difference l k) by (by rewrite elem_of_list_difference).
exists (list_difference l k); split; [right; exists l,k|]; split_ands; auto. exists (list_difference l k); split; [right; exists l,k|]; split_and?; auto.
by rewrite option_guard_True by eauto using elem_of_not_nil. by rewrite option_guard_True by eauto using elem_of_not_nil.
- unfold elem_of at 2, hashset_elem_of, elements, hashset_elems. - unfold elem_of at 2, hashset_elem_of, elements, hashset_elems.
intros [m Hm] x; simpl. setoid_rewrite elem_of_list_bind. split. intros [m Hm] x; simpl. setoid_rewrite elem_of_list_bind. split.
...@@ -107,7 +107,7 @@ Proof. ...@@ -107,7 +107,7 @@ Proof.
rewrite map_Forall_to_list in Hm. generalize (NoDup_fst_map_to_list m). rewrite map_Forall_to_list in Hm. generalize (NoDup_fst_map_to_list m).
induction Hm as [|[n l] m' [??]]; induction Hm as [|[n l] m' [??]];
csimpl; inversion_clear 1 as [|?? Hn]; [constructor|]. csimpl; inversion_clear 1 as [|?? Hn]; [constructor|].
apply NoDup_app; split_ands; eauto. apply NoDup_app; split_and?; eauto.
setoid_rewrite elem_of_list_bind; intros x ? ([n' l']&?&?); simpl in *. setoid_rewrite elem_of_list_bind; intros x ? ([n' l']&?&?); simpl in *.
assert (hash x = n hash x = n') as [??]; subst. assert (hash x = n hash x = n') as [??]; subst.
{ split; [eapply (Forall_forall (λ x, hash x = n) l); eauto|]. { split; [eapply (Forall_forall (λ x, hash x = n) l); eauto|].
......
...@@ -57,7 +57,7 @@ Proof. ...@@ -57,7 +57,7 @@ Proof.
{ intros -> Hlen; edestruct help; rewrite Hlen; simpl; lia. } { intros -> Hlen; edestruct help; rewrite Hlen; simpl; lia. }
{ intros <- Hlen; edestruct help; rewrite <-Hlen; simpl; lia. } { intros <- Hlen; edestruct help; rewrite <-Hlen; simpl; lia. }
intros Hs Hlen; apply IH in Hs; destruct Hs; intros Hs Hlen; apply IH in Hs; destruct Hs;
simplify_eq/=; split_ands'; auto using N.div_lt_upper_bound with lia. simplify_eq/=; split_and?; auto using N.div_lt_upper_bound with lia.
rewrite (N.div_mod x 10), (N.div_mod y 10) by done. rewrite (N.div_mod x 10), (N.div_mod y 10) by done.
auto using N.mod_lt with f_equal. auto using N.mod_lt with f_equal.
Qed. Qed.
......
...@@ -54,11 +54,20 @@ Ltac done := ...@@ -54,11 +54,20 @@ Ltac done :=
Tactic Notation "by" tactic(tac) := Tactic Notation "by" tactic(tac) :=
tac; done. tac; done.
(** Whereas the [split] tactic splits any inductive with one constructor, the (** Tactics for splitting conjunctions:
tactic [split_and] only splits a conjunction. *)
Ltac split_and := match goal with |- _ _ => split end. - [split_and] : split the goal if is syntactically of the shape [_ ∧ _]
Ltac split_ands := repeat split_and. - [split_ands?] : split the goal repeatedly (perhaps zero times) while it is
Ltac split_ands' := repeat (hnf; split_and). of the shape [_ ∧ _].
- [split_ands!] : works similarly, but at least one split should succeed. In
order to do so, it will head normalize the goal first to possibly expose a
conjunction.
Note that [split_and] differs from [split] by only splitting conjunctions. The
[split] tactic splits any inductive with one constructor. *)
Tactic Notation "split_and" := match goal with |- _ _ => split end.
Tactic Notation "split_and" "?" := repeat split_and.
Tactic Notation "split_and" "!" := hnf; split_and; split_and?.
(** The tactic [case_match] destructs an arbitrary match in the conclusion or (** The tactic [case_match] destructs an arbitrary match in the conclusion or
assumptions, and generates a corresponding equality. This tactic is best used assumptions, and generates a corresponding equality. This tactic is best used
......
...@@ -64,7 +64,7 @@ Proof. ...@@ -64,7 +64,7 @@ Proof.
- intros ? [o t t']; unfold map_to_list; simpl. - intros ? [o t t']; unfold map_to_list; simpl.
assert (NoDup ((prod_map Z.pos id <$> map_to_list t) ++ assert (NoDup ((prod_map Z.pos id <$> map_to_list t) ++
prod_map Z.neg id <$> map_to_list t')). prod_map Z.neg id <$> map_to_list t')).
{ apply NoDup_app; split_ands. { apply NoDup_app; split_and?.
- apply (NoDup_fmap_2 _), NoDup_map_to_list. - apply (NoDup_fmap_2 _), NoDup_map_to_list.
- intro. rewrite !elem_of_list_fmap. naive_solver. - intro. rewrite !elem_of_list_fmap. naive_solver.
- apply (NoDup_fmap_2 _), NoDup_map_to_list. } - apply (NoDup_fmap_2 _), NoDup_map_to_list. }
......
...@@ -74,7 +74,7 @@ Proof. ...@@ -74,7 +74,7 @@ Proof.
intros Hv ? [k ?]%rtc_nsteps. intros Hv ? [k ?]%rtc_nsteps.
eapply ht_adequacy_steps with (r1 := (Res (Excl σ1) (Some m))); eauto; [|]. eapply ht_adequacy_steps with (r1 := (Res (Excl σ1) (Some m))); eauto; [|].
{ by rewrite Nat.add_comm; apply wsat_init, cmra_valid_validN. } { by rewrite Nat.add_comm; apply wsat_init, cmra_valid_validN. }
exists (Res (Excl σ1) ), (Res (Some m)); split_ands. exists (Res (Excl σ1) ), (Res (Some m)); split_and?.
- by rewrite Res_op ?left_id ?right_id. - by rewrite Res_op ?left_id ?right_id.
- by rewrite /uPred_holds /=. - by rewrite /uPred_holds /=.
- by apply ownG_spec. - by apply ownG_spec.
......
...@@ -38,7 +38,7 @@ Proof. ...@@ -38,7 +38,7 @@ Proof.
as (r'&(r1'&r2'&?&?&?)&?); auto; cofe_subst r'. as (r'&(r1'&r2'&?&?&?)&?); auto; cofe_subst r'.
{ split. destruct k; try eapply Hstep; eauto. apply ownP_spec; auto. } { split. destruct k; try eapply Hstep; eauto. apply ownP_spec; auto. }
{ rewrite (comm _ r2) -assoc; eauto using wsat_le. } { rewrite (comm _ r2) -assoc; eauto using wsat_le. }
by exists r1', r2'; split_ands; [| |by intros ? ->]. by exists r1', r2'; split_and?; [| |by intros ? ->].
Qed. Qed.
Lemma wp_lift_pure_step E (φ : expr Λ option (expr Λ) Prop) Φ e1 : Lemma wp_lift_pure_step E (φ : expr Λ option (expr Λ) Prop) Φ e1 :
...@@ -51,7 +51,7 @@ Proof. ...@@ -51,7 +51,7 @@ Proof.
intros rf k Ef σ1 ???; split; [done|]. destruct n as [|n]; first lia. intros rf k Ef σ1 ???; split; [done|]. destruct n as [|n]; first lia.
intros e2 σ2 ef ?; destruct (Hstep σ1 e2 σ2 ef); auto; subst. intros e2 σ2 ef ?; destruct (Hstep σ1 e2 σ2 ef); auto; subst.
destruct (Hwp e2 ef k r) as (r1&r2&Hr&?&?); auto. destruct (Hwp e2 ef k r) as (r1&r2&Hr&?&?); auto.
exists r1,r2; split_ands; [rewrite -Hr| |by intros ? ->]; eauto using wsat_le. exists r1,r2; split_and?; [rewrite -Hr| |by intros ? ->]; eauto using wsat_le.
Qed. Qed.
(** Derived lifting lemmas. *) (** Derived lifting lemmas. *)
......
...@@ -39,7 +39,7 @@ Section ndisjoint. ...@@ -39,7 +39,7 @@ Section ndisjoint.
Lemma ndot_preserve_disjoint_l N1 N2 x : N1 N2 ndot N1 x N2. Lemma ndot_preserve_disjoint_l N1 N2 x : N1 N2 ndot N1 x N2.
Proof. Proof.
intros (N1' & N2' & Hpr1 & Hpr2 & Hl & Hne). exists N1', N2'. intros (N1' & N2' & Hpr1 & Hpr2 & Hl & Hne). exists N1', N2'.
split_ands; try done; []. by apply suffix_of_cons_r. split_and?; try done; []. by apply suffix_of_cons_r.
Qed. Qed.
Lemma ndot_preserve_disjoint_r N1 N2 x : N1 N2 N1 ndot N2 x . Lemma ndot_preserve_disjoint_r N1 N2 x : N1 N2 N1 ndot N2 x .
......
...@@ -79,7 +79,7 @@ Proof. ...@@ -79,7 +79,7 @@ Proof.
- intros [(P'&Hi&HP) _]; rewrite Hi. - intros [(P'&Hi&HP) _]; rewrite Hi.
by apply Some_dist, symmetry, agree_valid_includedN, by apply Some_dist, symmetry, agree_valid_includedN,
(cmra_included_includedN _ P'),HP; apply map_lookup_validN with (wld r) i. (cmra_included_includedN _ P'),HP; apply map_lookup_validN with (wld r) i.
- intros ?; split_ands; try apply cmra_empty_leastN; eauto. - intros ?; split_and?; try apply cmra_empty_leastN; eauto.
Qed. Qed.
Lemma ownP_spec r n σ : {n} r (ownP σ) n r pst r {n} Excl σ. Lemma ownP_spec r n σ : {n} r (ownP σ) n r pst r {n} Excl σ.
Proof. Proof.
......
...@@ -44,7 +44,7 @@ Global Instance pvs_ne E1 E2 n : Proper (dist n ==> dist n) (@pvs Λ Σ E1 E2). ...@@ -44,7 +44,7 @@ Global Instance pvs_ne E1 E2 n : Proper (dist n ==> dist n) (@pvs Λ Σ E1 E2).
Proof. Proof.
intros P Q HPQ r1 n' ??; simpl; split; intros HP rf k Ef σ ???; intros P Q HPQ r1 n' ??; simpl; split; intros HP rf k Ef σ ???;
destruct (HP rf k Ef σ) as (r2&?&?); auto; destruct (HP rf k Ef σ) as (r2&?&?); auto;
exists r2; split_ands; auto; apply HPQ; eauto. exists r2; split_and?; auto; apply HPQ; eauto.
Qed. Qed.
Global Instance pvs_proper E1 E2 : Proper (() ==> ()) (@pvs Λ Σ E1 E2). Global Instance pvs_proper E1 E2 : Proper (() ==> ()) (@pvs Λ Σ E1 E2).
Proof. apply ne_proper, _. Qed. Proof. apply ne_proper, _. Qed.
...@@ -84,7 +84,7 @@ Proof. ...@@ -84,7 +84,7 @@ Proof.
destruct (HP (r2 rf) k Ef σ) as (r'&?&?); eauto. destruct (HP (r2 rf) k Ef σ) as (r'&?&?); eauto.
{ by rewrite assoc -(dist_le _ _ _ _ Hr); last lia. } { by rewrite assoc -(dist_le _ _ _ _ Hr); last lia. }
exists (r' r2); split; last by rewrite -assoc. exists (r' r2); split; last by rewrite -assoc.
exists r', r2; split_ands; auto; apply uPred_weaken with n r2; auto. exists r', r2; split_and?; auto; apply uPred_weaken with n r2; auto.
Qed. Qed.
Lemma pvs_openI i P : ownI i P (|={{[i]},}=> P). Lemma pvs_openI i P : ownI i P (|={{[i]},}=> P).
Proof. Proof.
......
...@@ -84,14 +84,14 @@ Lemma res_included (r1 r2 : res Λ Σ A) : ...@@ -84,14 +84,14 @@ Lemma res_included (r1 r2 : res Λ Σ A) :
r1 r2 wld r1 wld r2 pst r1 pst r2 gst r1 gst r2. r1 r2 wld r1 wld r2 pst r1 pst r2 gst r1 gst r2.
Proof. Proof.
split; [|by intros ([w ?]&[σ ?]&[m ?]); exists (Res w σ m)]. split; [|by intros ([w ?]&[σ ?]&[m ?]); exists (Res w σ m)].
intros [r Hr]; split_ands; intros [r Hr]; split_and?;
[exists (wld r)|exists (pst r)|exists (gst r)]; apply Hr. [exists (wld r)|exists (pst r)|exists (gst r)]; apply Hr.
Qed. Qed.
Lemma