Commit f372c5c1 authored by Robbert Krebbers's avatar Robbert Krebbers

Rename algebra/fin_maps.v -> algebra/gmap.v

Also remove some superfluous map_ prefixes.
parent 9fd42107
......@@ -41,7 +41,7 @@ algebra/cmra_big_op.v
This diff is collapsed.
......@@ -7,7 +7,7 @@ Import uPred.
a finmap as their state. Or maybe even beyond "as their state", i.e. arbitrary
predicates over finmaps instead of just ownP. *)
Definition heapR : cmraT := mapR loc (fracR (dec_agreeR val)).
Definition heapR : cmraT := gmapR loc (fracR (dec_agreeR val)).
(** The CMRA we need. *)
Class heapG Σ := HeapG {
......@@ -108,9 +108,9 @@ Section heap.
induction σ as [|l v σ Hl IH] using map_ind.
{ rewrite big_sepM_empty; apply True_intro. }
rewrite to_heap_insert big_sepM_insert //.
rewrite (map_insert_singleton_op (to_heap σ));
rewrite (insert_singleton_op (to_heap σ));
last by rewrite lookup_fmap Hl; auto.
by rewrite auth_own_op IH.
by rewrite auth_own_op IH.
Context `{heapG Σ}.
......@@ -121,16 +121,16 @@ Section heap.
Lemma heap_mapsto_op_eq l q1 q2 v :
(l {q1} v l {q2} v) (l {q1+q2} v).
Proof. by rewrite -auth_own_op map_op_singleton Frac_op dec_agree_idemp. Qed.
Proof. by rewrite -auth_own_op op_singleton Frac_op dec_agree_idemp. Qed.
Lemma heap_mapsto_op l q1 q2 v1 v2 :
(l {q1} v1 l {q2} v2) (v1 = v2 l {q1+q2} v1).
destruct (decide (v1 = v2)) as [->|].
{ by rewrite heap_mapsto_op_eq const_equiv // left_id. }
rewrite -auth_own_op map_op_singleton Frac_op dec_agree_ne //.
rewrite -auth_own_op op_singleton Frac_op dec_agree_ne //.
apply (anti_symm ()); last by apply const_elim_l.
rewrite auth_own_valid map_validI (forall_elim l) lookup_singleton.
rewrite auth_own_valid gmap_validI (forall_elim l) lookup_singleton.
rewrite option_validI frac_validI discrete_valid. by apply const_elim_r.
......@@ -160,8 +160,8 @@ Section heap.
repeat erewrite <-exist_intro by apply _; simpl.
rewrite -of_heap_insert left_id right_id.
rewrite /heap_mapsto. ecancel [_ - Φ _]%I.
rewrite -(map_insert_singleton_op h); last by apply of_heap_None.
rewrite const_equiv; last by apply (map_insert_valid h).
rewrite -(insert_singleton_op h); last by apply of_heap_None.
rewrite const_equiv; last by apply (insert_valid h).
by rewrite left_id -later_intro.
......@@ -12,7 +12,7 @@ Typeclasses Opaque to_globalF own.
(** Properties about ghost ownership *)
Section global.
Context `{i : inG Λ Σ A}.
Context `{inG Λ Σ A}.
Implicit Types a : A.
(** * Transport empty *)
......@@ -35,12 +35,12 @@ Global Instance own_proper γ : Proper ((≡) ==> (⊣⊢)) (own γ) := ne_prope
Lemma own_op γ a1 a2 : own γ (a1 a2) (own γ a1 own γ a2).
Proof. by rewrite /own -ownG_op to_globalF_op. Qed.
Global Instance own_mono γ : Proper (flip () ==> ()) (own γ).
Proof. move=>a b [c H]. rewrite H own_op. eauto with I. Qed.
Proof. move=>a b [c ->]. rewrite own_op. eauto with I. Qed.
Lemma own_valid γ a : own γ a a.
rewrite /own ownG_valid /to_globalF.
rewrite iprod_validI (forall_elim inG_id) iprod_lookup_singleton.
rewrite map_validI (forall_elim γ) lookup_singleton option_validI.
rewrite gmap_validI (forall_elim γ) lookup_singleton option_validI.
(* implicit arguments differ a bit *)
by trans ( cmra_transport inG_prf a : iPropG Λ Σ)%I; last destruct inG_prf.
......@@ -60,8 +60,9 @@ Lemma own_alloc_strong a E (G : gset gname) :
intros Ha.
rewrite -(pvs_mono _ _ ( m, ( γ, γ G m = to_globalF γ a) ownG m)%I).
- rewrite ownG_empty. eapply pvs_ownG_updateP, (iprod_singleton_updateP_empty inG_id);
first (eapply map_updateP_alloc_strong', cmra_transport_valid, Ha);
- rewrite ownG_empty.
eapply pvs_ownG_updateP, (iprod_singleton_updateP_empty inG_id);
first (eapply updateP_alloc_strong', cmra_transport_valid, Ha);
- apply exist_elim=>m; apply const_elim_l=>-[γ [Hfresh ->]].
by rewrite -(exist_intro γ) const_equiv // left_id.
......@@ -78,7 +79,7 @@ Proof.
intros Ha.
rewrite -(pvs_mono _ _ ( m, ( a', m = to_globalF γ a' P a') ownG m)%I).
- eapply pvs_ownG_updateP, iprod_singleton_updateP;
first by (eapply map_singleton_updateP', cmra_transport_updateP', Ha).
first by (eapply singleton_updateP', cmra_transport_updateP', Ha).
- apply exist_elim=>m; apply const_elim_l=>-[a' [-> HP]].
rewrite -(exist_intro a'). by apply and_intro; [apply const_intro|].
......@@ -90,13 +91,12 @@ Proof.
by apply pvs_mono, exist_elim=> a''; apply const_elim_l=> ->.
Lemma own_empty `{Empty A, !CMRAUnit A} γ E :
True (|={E}=> own γ ).
Lemma own_empty `{Empty A, !CMRAUnit A} γ E : True (|={E}=> own γ ).
rewrite ownG_empty /own. apply pvs_ownG_update, cmra_update_updateP.
eapply iprod_singleton_updateP_empty;
first by eapply map_singleton_updateP_empty', cmra_transport_updateP',
cmra_update_updateP, cmra_update_unit.
first by eapply singleton_updateP_empty', cmra_transport_updateP',
cmra_update_updateP, cmra_update_unit.
End global.
......@@ -18,7 +18,7 @@ Definition gid (Σ : gFunctors) := fin (projT1 Σ).
Definition gname := positive.
Definition globalF (Σ : gFunctors) : iFunctor :=
IFunctor (iprodRF (λ i, mapRF gname (projT2 Σ i))).
IFunctor (iprodRF (λ i, gmapRF gname (projT2 Σ i))).
Notation iPropG Λ Σ := (iProp Λ (globalF Σ)).
Class inG (Λ : language) (Σ : gFunctors) (A : cmraT) := InG {
......@@ -39,7 +39,7 @@ Proof. by intros a a' Ha; apply iprod_singleton_ne; rewrite Ha. Qed.
Lemma to_globalF_op γ a1 a2 :
to_globalF γ (a1 a2) to_globalF γ a1 to_globalF γ a2.
by rewrite /to_globalF iprod_op_singleton map_op_singleton cmra_transport_op.
by rewrite /to_globalF iprod_op_singleton op_singleton cmra_transport_op.
Global Instance to_globalF_timeless γ m: Timeless m Timeless (to_globalF γ m).
Proof. rewrite /to_globalF; apply _. Qed.
......@@ -65,7 +65,7 @@ Proof.
rewrite /uPred_holds/=res_includedN/= singleton_includedN; split.
- intros [(P'&Hi&HP) _]; rewrite Hi.
apply Some_dist, symmetry, agree_valid_includedN; last done.
by apply map_lookup_validN with (wld r) i.
by apply lookup_validN with (wld r) i.
- intros ?; split_and?; try apply cmra_unit_leastN; eauto.
Lemma ownP_spec n r σ : {n} r (ownP σ) n r pst r Excl σ.
From iris.algebra Require Export fin_maps agree excl.
From iris.algebra Require Export gmap agree excl.
From iris.algebra Require Import upred.
From iris.program_logic Require Export language.
Record res (Λ : language) (A : cofeT) (M : cmraT) := Res {
wld : mapR positive (agreeR A);
wld : gmapR positive (agreeR A);
pst : exclR (stateC Λ);
gst : M;
......@@ -216,7 +216,7 @@ Instance resC_map_ne {Λ A A' M M'} n :
Proper (dist n ==> dist n ==> dist n) (@resC_map Λ A A' M M').
intros f g Hfg r; split; simpl; auto.
- by apply (mapC_map_ne _ (agreeC_map f) (agreeC_map g)), agreeC_map_ne.
- by apply (gmapC_map_ne _ (agreeC_map f) (agreeC_map g)), agreeC_map_ne.
Program Definition resRF (Λ : language)
......@@ -53,7 +53,7 @@ Proof.
assert (P' {S n} to_agree $ Next $ iProp_unfold $
iProp_fold $ later_car $ P' (S n)) as HPiso.
{ rewrite iProp_unfold_fold later_eta to_agree_car //.
apply (map_lookup_validN _ (wld (r big_opM rs)) i); rewrite ?HP'; auto. }
apply (lookup_validN _ (wld (r big_opM rs)) i); rewrite ?HP'; auto. }
assert (P {n'} iProp_fold (later_car (P' (S n)))) as HPP'.
{ apply (inj iProp_unfold), (inj Next), (inj to_agree).
by rewrite -HiP -(dist_le _ _ _ _ HPiso). }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment