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
293603b6
Commit
293603b6
authored
Jan 27, 2021
by
Ralf Jung
Browse files
FromPure instances for big_sepM
parent
79f2f36f
Changes
2
Hide whitespace changes
Inline
Side-by-side
iris/bi/big_op.v
View file @
293603b6
...
@@ -1153,6 +1153,37 @@ Section map.
...
@@ -1153,6 +1153,37 @@ Section map.
⊢
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
∧
([
∗
map
]
k
↦
x
∈
m
,
Ψ
k
x
).
⊢
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
∧
([
∗
map
]
k
↦
x
∈
m
,
Ψ
k
x
).
Proof
.
auto
using
and_intro
,
big_sepM_mono
,
and_elim_l
,
and_elim_r
.
Qed
.
Proof
.
auto
using
and_intro
,
big_sepM_mono
,
and_elim_l
,
and_elim_r
.
Qed
.
Lemma
big_sepM_pure_1
(
φ
:
K
→
A
→
Prop
)
m
:
([
∗
map
]
k
↦
x
∈
m
,
⌜φ
k
x
⌝
)
⊢
@{
PROP
}
⌜
map_Forall
φ
m
⌝
.
Proof
.
induction
m
using
map_ind
;
simpl
.
-
rewrite
pure_True
;
first
by
apply
True_intro
.
apply
map_Forall_empty
.
-
rewrite
->
big_sepM_insert
by
auto
.
rewrite
->
map_Forall_insert
by
auto
.
rewrite
IHm
sep_and
-
pure_and
.
apply
pure_mono
.
done
.
Qed
.
Lemma
big_sepM_affinely_pure_2
(
φ
:
K
→
A
→
Prop
)
m
:
<
affine
>
⌜
map_Forall
φ
m
⌝
⊢
@{
PROP
}
([
∗
map
]
k
↦
x
∈
m
,
<
affine
>
⌜φ
k
x
⌝
).
Proof
.
induction
m
using
map_ind
;
simpl
.
-
rewrite
big_sepM_empty
.
apply
affinely_elim_emp
.
-
rewrite
->
big_sepM_insert
by
auto
.
rewrite
->
map_Forall_insert
by
auto
.
rewrite
pure_and
affinely_and
IHm
persistent_and_sep_1
.
done
.
Qed
.
(** The general backwards direction requires [BiAffine] to cover the empty case. *)
Lemma
big_sepM_pure
`
{!
BiAffine
PROP
}
(
φ
:
K
→
A
→
Prop
)
m
:
([
∗
map
]
k
↦
x
∈
m
,
⌜φ
k
x
⌝
)
⊣
⊢
@{
PROP
}
⌜
map_Forall
φ
m
⌝
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
first
by
apply
big_sepM_pure_1
.
rewrite
-(
affine_affinely
(
⌜
map_Forall
φ
m
⌝
)%
I
).
rewrite
big_sepM_affinely_pure_2
.
apply
big_sepM_mono
=>???.
rewrite
affine_affinely
.
done
.
Qed
.
Lemma
big_sepM_persistently
`
{
BiAffine
PROP
}
Φ
m
:
Lemma
big_sepM_persistently
`
{
BiAffine
PROP
}
Φ
m
:
(<
pers
>
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
))
⊣
⊢
([
∗
map
]
k
↦
x
∈
m
,
<
pers
>
(
Φ
k
x
)).
(<
pers
>
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
))
⊣
⊢
([
∗
map
]
k
↦
x
∈
m
,
<
pers
>
(
Φ
k
x
)).
Proof
.
apply
(
big_opM_commute
_
).
Qed
.
Proof
.
apply
(
big_opM_commute
_
).
Qed
.
...
@@ -1255,6 +1286,7 @@ Section map.
...
@@ -1255,6 +1286,7 @@ Section map.
Global
Instance
big_sepM_timeless
`
{!
Timeless
(
emp
%
I
:
PROP
)}
Φ
m
:
Global
Instance
big_sepM_timeless
`
{!
Timeless
(
emp
%
I
:
PROP
)}
Φ
m
:
(
∀
k
x
,
Timeless
(
Φ
k
x
))
→
Timeless
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
).
(
∀
k
x
,
Timeless
(
Φ
k
x
))
→
Timeless
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
).
Proof
.
rewrite
big_opM_eq
.
intros
.
apply
big_sepL_timeless
=>
_
[??]
;
apply
_
.
Qed
.
Proof
.
rewrite
big_opM_eq
.
intros
.
apply
big_sepL_timeless
=>
_
[??]
;
apply
_
.
Qed
.
End
map
.
End
map
.
(* Some lemmas depend on the generalized versions of the above ones. *)
(* Some lemmas depend on the generalized versions of the above ones. *)
...
...
iris/proofmode/class_instances.v
View file @
293603b6
...
@@ -198,6 +198,14 @@ Global Instance into_pure_persistently P φ :
...
@@ -198,6 +198,14 @@ Global Instance into_pure_persistently P φ :
IntoPure
P
φ
→
IntoPure
(<
pers
>
P
)
φ
.
IntoPure
P
φ
→
IntoPure
(<
pers
>
P
)
φ
.
Proof
.
rewrite
/
IntoPure
=>
->.
apply
:
persistently_elim
.
Qed
.
Proof
.
rewrite
/
IntoPure
=>
->.
apply
:
persistently_elim
.
Qed
.
Global
Instance
into_pure_big_sepM
{
K
A
}
`
{
Countable
K
}
(
Φ
:
K
→
A
→
PROP
)
(
φ
:
K
→
A
→
Prop
)
(
m
:
gmap
K
A
)
:
(
∀
k
v
,
IntoPure
(
Φ
k
v
)
(
φ
k
v
))
→
IntoPure
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
(
map_Forall
φ
m
).
Proof
.
rewrite
/
IntoPure
.
intros
H
Φ
.
setoid_rewrite
H
Φ
.
rewrite
big_sepM_pure_1
.
done
.
Qed
.
(** FromPure *)
(** FromPure *)
Global
Instance
from_pure_emp
:
@
FromPure
PROP
true
emp
True
.
Global
Instance
from_pure_emp
:
@
FromPure
PROP
true
emp
True
.
Proof
.
rewrite
/
FromPure
/=.
apply
(
affine
_
).
Qed
.
Proof
.
rewrite
/
FromPure
/=.
apply
(
affine
_
).
Qed
.
...
@@ -289,6 +297,20 @@ Proof.
...
@@ -289,6 +297,20 @@ Proof.
by
rewrite
-
persistent_absorbingly_affinely_2
.
by
rewrite
-
persistent_absorbingly_affinely_2
.
Qed
.
Qed
.
Global
Instance
from_pure_big_sepM
{
K
A
}
`
{
Countable
K
}
a
(
Φ
:
K
→
A
→
PROP
)
(
φ
:
K
→
A
→
Prop
)
(
m
:
gmap
K
A
)
:
(
∀
k
v
,
FromPure
a
(
Φ
k
v
)
(
φ
k
v
))
→
TCOr
(
TCEq
a
true
)
(
BiAffine
PROP
)
→
FromPure
a
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
(
map_Forall
φ
m
).
Proof
.
rewrite
/
FromPure
.
destruct
a
;
simpl
;
intros
H
Φ
Haffine
.
-
rewrite
big_sepM_affinely_pure_2
.
setoid_rewrite
H
Φ
.
done
.
-
destruct
Haffine
as
[?%
TCEq_eq
|?]
;
first
done
.
rewrite
-
big_sepM_pure
.
setoid_rewrite
H
Φ
.
done
.
Qed
.
(** IntoPersistent *)
(** IntoPersistent *)
Global
Instance
into_persistent_persistently
p
P
Q
:
Global
Instance
into_persistent_persistently
p
P
Q
:
IntoPersistent
true
P
Q
→
IntoPersistent
p
(<
pers
>
P
)
Q
|
0
.
IntoPersistent
true
P
Q
→
IntoPersistent
p
(<
pers
>
P
)
Q
|
0
.
...
...
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