Commit 20690605 authored by Robbert Krebbers's avatar Robbert Krebbers

Rename simplify_equality like tactics.

simplify_equality        => simplify_eq
simplify_equality'       => simplify_eq/=
simplify_map_equality    => simplify_map_eq
simplify_map_equality'   => simplify_map_eq/=
simplify_option_equality => simplify_option_eq
simplify_list_equality   => simplify_list_eq
f_equal'                 => f_equal/=

The /= suffixes (meaning: do simpl) are inspired by ssreflect.
parent 8f0d5ae3
......@@ -120,7 +120,7 @@ Lemma elem_to_Pset_singleton p q : e_of p (coPset_singleton_raw q) ↔ p = q.
Proof.
split; [|by intros <-; induction p; simpl; rewrite ?coPset_elem_of_node].
by revert q; induction p; intros [?|?|]; simpl;
rewrite ?coPset_elem_of_node; intros; f_equal'; auto.
rewrite ?coPset_elem_of_node; intros; f_equal/=; auto.
Qed.
Lemma elem_to_Pset_union t1 t2 p : e_of p (t1 t2) = e_of p t1 || e_of p t2.
Proof.
......@@ -226,13 +226,13 @@ Definition coPpick (X : coPset) : positive := from_option 1 (coPpick_raw (`X)).
Lemma coPpick_raw_elem_of t i : coPpick_raw t = Some i e_of i t.
Proof.
revert i; induction t as [[]|[] l ? r]; intros i ?; simplify_equality'; auto.
destruct (coPpick_raw l); simplify_option_equality; auto.
revert i; induction t as [[]|[] l ? r]; intros i ?; simplify_eq/=; auto.
destruct (coPpick_raw l); simplify_option_eq; auto.
Qed.
Lemma coPpick_raw_None t : coPpick_raw t = None coPset_finite t.
Proof.
induction t as [[]|[] l ? r]; intros i; simplify_equality'; auto.
destruct (coPpick_raw l); simplify_option_equality; auto.
induction t as [[]|[] l ? r]; intros i; simplify_eq/=; auto.
destruct (coPpick_raw l); simplify_option_eq; auto.
Qed.
Lemma coPpick_elem_of X : ¬set_finite X coPpick X X.
Proof.
......
......@@ -359,9 +359,9 @@ Section collection_ops.
- revert x. induction Xs; simpl; intros x HXs; [eexists [], x; intuition|].
rewrite elem_of_intersection_with in HXs; destruct HXs as (x1&x2&?&?&?).
destruct (IHXs x2) as (xs & y & hy & ? & ?); trivial.
eexists (x1 :: xs), y. intuition (simplify_option_equality; auto).
eexists (x1 :: xs), y. intuition (simplify_option_eq; auto).
- intros (xs & y & Hxs & ? & Hx). revert x Hx.
induction Hxs; intros; simplify_option_equality; [done |].
induction Hxs; intros; simplify_option_eq; [done |].
rewrite elem_of_intersection_with. naive_solver.
Qed.
......@@ -371,7 +371,7 @@ Section collection_ops.
( x y z, Q x P y f x y = Some z P z)
x, x intersection_with_list f Y Xs P x.
Proof.
intros HY HXs Hf. induction Xs; simplify_option_equality; [done |].
intros HY HXs Hf. induction Xs; simplify_option_eq; [done |].
intros x Hx. rewrite elem_of_intersection_with in Hx.
decompose_Forall. destruct Hx as (? & ? & ? & ? & ?). eauto.
Qed.
......@@ -490,7 +490,7 @@ Section fresh.
Global Instance fresh_list_proper:
Proper ((=) ==> () ==> (=)) (fresh_list (C:=C)).
Proof.
intros ? n ->. induction n as [|n IH]; intros ?? E; f_equal'; [by rewrite E|].
intros ? n ->. induction n as [|n IH]; intros ?? E; f_equal/=; [by rewrite E|].
apply IH. by rewrite E.
Qed.
......@@ -585,7 +585,7 @@ Section collection_monad.
Forall (λ x, y, y g x f y = x) l k mapM g l fmap f k = l.
Proof.
intros Hl. revert k. induction Hl; simpl; intros;
decompose_elem_of; f_equal'; auto.
decompose_elem_of; f_equal/=; auto.
Qed.
Lemma elem_of_mapM_Forall {A B} (f : A M B) (P : B Prop) l k :
l mapM f k Forall (λ x, y, y f x P y) k Forall P l.
......
......@@ -149,18 +149,18 @@ Fixpoint prod_decode_snd (p : positive) : option positive :=
Lemma prod_decode_encode_fst p q : prod_decode_fst (prod_encode p q) = Some p.
Proof.
assert ( p, prod_decode_fst (prod_encode_fst p) = Some p).
{ intros p'. by induction p'; simplify_option_equality. }
{ intros p'. by induction p'; simplify_option_eq. }
assert ( p, prod_decode_fst (prod_encode_snd p) = None).
{ intros p'. by induction p'; simplify_option_equality. }
revert q. by induction p; intros [?|?|]; simplify_option_equality.
{ intros p'. by induction p'; simplify_option_eq. }
revert q. by induction p; intros [?|?|]; simplify_option_eq.
Qed.
Lemma prod_decode_encode_snd p q : prod_decode_snd (prod_encode p q) = Some q.
Proof.
assert ( p, prod_decode_snd (prod_encode_snd p) = Some p).
{ intros p'. by induction p'; simplify_option_equality. }
{ intros p'. by induction p'; simplify_option_eq. }
assert ( p, prod_decode_snd (prod_encode_fst p) = None).
{ intros p'. by induction p'; simplify_option_equality. }
revert q. by induction p; intros [?|?|]; simplify_option_equality.
{ intros p'. by induction p'; simplify_option_eq. }
revert q. by induction p; intros [?|?|]; simplify_option_eq.
Qed.
Program Instance prod_countable `{Countable A} `{Countable B} :
Countable (A * B)%type := {|
......@@ -191,7 +191,7 @@ Fixpoint list_decode `{Countable A} (acc : list A)
| p~1 => x decode_nat n; list_decode (x :: acc) O p
end.
Lemma x0_iter_x1 n acc : Nat.iter n (~0) acc~1 = acc ++ Nat.iter n (~0) 3.
Proof. by induction n; f_equal'. Qed.
Proof. by induction n; f_equal/=. Qed.
Lemma list_encode_app' `{Countable A} (l1 l2 : list A) acc :
list_encode acc (l1 ++ l2) = list_encode acc l1 ++ list_encode 1 l2.
Proof.
......@@ -226,7 +226,7 @@ Lemma list_encode_suffix_eq `{Countable A} q1 q2 (l1 l2 : list A) :
length l1 = length l2 q1 ++ encode l1 = q2 ++ encode l2 l1 = l2.
Proof.
revert q1 q2 l2; induction l1 as [|a1 l1 IH];
intros q1 q2 [|a2 l2] ?; simplify_equality'; auto.
intros q1 q2 [|a2 l2] ?; simplify_eq/=; auto.
rewrite !list_encode_cons, !(assoc _); intros Hl.
assert (l1 = l2) as <- by eauto; clear IH; f_equal.
apply (inj encode_nat); apply (inj (++ encode l1)) in Hl; revert Hl; clear.
......
......@@ -87,7 +87,7 @@ Tactic Notation "simplify_error_equality" :=
| H : (gets _ = _) _ = _ |- _ => rewrite error_left_gets in H
| H : (modify _ = _) _ = _ |- _ => rewrite error_left_modify in H
| H : error_guard _ _ _ _ = _ |- _ => apply error_guard_ret in H; destruct H
| _ => progress simplify_equality'
| _ => progress simplify_eq/=
| H : error_of_option _ _ _ = _ |- _ =>
apply error_of_option_ret in H; destruct H
| H : mbind (M:=error _ _) _ _ _ = _ |- _ =>
......@@ -117,7 +117,7 @@ Tactic Notation "error_proceed" :=
| H : ((_ = _) = _) _ = _ |- _ => rewrite error_assoc in H
| H : (error_guard _ _ _) _ = _ |- _ =>
let H' := fresh in apply error_guard_ret in H; destruct H as [H' H]
| _ => progress simplify_equality'
| _ => progress simplify_eq/=
| H : maybe _ ?x = Some _ |- _ => is_var x; destruct x
| H : maybe2 _ ?x = Some _ |- _ => is_var x; destruct x
| H : maybe3 _ ?x = Some _ |- _ => is_var x; destruct x
......
......@@ -67,7 +67,7 @@ Proof. unfold size, collection_size. simpl. by rewrite elements_singleton. Qed.
Lemma size_singleton_inv X x y : size X = 1 x X y X x = y.
Proof.
unfold size, collection_size. simpl. rewrite <-!elem_of_elements.
generalize (elements X). intros [|? l]; intro; simplify_equality'.
generalize (elements X). intros [|? l]; intro; simplify_eq/=.
rewrite (nil_length_inv l), !elem_of_list_singleton by done; congruence.
Qed.
Lemma collection_choose_or_empty X : ( x, x X) X .
......
......@@ -32,7 +32,7 @@ Proof.
intros [Hss1 Hss2]; split; [by apply subseteq_dom |].
contradict Hss2. rewrite map_subseteq_spec. intros i x Hi.
specialize (Hss2 i). rewrite !elem_of_dom in Hss2.
destruct Hss2; eauto. by simplify_map_equality.
destruct Hss2; eauto. by simplify_map_eq.
Qed.
Lemma dom_empty {A} : dom D (@empty (M A) _) .
Proof.
......@@ -47,7 +47,7 @@ Qed.
Lemma dom_alter {A} f (m : M A) i : dom D (alter f i m) dom D m.
Proof.
apply elem_of_equiv; intros j; rewrite !elem_of_dom; unfold is_Some.
destruct (decide (i = j)); simplify_map_equality'; eauto.
destruct (decide (i = j)); simplify_map_eq/=; eauto.
destruct (m !! j); naive_solver.
Qed.
Lemma dom_insert {A} (m : M A) i x : dom D (<[i:=x]>m) {[ i ]} dom D m.
......
......@@ -198,7 +198,7 @@ Global Instance: ∀ {A} (R : relation A), PreOrder R → PreOrder (map_included
Proof.
split; [intros m i; by destruct (m !! i); simpl|].
intros m1 m2 m3 Hm12 Hm23 i; specialize (Hm12 i); specialize (Hm23 i).
destruct (m1 !! i), (m2 !! i), (m3 !! i); simplify_equality';
destruct (m1 !! i), (m2 !! i), (m3 !! i); simplify_eq/=;
done || etransitivity; eauto.
Qed.
Global Instance: PartialOrder (() : relation (M A)).
......@@ -288,7 +288,7 @@ Qed.
(** ** Properties of the [alter] operation *)
Lemma alter_ext {A} (f g : A A) (m : M A) i :
( x, m !! i = Some x f x = g x) alter f i m = alter g i m.
Proof. intro. apply partial_alter_ext. intros [x|] ?; f_equal'; auto. Qed.
Proof. intro. apply partial_alter_ext. intros [x|] ?; f_equal/=; auto. Qed.
Lemma lookup_alter {A} (f : A A) m i : alter f i m !! i = f <$> m !! i.
Proof. unfold alter. apply lookup_partial_alter. Qed.
Lemma lookup_alter_ne {A} (f : A A) m i j : i j alter f i m !! j = m !! j.
......@@ -307,7 +307,7 @@ Lemma lookup_alter_Some {A} (f : A → A) m i j y :
(i = j x, m !! j = Some x y = f x) (i j m !! j = Some y).
Proof.
destruct (decide (i = j)) as [->|?].
- rewrite lookup_alter. naive_solver (simplify_option_equality; eauto).
- rewrite lookup_alter. naive_solver (simplify_option_eq; eauto).
- rewrite lookup_alter_ne by done. naive_solver.
Qed.
Lemma lookup_alter_None {A} (f : A A) m i j :
......@@ -320,7 +320,7 @@ Lemma alter_id {A} (f : A → A) m i :
( x, m !! i = Some x f x = x) alter f i m = m.
Proof.
intros Hi; apply map_eq; intros j; destruct (decide (i = j)) as [->|?].
{ rewrite lookup_alter; destruct (m !! j); f_equal'; auto. }
{ rewrite lookup_alter; destruct (m !! j); f_equal/=; auto. }
by rewrite lookup_alter_ne by done.
Qed.
......@@ -583,7 +583,7 @@ Lemma elem_of_map_of_list_1_help {A} (l : list (K * A)) i x :
Proof.
induction l as [|[j y] l IH]; csimpl; [by rewrite elem_of_nil|].
setoid_rewrite elem_of_cons.
intros [?|?] Hdup; simplify_equality; [by rewrite lookup_insert|].
intros [?|?] Hdup; simplify_eq; [by rewrite lookup_insert|].
destruct (decide (i = j)) as [->|].
- rewrite lookup_insert; f_equal; eauto.
- rewrite lookup_insert_ne by done; eauto.
......@@ -616,7 +616,7 @@ Lemma not_elem_of_map_of_list_2 {A} (l : list (K * A)) i :
map_of_list l !! i = None i l.*1.
Proof.
induction l as [|[j y] l IH]; csimpl; [rewrite elem_of_nil; tauto|].
rewrite elem_of_cons. destruct (decide (i = j)); simplify_equality.
rewrite elem_of_cons. destruct (decide (i = j)); simplify_eq.
- by rewrite lookup_insert.
- by rewrite lookup_insert_ne; intuition.
Qed.
......@@ -708,16 +708,16 @@ Lemma lookup_imap {A B} (f : K → A → option B) m i :
map_imap f m !! i = m !! i = f i.
Proof.
unfold map_imap; destruct (m !! i = f i) as [y|] eqn:Hi; simpl.
- destruct (m !! i) as [x|] eqn:?; simplify_equality'.
- destruct (m !! i) as [x|] eqn:?; simplify_eq/=.
apply elem_of_map_of_list_1_help.
{ apply elem_of_list_omap; exists (i,x); split;
[by apply elem_of_map_to_list|by simplify_option_equality]. }
[by apply elem_of_map_to_list|by simplify_option_eq]. }
intros y'; rewrite elem_of_list_omap; intros ([i' x']&Hi'&?).
by rewrite elem_of_map_to_list in Hi'; simplify_option_equality.
by rewrite elem_of_map_to_list in Hi'; simplify_option_eq.
- apply not_elem_of_map_of_list; rewrite elem_of_list_fmap.
intros ([i' x]&->&Hi'); simplify_equality'.
intros ([i' x]&->&Hi'); simplify_eq/=.
rewrite elem_of_list_omap in Hi'; destruct Hi' as ([j y]&Hj&?).
rewrite elem_of_map_to_list in Hj; simplify_option_equality.
rewrite elem_of_map_to_list in Hj; simplify_option_eq.
Qed.
(** ** Properties of conversion from collections *)
......@@ -729,11 +729,11 @@ Proof.
{ induction (NoDup_elements X) as [|i' l]; csimpl; [constructor|].
destruct (f i') as [x'|]; csimpl; auto; constructor; auto.
rewrite elem_of_list_fmap. setoid_rewrite elem_of_list_omap.
by intros (?&?&?&?&?); simplify_option_equality. }
by intros (?&?&?&?&?); simplify_option_eq. }
unfold map_of_collection; rewrite <-elem_of_map_of_list by done.
rewrite elem_of_list_omap. setoid_rewrite elem_of_elements; split.
- intros (?&?&?); simplify_option_equality; eauto.
- intros [??]; exists i; simplify_option_equality; eauto.
- intros (?&?&?); simplify_option_eq; eauto.
- intros [??]; exists i; simplify_option_eq; eauto.
Qed.
(** ** Induction principles *)
......@@ -936,9 +936,9 @@ Proof.
split.
- intros Hm i P'; rewrite lookup_merge by done; intros.
specialize (Hm i). destruct (m1 !! i), (m2 !! i);
simplify_equality'; auto using bool_decide_pack.
simplify_eq/=; auto using bool_decide_pack.
- intros Hm i. specialize (Hm i). rewrite lookup_merge in Hm by done.
destruct (m1 !! i), (m2 !! i); simplify_equality'; auto;
destruct (m1 !! i), (m2 !! i); simplify_eq/=; auto;
by eapply bool_decide_unpack, Hm.
Qed.
Global Instance map_relation_dec `{ x y, Decision (R x y), x, Decision (P x),
......@@ -961,7 +961,7 @@ Proof.
destruct (m1 !! i), (m2 !! i); naive_solver auto 2 using bool_decide_pack.
- unfold map_relation, option_relation.
by intros [i[(x&y&?&?&?)|[(x&?&?&?)|(y&?&?&?)]]] Hm;
specialize (Hm i); simplify_option_equality.
specialize (Hm i); simplify_option_eq.
Qed.
End Forall2.
......@@ -1081,7 +1081,7 @@ Lemma alter_union_with_l (g : A → A) m1 m2 i :
alter g i (union_with f m1 m2) = union_with f (alter g i m1) m2.
Proof.
intros. apply (partial_alter_merge_l _).
destruct (m1 !! i) eqn:?, (m2 !! i) eqn:?; f_equal'; auto.
destruct (m1 !! i) eqn:?, (m2 !! i) eqn:?; f_equal/=; auto.
Qed.
Lemma alter_union_with_r (g : A A) m1 m2 i :
( x y, m1 !! i = Some x m2 !! i = Some y g <$> f x y = f x (g y))
......@@ -1089,7 +1089,7 @@ Lemma alter_union_with_r (g : A → A) m1 m2 i :
alter g i (union_with f m1 m2) = union_with f m1 (alter g i m2).
Proof.
intros. apply (partial_alter_merge_r _).
destruct (m1 !! i) eqn:?, (m2 !! i) eqn:?; f_equal'; auto.
destruct (m1 !! i) eqn:?, (m2 !! i) eqn:?; f_equal/=; auto.
Qed.
Lemma delete_union_with m1 m2 i :
delete i (union_with f m1 m2) = union_with f (delete i m1) (delete i m2).
......@@ -1558,11 +1558,11 @@ Hint Extern 80 (<[_:=_]> _ !! _ = Some _) => apply lookup_insert : simpl_map.
(** Now we take everything together and also discharge conflicting look ups,
simplify overlapping look ups, and perform cancellations of equalities
involving unions. *)
Tactic Notation "simplify_map_equality" "by" tactic3(tac) :=
Tactic Notation "simplify_map_eq" "by" tactic3(tac) :=
decompose_map_disjoint;
repeat match goal with
| _ => progress simpl_map by tac
| _ => progress simplify_equality
| _ => progress simplify_eq/=
| _ => progress simpl_option by tac
| H : {[ _ := _ ]} !! _ = None |- _ => rewrite lookup_singleton_None in H
| H : {[ _ := _ ]} !! _ = Some _ |- _ =>
......@@ -1582,11 +1582,11 @@ Tactic Notation "simplify_map_equality" "by" tactic3(tac) :=
| H : = {[?i := ?x]} |- _ => by destruct (map_non_empty_singleton i x)
| H : ?m !! ?i = Some _, H2 : ?m !! ?j = None |- _ =>
unless (i j) by done;
assert (i j) by (by intros ?; simplify_equality)
assert (i j) by (by intros ?; simplify_eq)
end.
Tactic Notation "simplify_map_equality'" "by" tactic3(tac) :=
repeat (progress csimpl in * || simplify_map_equality by tac).
Tactic Notation "simplify_map_equality" :=
simplify_map_equality by eauto with simpl_map map_disjoint.
Tactic Notation "simplify_map_equality'" :=
simplify_map_equality' by eauto with simpl_map map_disjoint.
Tactic Notation "simplify_map_eq" "/=" "by" tactic3(tac) :=
repeat (progress csimpl in * || simplify_map_eq by tac).
Tactic Notation "simplify_map_eq" :=
simplify_map_eq by eauto with simpl_map map_disjoint.
Tactic Notation "simplify_map_eq" "/=" :=
simplify_map_eq/= by eauto with simpl_map map_disjoint.
......@@ -48,7 +48,7 @@ Lemma find_Some `{finA: Finite A} P `{∀ x, Decision (P x)} x :
find P = Some x P x.
Proof.
destruct finA as [xs Hxs HA]; unfold find, decode_nat, decode; simpl.
intros Hx. destruct (list_find _ _) as [[i y]|] eqn:Hi; simplify_equality'.
intros Hx. destruct (list_find _ _) as [[i y]|] eqn:Hi; simplify_eq/=.
rewrite !Nat2Pos.id in Hx by done.
destruct (list_find_Some P xs i y); naive_solver.
Qed.
......@@ -57,13 +57,13 @@ Lemma find_is_Some `{finA: Finite A} P `{∀ x, Decision (P x)} x :
Proof.
destruct finA as [xs Hxs HA]; unfold find, decode; simpl.
intros Hx. destruct (list_find_elem_of P xs x) as [[i y] Hi]; auto.
rewrite Hi. destruct (list_find_Some P xs i y); simplify_equality'; auto.
rewrite Hi. destruct (list_find_Some P xs i y); simplify_eq/=; auto.
exists y. by rewrite !Nat2Pos.id by done.
Qed.
Lemma card_0_inv P `{finA: Finite A} : card A = 0 A P.
Proof.
intros ? x. destruct finA as [[|??] ??]; simplify_equality.
intros ? x. destruct finA as [[|??] ??]; simplify_eq.
by destruct (not_elem_of_nil x).
Qed.
Lemma finite_inhabited A `{finA: Finite A} : 0 < card A Inhabited A.
......@@ -166,7 +166,7 @@ Section enc_finite.
Next Obligation.
apply NoDup_alt. intros i j x. rewrite !list_lookup_fmap. intros Hi Hj.
destruct (seq _ _ !! i) as [i'|] eqn:Hi',
(seq _ _ !! j) as [j'|] eqn:Hj'; simplify_equality'.
(seq _ _ !! j) as [j'|] eqn:Hj'; simplify_eq/=.
destruct (lookup_seq_inv _ _ _ _ Hi'), (lookup_seq_inv _ _ _ _ Hj'); subst.
rewrite <-(to_of_nat i), <-(to_of_nat j) by done. by f_equal.
Qed.
......@@ -239,11 +239,11 @@ Next Obligation.
{ constructor. }
apply NoDup_app; split_ands.
- by apply (NoDup_fmap_2 _), NoDup_enum.
- intros [? y]. rewrite elem_of_list_fmap. intros (?&?&?); simplify_equality.
- intros [? y]. rewrite elem_of_list_fmap. intros (?&?&?); simplify_eq.
clear IH. induction Hxs as [|x' xs ?? IH]; simpl.
{ rewrite elem_of_nil. tauto. }
rewrite elem_of_app, elem_of_list_fmap.
intros [(?&?&?)|?]; simplify_equality.
intros [(?&?&?)|?]; simplify_eq.
+ destruct Hx. by left.
+ destruct IH. by intro; destruct Hx; right. auto.
- done.
......@@ -274,15 +274,15 @@ Next Obligation.
apply NoDup_app; split_ands.
- by apply (NoDup_fmap_2 _).
- intros [k1 Hk1]. clear Hxs IH. rewrite elem_of_list_fmap.
intros ([k2 Hk2]&?&?) Hxk2; simplify_equality'. destruct Hx. revert Hxk2.
intros ([k2 Hk2]&?&?) Hxk2; simplify_eq/=. destruct Hx. revert Hxk2.
induction xs as [|x' xs IH]; simpl in *; [by rewrite elem_of_nil |].
rewrite elem_of_app, elem_of_list_fmap, elem_of_cons.
intros [([??]&?&?)|?]; simplify_equality'; auto.
intros [([??]&?&?)|?]; simplify_eq/=; auto.
- apply IH.
Qed.
Next Obligation.
intros ???? [l Hl]. revert l Hl.
induction n as [|n IH]; intros [|x l] ?; simpl; simplify_equality.
induction n as [|n IH]; intros [|x l] ?; simpl; simplify_eq.
{ apply elem_of_list_singleton. by apply (sig_eq_pi _). }
revert IH. generalize (list_enum (enum A) n). intros k Hk.
induction (elem_of_enum x) as [x xs|x xs]; simpl in *.
......
......@@ -19,7 +19,7 @@ Arguments gmap_car {_ _ _ _} _.
Lemma gmap_eq `{Countable K} {A} (m1 m2 : gmap K A) :
m1 = m2 gmap_car m1 = gmap_car m2.
Proof.
split; [by intros ->|intros]. destruct m1, m2; simplify_equality'.
split; [by intros ->|intros]. destruct m1, m2; simplify_eq/=.
f_equal; apply proof_irrel.
Qed.
Instance gmap_eq_eq `{Countable K} `{ x y : A, Decision (x = y)}
......@@ -83,9 +83,9 @@ Proof.
apply bool_decide_unpack in Hm1; apply bool_decide_unpack in Hm2.
apply option_eq; intros x; split; intros Hi.
+ pose proof (Hm1 i x Hi); simpl in *.
by destruct (decode i); simplify_equality'; rewrite <-Hm.
by destruct (decode i); simplify_eq/=; rewrite <-Hm.
+ pose proof (Hm2 i x Hi); simpl in *.
by destruct (decode i); simplify_equality'; rewrite Hm.
by destruct (decode i); simplify_eq/=; rewrite Hm.
- done.
- intros A f [m Hm] i; apply (lookup_partial_alter f m).
- intros A f [m Hm] i j Hs; apply (lookup_partial_alter_ne f m).
......@@ -94,16 +94,16 @@ Proof.
- intros A [m Hm]; unfold map_to_list; simpl.
apply bool_decide_unpack, map_Forall_to_list in Hm; revert Hm.
induction (NoDup_map_to_list m) as [|[p x] l Hpx];
inversion 1 as [|??? Hm']; simplify_equality'; [by constructor|].
destruct (decode p) as [i|] eqn:?; simplify_equality'; constructor; eauto.
rewrite elem_of_list_omap; intros ([p' x']&?&?); simplify_equality'.
inversion 1 as [|??? Hm']; simplify_eq/=; [by constructor|].
destruct (decode p) as [i|] eqn:?; simplify_eq/=; constructor; eauto.
rewrite elem_of_list_omap; intros ([p' x']&?&?); simplify_eq/=.
feed pose proof (proj1 (Forall_forall _ _) Hm' (p',x')); simpl in *; auto.
by destruct (decode p') as [i'|]; simplify_equality'.
by destruct (decode p') as [i'|]; simplify_eq/=.
- intros A [m Hm] i x; unfold map_to_list, lookup; simpl.
apply bool_decide_unpack in Hm; rewrite elem_of_list_omap; split.
+ intros ([p' x']&Hp'&?); apply elem_of_map_to_list in Hp'.
feed pose proof (Hm p' x'); simpl in *; auto.
by destruct (decode p') as [i'|] eqn:?; simplify_equality'.
by destruct (decode p') as [i'|] eqn:?; simplify_eq/=.
+ intros; exists (encode i,x); simpl.
by rewrite elem_of_map_to_list, decode_encode.
- intros A B f [m Hm] i; apply (lookup_omap f m).
......
......@@ -33,7 +33,7 @@ Program Instance hashset_union: Union (hashset hash) := λ m1 m2,
Hashset (union_with (λ l k, Some (list_union l k)) m1 m2) _.
Next Obligation.
intros _ _ m1 Hm1 m2 Hm2 n l'; rewrite lookup_union_with_Some.
intros [[??]|[[??]|(l&k&?&?&?)]]; simplify_equality'; auto.
intros [[??]|[[??]|(l&k&?&?&?)]]; simplify_eq/=; auto.
split; [apply Forall_list_union|apply NoDup_list_union];
first [by eapply Hm1; eauto | by eapply Hm2; eauto].
Qed.
......@@ -43,7 +43,7 @@ Program Instance hashset_intersection: Intersection (hashset hash) := λ m1 m2,
let l' := list_intersection l k in guard (l' []); Some l') m1 m2) _.
Next Obligation.
intros _ _ m1 Hm1 m2 Hm2 n l'. rewrite lookup_intersection_with_Some.
intros (?&?&?&?&?); simplify_option_equality.
intros (?&?&?&?&?); simplify_option_eq.
split; [apply Forall_list_intersection|apply NoDup_list_intersection];
first [by eapply Hm1; eauto | by eapply Hm2; eauto].
Qed.
......@@ -53,7 +53,7 @@ Program Instance hashset_difference: Difference (hashset hash) := λ m1 m2,
let l' := list_difference l k in guard (l' []); Some l') m1 m2) _.
Next Obligation.
intros _ _ m1 Hm1 m2 Hm2 n l'. rewrite lookup_difference_with_Some.
intros [[??]|(?&?&?&?&?)]; simplify_option_equality; auto.
intros [[??]|(?&?&?&?&?)]; simplify_option_eq; auto.
split; [apply Forall_list_difference|apply NoDup_list_difference];
first [by eapply Hm1; eauto | by eapply Hm2; eauto].
Qed.
......@@ -63,7 +63,7 @@ Instance hashset_elems: Elements A (hashset hash) := λ m,
Global Instance: FinCollection A (hashset hash).
Proof.
split; [split; [split| |]| |].
- intros ? (?&?&?); simplify_map_equality'.
- intros ? (?&?&?); simplify_map_eq/=.
- unfold elem_of, hashset_elem_of, singleton, hashset_singleton; simpl.
intros x y. setoid_rewrite lookup_singleton_Some. split.
{ by intros (?&[? <-]&?); decompose_elem_of_list. }
......@@ -71,7 +71,7 @@ Proof.
- unfold elem_of, hashset_elem_of, union, hashset_union.
intros [m1 Hm1] [m2 Hm2] x; simpl; setoid_rewrite lookup_union_with_Some.
split.
{ intros (?&[[]|[[]|(l&k&?&?&?)]]&Hx); simplify_equality'; eauto.
{ intros (?&[[]|[[]|(l&k&?&?&?)]]&Hx); simplify_eq/=; eauto.
rewrite elem_of_list_union in Hx; destruct Hx; eauto. }
intros [(l&?&?)|(k&?&?)].
+ destruct (m2 !! hash x) as [k|]; eauto.
......@@ -81,7 +81,7 @@ Proof.
- unfold elem_of, hashset_elem_of, intersection, hashset_intersection.
intros [m1 ?] [m2 ?] x; simpl.
setoid_rewrite lookup_intersection_with_Some. split.
{ intros (?&(l&k&?&?&?)&Hx); simplify_option_equality.
{ intros (?&(l&k&?&?&?)&Hx); simplify_option_eq.
rewrite elem_of_list_intersection in Hx; naive_solver. }
intros [(l&?&?) (k&?&?)]. assert (x list_intersection l k)
by (by rewrite elem_of_list_intersection).
......@@ -90,7 +90,7 @@ Proof.
- unfold elem_of, hashset_elem_of, intersection, hashset_intersection.
intros [m1 ?] [m2 ?] x; simpl.
setoid_rewrite lookup_difference_with_Some. split.
{ intros (l'&[[??]|(l&k&?&?&?)]&Hx); simplify_option_equality;
{ intros (l'&[[??]|(l&k&?&?&?)]&Hx); simplify_option_eq;
rewrite ?elem_of_list_difference in Hx; naive_solver. }
intros [(l&?&?) Hm2]; destruct (m2 !! hash x) as [k|] eqn:?; eauto.
destruct (decide (x k)); [destruct Hm2; eauto|].
......
......@@ -41,7 +41,7 @@ Lemma prod_lexico_transitive `{Lexico A, Lexico B, !Transitive (@lexico A _)}
(lexico y1 y2 lexico y2 y3 lexico y1 y3) lexico (x1,y1) (x3,y3).
Proof.
intros Hx12 Hx23 ?; revert Hx12 Hx23. unfold lexico, prod_lexico.
intros [|[??]] [?|[??]]; simplify_equality'; auto.
intros [|[??]] [?|[??]]; simplify_eq/=; auto.
by left; transitivity x2.
Qed.
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ Proof.
Qed.
Lemma listset_empty_alt X : X listset_car X = [].
Proof.
destruct X as [l]; split; [|by intros; simplify_equality'].
destruct X as [l]; split; [|by intros; simplify_eq/=].
intros [Hl _]; destruct l as [|x l]; [done|]. feed inversion (Hl x); left.
Qed.
Global Instance listset_empty_dec (X : listset A) : Decision (X ).
......
......@@ -50,7 +50,7 @@ Proof.
- unfold empty, elem_of, mapset_empty, mapset_elem_of.
simpl. intros. by simpl_map.
- unfold singleton, elem_of, mapset_singleton, mapset_elem_of.
simpl. by split; intros; simplify_map_equality.
simpl. by split; intros; simplify_map_eq.
- unfold union, elem_of, mapset_union, mapset_elem_of.
intros [m1] [m2] ?. simpl. rewrite lookup_union_Some_raw.
destruct (m1 !! x) as [[]|]; tauto.
......
......@@ -34,7 +34,7 @@ Lemma natmap_eq {A} (m1 m2 : natmap A) :
m1 = m2 natmap_car m1 = natmap_car m2.
Proof.
split; [by intros ->|intros]; destruct m1 as [t1 ?], m2 as [t2 ?].
simplify_equality'; f_equal; apply proof_irrel.
simplify_eq/=; f_equal; apply proof_irrel.
Qed.
Global Instance natmap_eq_dec `{ x y : A, Decision (x = y)}
(m1 m2 : natmap A) : Decision (m1 = m2) :=
......@@ -51,7 +51,7 @@ Fixpoint natmap_singleton_raw {A} (i : nat) (x : A) : natmap_raw A :=
match i with 0 => [Some x]| S i => None :: natmap_singleton_raw i x end.
Lemma natmap_singleton_wf {A} (i : nat) (x : A) :
natmap_wf (natmap_singleton_raw i x).
Proof. unfold natmap_wf. induction i as [|[]]; simplify_equality'; eauto. Qed.
Proof. unfold natmap_wf. induction i as [|[]]; simplify_eq/=; eauto. Qed.
Lemma natmap_lookup_singleton_raw {A} (i : nat) (x : A) :
mjoin (natmap_singleton_raw i x !! i) = Some x.
Proof. induction i; simpl; auto. Qed.
......@@ -162,7 +162,7 @@ Proof.
split.
- revert j. induction l as [|[y|] l IH]; intros j; simpl.
+ by rewrite elem_of_nil.
+ rewrite elem_of_cons. intros [?|?]; simplify_equality.
+ rewrite elem_of_cons. intros [?|?]; simplify_eq.
* by exists 0.
* destruct (IH (S j)) as (i'&?&?); auto.
exists (S i'); simpl; auto with lia.
......@@ -171,9 +171,9 @@ Proof.
- intros (i'&?&Hi'). subst. revert i' j Hi'.
induction l as [|[y|] l IH]; intros i j ?; simpl.
+ done.
+ destruct i as [|i]; simplify_equality'; [left|].
+ destruct i as [|i]; simplify_eq/=; [left|].
right. rewrite <-Nat.add_succ_r. by apply (IH i (S j)).
+ destruct i as [|i]; simplify_equality'.
+ destruct i as [|i]; simplify_eq/=.
rewrite <-Nat.add_succ_r. by apply (IH i (S j)).
Qed.
Lemma natmap_elem_of_to_list_raw {A} (l : natmap_raw A) i x :
......
......@@ -64,9 +64,9 @@ Proof.
- intros ? t i x. unfold map_to_list. split.
+ destruct t as [[y|] t]; simpl.
* rewrite elem_of_cons, elem_of_list_fmap.
intros [? | [[??] [??]]]; simplify_equality'; [done |].
intros [? | [[??] [??]]]; simplify_eq/=; [done |].
by apply elem_of_map_to_list.
* rewrite elem_of_list_fmap; intros [[??] [??]]; simplify_equality'.
* rewrite elem_of_list_fmap; intros [[??] [??]]; simplify_eq/=.
by apply elem_of_map_to_list.
+ destruct t as [[y|] t]; simpl.
* rewrite elem_of_cons, elem_of_list_fmap.
......
......@@ -138,13 +138,13 @@ Fixpoint Preverse_go (p1 p2 : positive) : positive :=
Definition Preverse : positive positive := Preverse_go 1.
Global Instance: LeftId (=) 1 (++).
Proof. intros p. by induction p; intros; f_equal'. Qed.
Proof. intros p. by induction p; intros; f_equal/=. Qed.
Global Instance: RightId (=) 1 (++).
Proof. done. Qed.
Global Instance: Assoc (=) (++).
Proof. intros ?? p. by induction p; intros; f_equal'. Qed.
Proof. intros ?? p. by induction p; intros; f_equal/=. Qed.
Global Instance: p : positive, Inj (=) (=) (++ p).
Proof. intros p ???. induction p; simplify_equality; auto. Qed.
Proof. intros p ???. induction p; simplify_eq; auto. Qed.
Lemma Preverse_go_app p1 p2 p3 :
Preverse_go p1 (p2 ++ p3) = Preverse_go p1 p3 ++ Preverse_go 1 p2.
......@@ -166,7 +166,7 @@ Proof Preverse_app p (1~1).
Fixpoint Plength (p : positive) : nat :=
match p with 1 => 0%nat | p~0 | p~1 => S (Plength p) end.
Lemma Papp_length p1 p2 : Plength (p1 ++ p2) = (Plength p2 + Plength p1)%nat.
Proof. by induction p2; f_equal'. Qed.
Proof. by induction p2; f_equal/=. Qed.
Close Scope positive_scope.
......
......@@ -162,7 +162,7 @@ Lemma option_bind_assoc {A B C} (f : A → option B)
Proof. by destruct x; simpl. Qed.
Lemma option_bind_ext {A B} (f g : A option B) x y :
( a, f a = g a) x = y x = f = y = g.
Proof. intros. destruct x, y; simplify_equality; csimpl; auto. Qed.
Proof. intros. destruct x, y; simplify_eq; csimpl; auto. Qed.
Lemma option_bind_ext_fun {A B} (f g : A option B) x :
( a, f a = g a) x = f = x = g.
Proof. intros. by apply option_bind_ext. Qed.
......@@ -173,7 +173,7 @@ Lemma bind_None {A B} (f : A → option B) (x : option A) :
x = f = None x = None a, x = Some a f a = None.
Proof.
split; [|by intros [->|(?&->&?)]].
destruct x; intros; simplify_equality'; eauto.
destruct x; intros; simplify_eq/=; eauto.
Qed.
Lemma bind_with_Some {A} (x : option A) : x = Some = x.