Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lennard Gäher
Iris
Commits
5cfe326f
Commit
5cfe326f
authored
Mar 08, 2021
by
Ralf Jung
Browse files
fix indentation and various nits
parent
b0da646d
Changes
2
Show whitespace changes
Inline
Side-by-side
iris/algebra/dyn_reservation_map.v
View file @
5cfe326f
...
...
@@ -66,11 +66,14 @@ Section ofe.
dyn_reservation_map_data_proj
x
≡
{
n
}
≡
dyn_reservation_map_data_proj
y
∧
dyn_reservation_map_token_proj
x
=
dyn_reservation_map_token_proj
y
.
Global
Instance
DynReservationMap_ne
:
NonExpansive2
(@
DynReservationMap
A
).
Global
Instance
DynReservationMap_ne
:
NonExpansive2
(@
DynReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
DynReservationMap_proper
:
Proper
((
≡
)
==>
(=)
==>
(
≡
))
(@
DynReservationMap
A
).
Global
Instance
DynReservationMap_proper
:
Proper
((
≡
)
==>
(=)
==>
(
≡
))
(@
DynReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
dyn_reservation_map_data_proj_ne
:
NonExpansive
(@
dyn_reservation_map_data_proj
A
).
Global
Instance
dyn_reservation_map_data_proj_ne
:
NonExpansive
(@
dyn_reservation_map_data_proj
A
).
Proof
.
by
destruct
1
.
Qed
.
Global
Instance
dyn_reservation_map_data_proj_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
dyn_reservation_map_data_proj
A
).
...
...
@@ -182,14 +185,10 @@ Section cmra.
rewrite
{
1
}/
op
/
cmra_op
/=.
case_decide
;
last
done
.
intros
[
Hm
[
Hinf
Hdisj
]]
;
split
;
first
by
eauto
using
cmra_validN_op_l
.
split
.
+
rewrite
->
difference_union_distr_r
in
Hinf
.
eapply
set_infinite_subseteq
;
last
done
.
set_solver
.
+
rewrite
->
difference_union_distr_r_L
in
Hinf
.
eapply
set_infinite_subseteq
,
Hinf
.
set_solver
.
+
intros
i
.
move
:
(
Hdisj
i
).
rewrite
lookup_op
.
case
:
(
m1
!!
i
)=>
[
a
|]
;
last
auto
.
move
=>
[].
{
by
case
:
(
m2
!!
i
).
}
set_solver
.
case
:
(
m1
!!
i
)
;
case
:
(
m2
!!
i
)
;
set_solver
.
Qed
.
Canonical
Structure
dyn_reservation_mapR
:
=
...
...
@@ -209,7 +208,7 @@ Section cmra.
Proof
.
split
;
simpl
.
-
rewrite
dyn_reservation_map_valid_eq
/=.
split
;
[
apply
ucmra_unit_valid
|].
split
.
+
rewrite
difference_empty
.
apply
top_infinite
.
+
rewrite
difference_empty
_L
.
apply
top_infinite
.
+
set_solver
.
-
split
;
simpl
;
[
by
rewrite
left_id
|
by
rewrite
left_id_L
].
-
do
2
constructor
;
[
apply
(
core_id_core
_
)|
done
].
...
...
@@ -227,7 +226,7 @@ Section cmra.
rewrite
dyn_reservation_map_valid_eq
/=
singleton_valid
.
split
;
first
naive_solver
.
intros
Ha
.
split
;
first
done
.
split
;
last
set_solver
.
rewrite
difference_empty
.
apply
top_infinite
.
rewrite
difference_empty
_L
.
apply
top_infinite
.
Qed
.
Lemma
dyn_reservation_map_token_valid
E
:
✓
(
dyn_reservation_map_token
E
)
↔
set_infinite
(
⊤
∖
E
).
...
...
@@ -284,15 +283,14 @@ Section cmra.
such that both that set [E1] and the remainder [E2] are infinite. *)
edestruct
(
coPset_split_infinite
(
⊤
∖
(
Ef
∪
dom
coPset
mf
)))
as
(
E1
&
E2
&
HEunion
&
HEdisj
&
HE1inf
&
HE2inf
).
{
rewrite
-
difference_difference
.
apply
difference_infinite
;
first
done
.
apply
gset_to_coPset_finite
.
}
{
rewrite
-
difference_difference_L
.
by
apply
difference_infinite
,
dom_finite
.
}
exists
(
dyn_reservation_map_token
E1
).
split
;
first
by
apply
HQ
.
clear
HQ
.
rewrite
dyn_reservation_map_validN_eq
/=.
rewrite
coPset_disj_union
;
last
set_solver
.
split
;
first
by
rewrite
left_id
.
split
.
-
eapply
set_infinite_subseteq
;
last
by
apply
HE2inf
.
set_solver
.
split
;
first
by
rewrite
left_id
_L
.
split
.
-
eapply
set_infinite_subseteq
,
HE2inf
.
set_solver
.
-
intros
i
.
rewrite
left_id_L
.
destruct
(
Hdisj
i
)
as
[?|
Hi
]
;
first
by
left
.
destruct
(
mf
!!
i
)
as
[
p
|]
eqn
:
Hp
;
last
by
left
.
apply
elem_of_dom_2
in
Hp
.
right
.
set_solver
.
...
...
@@ -307,13 +305,13 @@ Section cmra.
intros
??.
apply
cmra_total_update
=>
n
[
mf
[
Ef
|]]
//.
rewrite
dyn_reservation_map_validN_eq
/=
{
1
}/
op
/
cmra_op
/=.
case_decide
;
last
done
.
rewrite
left_id_L
{
1
}
left_id
.
intros
[
Hmf
[
Hinf
Hdisj
]]
;
split
;
last
split
.
-
destruct
(
Hdisj
(
k
)
)
as
[
Hmfi
|]
;
last
set_solver
.
-
destruct
(
Hdisj
k
)
as
[
Hmfi
|]
;
last
set_solver
.
move
:
Hmfi
.
rewrite
lookup_op
lookup_empty
left_id_L
=>
Hmfi
.
intros
j
.
rewrite
lookup_op
.
destruct
(
decide
(
k
=
j
))
as
[<-|].
+
rewrite
Hmfi
lookup_singleton
right_id_L
.
by
apply
cmra_valid_validN
.
+
by
rewrite
lookup_singleton_ne
//
left_id_L
.
-
eapply
set_infinite_subseteq
;
last
done
.
set_solver
.
-
eapply
set_infinite_subseteq
,
Hinf
.
set_solver
.
-
intros
j
.
destruct
(
decide
(
k
=
j
))
;
first
set_solver
.
rewrite
lookup_op
lookup_singleton_ne
//.
destruct
(
Hdisj
j
)
as
[
Hmfi
|?]
;
last
set_solver
.
...
...
@@ -321,7 +319,8 @@ Section cmra.
Qed
.
Lemma
dyn_reservation_map_updateP
P
(
Q
:
dyn_reservation_map
A
→
Prop
)
k
a
:
a
~~>
:
P
→
(
∀
a'
,
P
a'
→
Q
(
dyn_reservation_map_data
k
a'
))
→
dyn_reservation_map_data
k
a
~~>
:
Q
.
(
∀
a'
,
P
a'
→
Q
(
dyn_reservation_map_data
k
a'
))
→
dyn_reservation_map_data
k
a
~~>
:
Q
.
Proof
.
intros
Hup
HP
.
apply
cmra_total_updateP
=>
n
[
mf
[
Ef
|]]
//.
rewrite
dyn_reservation_map_validN_eq
/=
left_id_L
.
intros
[
Hmf
[
Hinf
Hdisj
]].
...
...
@@ -339,7 +338,8 @@ Section cmra.
rewrite
!
lookup_op
!
op_None
!
lookup_singleton_None
.
naive_solver
.
Qed
.
Lemma
dyn_reservation_map_update
k
a
b
:
a
~~>
b
→
dyn_reservation_map_data
k
a
~~>
dyn_reservation_map_data
k
b
.
a
~~>
b
→
dyn_reservation_map_data
k
a
~~>
dyn_reservation_map_data
k
b
.
Proof
.
rewrite
!
cmra_update_updateP
.
eauto
using
dyn_reservation_map_updateP
with
subst
.
Qed
.
...
...
iris/algebra/reservation_map.v
View file @
5cfe326f
...
...
@@ -41,63 +41,66 @@ Global Instance: Params (@reservation_map_data) 2 := {}.
(* Ofe *)
Section
ofe
.
Context
{
A
:
ofe
}.
Implicit
Types
x
y
:
reservation_map
A
.
Context
{
A
:
ofe
}.
Implicit
Types
x
y
:
reservation_map
A
.
Local
Instance
reservation_map_equiv
:
Equiv
(
reservation_map
A
)
:
=
λ
x
y
,
Local
Instance
reservation_map_equiv
:
Equiv
(
reservation_map
A
)
:
=
λ
x
y
,
reservation_map_data_proj
x
≡
reservation_map_data_proj
y
∧
reservation_map_token_proj
x
=
reservation_map_token_proj
y
.
Local
Instance
reservation_map_dist
:
Dist
(
reservation_map
A
)
:
=
λ
n
x
y
,
Local
Instance
reservation_map_dist
:
Dist
(
reservation_map
A
)
:
=
λ
n
x
y
,
reservation_map_data_proj
x
≡
{
n
}
≡
reservation_map_data_proj
y
∧
reservation_map_token_proj
x
=
reservation_map_token_proj
y
.
Global
Instance
ReservationMap_ne
:
NonExpansive2
(@
ReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
ReservationMap_proper
:
Proper
((
≡
)
==>
(=)
==>
(
≡
))
(@
ReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
reservation_map_data_proj_ne
:
NonExpansive
(@
reservation_map_data_proj
A
).
Proof
.
by
destruct
1
.
Qed
.
Global
Instance
reservation_map_data_proj_proper
:
Global
Instance
ReservationMap_ne
:
NonExpansive2
(@
ReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
ReservationMap_proper
:
Proper
((
≡
)
==>
(=)
==>
(
≡
))
(@
ReservationMap
A
).
Proof
.
by
split
.
Qed
.
Global
Instance
reservation_map_data_proj_ne
:
NonExpansive
(@
reservation_map_data_proj
A
).
Proof
.
by
destruct
1
.
Qed
.
Global
Instance
reservation_map_data_proj_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
reservation_map_data_proj
A
).
Proof
.
by
destruct
1
.
Qed
.
Proof
.
by
destruct
1
.
Qed
.
Definition
reservation_map_ofe_mixin
:
OfeMixin
(
reservation_map
A
).
Proof
.
Definition
reservation_map_ofe_mixin
:
OfeMixin
(
reservation_map
A
).
Proof
.
by
apply
(
iso_ofe_mixin
(
λ
x
,
(
reservation_map_data_proj
x
,
reservation_map_token_proj
x
))).
Qed
.
Canonical
Structure
reservation_mapO
:
=
Qed
.
Canonical
Structure
reservation_mapO
:
=
Ofe
(
reservation_map
A
)
reservation_map_ofe_mixin
.
Global
Instance
ReservationMap_discrete
a
b
:
Global
Instance
ReservationMap_discrete
a
b
:
Discrete
a
→
Discrete
b
→
Discrete
(
ReservationMap
a
b
).
Proof
.
intros
??
[??]
[??]
;
split
;
unfold_leibniz
;
by
eapply
discrete
.
Qed
.
Global
Instance
reservation_map_ofe_discrete
:
Proof
.
intros
??
[??]
[??]
;
split
;
unfold_leibniz
;
by
eapply
discrete
.
Qed
.
Global
Instance
reservation_map_ofe_discrete
:
OfeDiscrete
A
→
OfeDiscrete
reservation_mapO
.
Proof
.
intros
?
[??]
;
apply
_
.
Qed
.
Proof
.
intros
?
[??]
;
apply
_
.
Qed
.
End
ofe
.
Global
Arguments
reservation_mapO
:
clear
implicits
.
(* Camera *)
Section
cmra
.
Context
{
A
:
cmra
}.
Implicit
Types
a
b
:
A
.
Implicit
Types
x
y
:
reservation_map
A
.
Implicit
Types
k
:
positive
.
Context
{
A
:
cmra
}.
Implicit
Types
a
b
:
A
.
Implicit
Types
x
y
:
reservation_map
A
.
Implicit
Types
k
:
positive
.
Global
Instance
reservation_map_data_ne
i
:
NonExpansive
(@
reservation_map_data
A
i
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
reservation_map_data_proper
N
:
Global
Instance
reservation_map_data_ne
i
:
NonExpansive
(@
reservation_map_data
A
i
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
reservation_map_data_proper
N
:
Proper
((
≡
)
==>
(
≡
))
(@
reservation_map_data
A
N
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
reservation_map_data_discrete
N
a
:
Proof
.
solve_proper
.
Qed
.
Global
Instance
reservation_map_data_discrete
N
a
:
Discrete
a
→
Discrete
(
reservation_map_data
N
a
).
Proof
.
intros
.
apply
ReservationMap_discrete
;
apply
_
.
Qed
.
Global
Instance
reservation_map_token_discrete
E
:
Discrete
(@
reservation_map_token
A
E
).
Proof
.
intros
.
apply
ReservationMap_discrete
;
apply
_
.
Qed
.
Proof
.
intros
.
apply
ReservationMap_discrete
;
apply
_
.
Qed
.
Global
Instance
reservation_map_token_discrete
E
:
Discrete
(@
reservation_map_token
A
E
).
Proof
.
intros
.
apply
ReservationMap_discrete
;
apply
_
.
Qed
.
Local
Instance
reservation_map_valid_instance
:
Valid
(
reservation_map
A
)
:
=
λ
x
,
Local
Instance
reservation_map_valid_instance
:
Valid
(
reservation_map
A
)
:
=
λ
x
,
match
reservation_map_token_proj
x
with
|
CoPset
E
=>
✓
(
reservation_map_data_proj
x
)
∧
...
...
@@ -105,8 +108,8 @@ Local Instance reservation_map_valid_instance : Valid (reservation_map A) := λ
∀
i
,
reservation_map_data_proj
x
!!
i
=
None
∨
i
∉
E
|
CoPsetBot
=>
False
end
.
Global
Arguments
reservation_map_valid_instance
!
_
/.
Local
Instance
reservation_map_validN_instance
:
ValidN
(
reservation_map
A
)
:
=
λ
n
x
,
Global
Arguments
reservation_map_valid_instance
!
_
/.
Local
Instance
reservation_map_validN_instance
:
ValidN
(
reservation_map
A
)
:
=
λ
n
x
,
match
reservation_map_token_proj
x
with
|
CoPset
E
=>
✓
{
n
}
(
reservation_map_data_proj
x
)
∧
...
...
@@ -114,14 +117,14 @@ Local Instance reservation_map_validN_instance : ValidN (reservation_map A) :=
∀
i
,
reservation_map_data_proj
x
!!
i
=
None
∨
i
∉
E
|
CoPsetBot
=>
False
end
.
Global
Arguments
reservation_map_validN_instance
!
_
/.
Local
Instance
reservation_map_pcore_instance
:
PCore
(
reservation_map
A
)
:
=
λ
x
,
Global
Arguments
reservation_map_validN_instance
!
_
/.
Local
Instance
reservation_map_pcore_instance
:
PCore
(
reservation_map
A
)
:
=
λ
x
,
Some
(
ReservationMap
(
core
(
reservation_map_data_proj
x
))
ε
).
Local
Instance
reservation_map_op_instance
:
Op
(
reservation_map
A
)
:
=
λ
x
y
,
Local
Instance
reservation_map_op_instance
:
Op
(
reservation_map
A
)
:
=
λ
x
y
,
ReservationMap
(
reservation_map_data_proj
x
⋅
reservation_map_data_proj
y
)
(
reservation_map_token_proj
x
⋅
reservation_map_token_proj
y
).
Definition
reservation_map_valid_eq
:
Definition
reservation_map_valid_eq
:
valid
=
λ
x
,
match
reservation_map_token_proj
x
with
|
CoPset
E
=>
✓
(
reservation_map_data_proj
x
)
∧
...
...
@@ -129,7 +132,7 @@ Definition reservation_map_valid_eq :
∀
i
,
reservation_map_data_proj
x
!!
i
=
None
∨
i
∉
E
|
CoPsetBot
=>
False
end
:
=
eq_refl
_
.
Definition
reservation_map_validN_eq
:
Definition
reservation_map_validN_eq
:
validN
=
λ
n
x
,
match
reservation_map_token_proj
x
with
|
CoPset
E
=>
✓
{
n
}
(
reservation_map_data_proj
x
)
∧
...
...
@@ -138,22 +141,22 @@ Definition reservation_map_validN_eq :
|
CoPsetBot
=>
False
end
:
=
eq_refl
_
.
Lemma
reservation_map_included
x
y
:
Lemma
reservation_map_included
x
y
:
x
≼
y
↔
reservation_map_data_proj
x
≼
reservation_map_data_proj
y
∧
reservation_map_token_proj
x
≼
reservation_map_token_proj
y
.
Proof
.
Proof
.
split
;
[
intros
[[
z1
z2
]
Hz
]
;
split
;
[
exists
z1
|
exists
z2
]
;
apply
Hz
|].
intros
[[
z1
Hz1
]
[
z2
Hz2
]]
;
exists
(
ReservationMap
z1
z2
)
;
split
;
auto
.
Qed
.
Qed
.
Lemma
reservation_map_data_proj_validN
n
x
:
✓
{
n
}
x
→
✓
{
n
}
reservation_map_data_proj
x
.
Proof
.
by
destruct
x
as
[?
[?|]]=>
//
-[??].
Qed
.
Lemma
reservation_map_token_proj_validN
n
x
:
✓
{
n
}
x
→
✓
{
n
}
reservation_map_token_proj
x
.
Proof
.
by
destruct
x
as
[?
[?|]]=>
//
-[??].
Qed
.
Lemma
reservation_map_data_proj_validN
n
x
:
✓
{
n
}
x
→
✓
{
n
}
reservation_map_data_proj
x
.
Proof
.
by
destruct
x
as
[?
[?|]]=>
//
-[??].
Qed
.
Lemma
reservation_map_token_proj_validN
n
x
:
✓
{
n
}
x
→
✓
{
n
}
reservation_map_token_proj
x
.
Proof
.
by
destruct
x
as
[?
[?|]]=>
//
-[??].
Qed
.
Lemma
reservation_map_cmra_mixin
:
CmraMixin
(
reservation_map
A
).
Proof
.
Lemma
reservation_map_cmra_mixin
:
CmraMixin
(
reservation_map
A
).
Proof
.
apply
cmra_total_mixin
.
-
eauto
.
-
by
intros
n
x
y1
y2
[
Hy
Hy'
]
;
split
;
simpl
;
rewrite
?Hy
?Hy'
.
...
...
@@ -175,10 +178,7 @@ Proof.
rewrite
{
1
}/
op
/
cmra_op
/=.
case_decide
;
last
done
.
intros
[
Hm
Hdisj
]
;
split
;
first
by
eauto
using
cmra_validN_op_l
.
intros
i
.
move
:
(
Hdisj
i
).
rewrite
lookup_op
.
case
:
(
m1
!!
i
)=>
[
a
|]
;
last
auto
.
move
=>
[].
{
by
case
:
(
m2
!!
i
).
}
set_solver
.
case
:
(
m1
!!
i
)
;
case
:
(
m2
!!
i
)
;
set_solver
.
-
intros
n
x
y1
y2
?
[??]
;
simpl
in
*.
destruct
(
cmra_extend
n
(
reservation_map_data_proj
x
)
(
reservation_map_data_proj
y1
)
(
reservation_map_data_proj
y2
))
...
...
@@ -187,80 +187,80 @@ Proof.
(
reservation_map_token_proj
y1
)
(
reservation_map_token_proj
y2
))
as
(
E1
&
E2
&?&?&?)
;
auto
using
reservation_map_token_proj_validN
.
by
exists
(
ReservationMap
m1
E1
),
(
ReservationMap
m2
E2
).
Qed
.
Canonical
Structure
reservation_mapR
:
=
Qed
.
Canonical
Structure
reservation_mapR
:
=
Cmra
(
reservation_map
A
)
reservation_map_cmra_mixin
.
Global
Instance
reservation_map_cmra_discrete
:
Global
Instance
reservation_map_cmra_discrete
:
CmraDiscrete
A
→
CmraDiscrete
reservation_mapR
.
Proof
.
Proof
.
split
;
first
apply
_
.
intros
[
m
[
E
|]]
;
rewrite
reservation_map_validN_eq
reservation_map_valid_eq
//=.
by
intros
[?%
cmra_discrete_valid
?].
Qed
.
Qed
.
Local
Instance
reservation_map_empty_instance
:
Unit
(
reservation_map
A
)
:
=
ReservationMap
ε
ε
.
Lemma
reservation_map_ucmra_mixin
:
UcmraMixin
(
reservation_map
A
).
Proof
.
Local
Instance
reservation_map_empty_instance
:
Unit
(
reservation_map
A
)
:
=
ReservationMap
ε
ε
.
Lemma
reservation_map_ucmra_mixin
:
UcmraMixin
(
reservation_map
A
).
Proof
.
split
;
simpl
.
-
rewrite
reservation_map_valid_eq
/=.
split
;
[
apply
ucmra_unit_valid
|].
set_solver
.
-
split
;
simpl
;
[
by
rewrite
left_id
|
by
rewrite
left_id_L
].
-
do
2
constructor
;
[
apply
(
core_id_core
_
)|
done
].
Qed
.
Canonical
Structure
reservation_mapUR
:
=
Qed
.
Canonical
Structure
reservation_mapUR
:
=
Ucmra
(
reservation_map
A
)
reservation_map_ucmra_mixin
.
Global
Instance
reservation_map_data_core_id
N
a
:
Global
Instance
reservation_map_data_core_id
N
a
:
CoreId
a
→
CoreId
(
reservation_map_data
N
a
).
Proof
.
do
2
constructor
;
simpl
;
auto
.
apply
core_id_core
,
_
.
Qed
.
Proof
.
do
2
constructor
;
simpl
;
auto
.
apply
core_id_core
,
_
.
Qed
.
Lemma
reservation_map_data_valid
N
a
:
✓
(
reservation_map_data
N
a
)
↔
✓
a
.
Proof
.
rewrite
reservation_map_valid_eq
/=
singleton_valid
.
set_solver
.
Qed
.
Lemma
reservation_map_token_valid
E
:
✓
(
reservation_map_token
E
).
Proof
.
rewrite
reservation_map_valid_eq
/=.
split
;
first
done
.
by
left
.
Qed
.
Lemma
reservation_map_data_op
N
a
b
:
Lemma
reservation_map_data_valid
N
a
:
✓
(
reservation_map_data
N
a
)
↔
✓
a
.
Proof
.
rewrite
reservation_map_valid_eq
/=
singleton_valid
.
set_solver
.
Qed
.
Lemma
reservation_map_token_valid
E
:
✓
(
reservation_map_token
E
).
Proof
.
rewrite
reservation_map_valid_eq
/=.
split
;
first
done
.
by
left
.
Qed
.
Lemma
reservation_map_data_op
N
a
b
:
reservation_map_data
N
(
a
⋅
b
)
=
reservation_map_data
N
a
⋅
reservation_map_data
N
b
.
Proof
.
Proof
.
by
rewrite
{
2
}/
op
/
reservation_map_op_instance
/
reservation_map_data
/=
singleton_op
left_id_L
.
Qed
.
Lemma
reservation_map_data_mono
N
a
b
:
Qed
.
Lemma
reservation_map_data_mono
N
a
b
:
a
≼
b
→
reservation_map_data
N
a
≼
reservation_map_data
N
b
.
Proof
.
intros
[
c
->].
rewrite
reservation_map_data_op
.
apply
cmra_included_l
.
Qed
.
Global
Instance
reservation_map_data_is_op
N
a
b1
b2
:
Proof
.
intros
[
c
->].
rewrite
reservation_map_data_op
.
apply
cmra_included_l
.
Qed
.
Global
Instance
reservation_map_data_is_op
N
a
b1
b2
:
IsOp
a
b1
b2
→
IsOp'
(
reservation_map_data
N
a
)
(
reservation_map_data
N
b1
)
(
reservation_map_data
N
b2
).
Proof
.
rewrite
/
IsOp'
/
IsOp
=>
->.
by
rewrite
reservation_map_data_op
.
Qed
.
Proof
.
rewrite
/
IsOp'
/
IsOp
=>
->.
by
rewrite
reservation_map_data_op
.
Qed
.
Lemma
reservation_map_token_union
E1
E2
:
Lemma
reservation_map_token_union
E1
E2
:
E1
##
E2
→
reservation_map_token
(
E1
∪
E2
)
=
reservation_map_token
E1
⋅
reservation_map_token
E2
.
Proof
.
Proof
.
intros
.
by
rewrite
/
op
/
reservation_map_op_instance
/
reservation_map_token
/=
coPset_disj_union
//
left_id_L
.
Qed
.
Lemma
reservation_map_token_difference
E1
E2
:
Qed
.
Lemma
reservation_map_token_difference
E1
E2
:
E1
⊆
E2
→
reservation_map_token
E2
=
reservation_map_token
E1
⋅
reservation_map_token
(
E2
∖
E1
).
Proof
.
Proof
.
intros
.
rewrite
-
reservation_map_token_union
;
last
set_solver
.
by
rewrite
-
union_difference_L
.
Qed
.
Lemma
reservation_map_token_valid_op
E1
E2
:
Qed
.
Lemma
reservation_map_token_valid_op
E1
E2
:
✓
(
reservation_map_token
E1
⋅
reservation_map_token
E2
)
↔
E1
##
E2
.
Proof
.
Proof
.
rewrite
reservation_map_valid_eq
/=
{
1
}/
op
/
cmra_op
/=.
case_decide
;
last
done
.
split
;
[
done
|]
;
intros
_
.
split
.
-
by
rewrite
left_id
.
-
intros
i
.
rewrite
lookup_op
lookup_empty
.
auto
.
Qed
.
Qed
.
Lemma
reservation_map_alloc
E
k
a
:
Lemma
reservation_map_alloc
E
k
a
:
k
∈
E
→
✓
a
→
reservation_map_token
E
~~>
reservation_map_data
k
a
.
Proof
.
Proof
.
intros
??.
apply
cmra_total_update
=>
n
[
mf
[
Ef
|]]
//.
rewrite
reservation_map_validN_eq
/=
{
1
}/
op
/
cmra_op
/=.
case_decide
;
last
done
.
rewrite
left_id_L
{
1
}
left_id
.
intros
[
Hmf
Hdisj
]
;
split
.
-
destruct
(
Hdisj
(
k
)
)
as
[
Hmfi
|]
;
last
set_solver
.
-
destruct
(
Hdisj
k
)
as
[
Hmfi
|]
;
last
set_solver
.
move
:
Hmfi
.
rewrite
lookup_op
lookup_empty
left_id_L
=>
Hmfi
.
intros
j
.
rewrite
lookup_op
.
destruct
(
decide
(
k
=
j
))
as
[<-|].
...
...
@@ -270,11 +270,12 @@ Proof.
rewrite
lookup_op
lookup_singleton_ne
//.
destruct
(
Hdisj
j
)
as
[
Hmfi
|?]
;
last
set_solver
.
move
:
Hmfi
.
rewrite
lookup_op
lookup_empty
;
auto
.
Qed
.
Lemma
reservation_map_updateP
P
(
Q
:
reservation_map
A
→
Prop
)
k
a
:
Qed
.
Lemma
reservation_map_updateP
P
(
Q
:
reservation_map
A
→
Prop
)
k
a
:
a
~~>
:
P
→
(
∀
a'
,
P
a'
→
Q
(
reservation_map_data
k
a'
))
→
reservation_map_data
k
a
~~>
:
Q
.
Proof
.
(
∀
a'
,
P
a'
→
Q
(
reservation_map_data
k
a'
))
→
reservation_map_data
k
a
~~>
:
Q
.
Proof
.
intros
Hup
HP
.
apply
cmra_total_updateP
=>
n
[
mf
[
Ef
|]]
//.
rewrite
reservation_map_validN_eq
/=
left_id_L
.
intros
[
Hmf
Hdisj
].
destruct
(
Hup
n
(
mf
!!
k
))
as
(
a'
&?&?).
...
...
@@ -288,12 +289,13 @@ Proof.
move
:
(
Hmf
j
).
rewrite
lookup_op
.
eauto
using
cmra_validN_op_r
.
-
intros
j
.
move
:
(
Hdisj
j
).
rewrite
!
lookup_op
!
op_None
!
lookup_singleton_None
.
naive_solver
.
Qed
.
Lemma
reservation_map_update
k
a
b
:
a
~~>
b
→
reservation_map_data
k
a
~~>
reservation_map_data
k
b
.
Proof
.
Qed
.
Lemma
reservation_map_update
k
a
b
:
a
~~>
b
→
reservation_map_data
k
a
~~>
reservation_map_data
k
b
.
Proof
.
rewrite
!
cmra_update_updateP
.
eauto
using
reservation_map_updateP
with
subst
.
Qed
.
Qed
.
End
cmra
.
Global
Arguments
reservation_mapR
:
clear
implicits
.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment