Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Rodolphe Lepigre
Iris
Commits
b4567fbd
Commit
b4567fbd
authored
Oct 22, 2017
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `always` → `persistently` (the persistent modality).
parent
0ad1d2bd
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
311 additions
and
310 deletions
+311
-310
theories/base_logic/base_logic.v
theories/base_logic/base_logic.v
+1
-1
theories/base_logic/big_op.v
theories/base_logic/big_op.v
+20
-20
theories/base_logic/derived.v
theories/base_logic/derived.v
+148
-148
theories/base_logic/lib/fractional.v
theories/base_logic/lib/fractional.v
+4
-4
theories/base_logic/lib/iprop.v
theories/base_logic/lib/iprop.v
+1
-1
theories/base_logic/lib/own.v
theories/base_logic/lib/own.v
+1
-1
theories/base_logic/lib/viewshifts.v
theories/base_logic/lib/viewshifts.v
+1
-1
theories/base_logic/primitive.v
theories/base_logic/primitive.v
+19
-19
theories/program_logic/hoare.v
theories/program_logic/hoare.v
+1
-1
theories/program_logic/weakestpre.v
theories/program_logic/weakestpre.v
+1
-1
theories/proofmode/class_instances.v
theories/proofmode/class_instances.v
+65
-64
theories/proofmode/classes.v
theories/proofmode/classes.v
+3
-3
theories/proofmode/coq_tactics.v
theories/proofmode/coq_tactics.v
+42
-42
theories/proofmode/tactics.v
theories/proofmode/tactics.v
+3
-3
theories/tests/proofmode.v
theories/tests/proofmode.v
+1
-1
No files found.
theories/base_logic/base_logic.v
View file @
b4567fbd
...
...
@@ -11,7 +11,7 @@ End uPred.
Hint
Resolve
pure_intro
.
Hint
Resolve
or_elim
or_intro_l'
or_intro_r'
:
I
.
Hint
Resolve
and_intro
and_elim_l'
and_elim_r'
:
I
.
Hint
Resolve
always
_mono
:
I
.
Hint
Resolve
persistently
_mono
:
I
.
Hint
Resolve
sep_elim_l'
sep_elim_r'
sep_mono
:
I
.
Hint
Immediate
True_intro
False_elim
:
I
.
Hint
Immediate
iff_refl
internal_eq_refl'
:
I
.
theories/base_logic/big_op.v
View file @
b4567fbd
...
...
@@ -117,11 +117,11 @@ Section list.
▷
^
n
([
∗
list
]
k
↦
x
∈
l
,
Φ
k
x
)
⊣
⊢
([
∗
list
]
k
↦
x
∈
l
,
▷
^
n
Φ
k
x
).
Proof
.
apply
(
big_opL_commute
_
).
Qed
.
Lemma
big_sepL_
always
Φ
l
:
Lemma
big_sepL_
persistently
Φ
l
:
(
□
[
∗
list
]
k
↦
x
∈
l
,
Φ
k
x
)
⊣
⊢
([
∗
list
]
k
↦
x
∈
l
,
□
Φ
k
x
).
Proof
.
apply
(
big_opL_commute
_
).
Qed
.
Lemma
big_sepL_
always
_if
p
Φ
l
:
Lemma
big_sepL_
persistently
_if
p
Φ
l
:
□
?p
([
∗
list
]
k
↦
x
∈
l
,
Φ
k
x
)
⊣
⊢
([
∗
list
]
k
↦
x
∈
l
,
□
?p
Φ
k
x
).
Proof
.
apply
(
big_opL_commute
_
).
Qed
.
...
...
@@ -134,7 +134,7 @@ Section list.
apply
impl_intro_l
,
pure_elim_l
=>
?
;
by
apply
big_sepL_lookup
.
}
revert
Φ
H
Φ
.
induction
l
as
[|
x
l
IH
]=>
Φ
H
Φ
.
{
rewrite
big_sepL_nil
;
auto
with
I
.
}
rewrite
big_sepL_cons
.
rewrite
-
always
_and_sep_l
;
apply
and_intro
.
rewrite
big_sepL_cons
.
rewrite
-
persistently
_and_sep_l
;
apply
and_intro
.
-
by
rewrite
(
forall_elim
0
)
(
forall_elim
x
)
pure_True
//
True_impl
.
-
rewrite
-
IH
.
apply
forall_intro
=>
k
;
by
rewrite
(
forall_elim
(
S
k
)).
Qed
.
...
...
@@ -143,10 +143,10 @@ Section list.
□
(
∀
k
x
,
⌜
l
!!
k
=
Some
x
⌝
→
Φ
k
x
→
Ψ
k
x
)
∧
([
∗
list
]
k
↦
x
∈
l
,
Φ
k
x
)
⊢
[
∗
list
]
k
↦
x
∈
l
,
Ψ
k
x
.
Proof
.
rewrite
always
_and_sep_l
.
do
2
setoid_rewrite
always
_forall
.
setoid_rewrite
always
_impl
;
setoid_rewrite
always
_pure
.
rewrite
persistently
_and_sep_l
.
do
2
setoid_rewrite
persistently
_forall
.
setoid_rewrite
persistently
_impl
;
setoid_rewrite
persistently
_pure
.
rewrite
-
big_sepL_forall
-
big_sepL_sepL
.
apply
big_sepL_mono
;
auto
=>
k
x
?.
by
rewrite
-
always_wand_impl
always
_elim
wand_elim_l
.
by
rewrite
-
persistently_wand_impl
persistently
_elim
wand_elim_l
.
Qed
.
Global
Instance
big_sepL_nil_persistent
Φ
:
...
...
@@ -307,11 +307,11 @@ Section gmap.
▷
^
n
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
⊣
⊢
([
∗
map
]
k
↦
x
∈
m
,
▷
^
n
Φ
k
x
).
Proof
.
apply
(
big_opM_commute
_
).
Qed
.
Lemma
big_sepM_
always
Φ
m
:
Lemma
big_sepM_
persistently
Φ
m
:
(
□
[
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
⊣
⊢
([
∗
map
]
k
↦
x
∈
m
,
□
Φ
k
x
).
Proof
.
apply
(
big_opM_commute
_
).
Qed
.
Lemma
big_sepM_
always
_if
p
Φ
m
:
Lemma
big_sepM_
persistently
_if
p
Φ
m
:
□
?p
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
⊣
⊢
([
∗
map
]
k
↦
x
∈
m
,
□
?p
Φ
k
x
).
Proof
.
apply
(
big_opM_commute
_
).
Qed
.
...
...
@@ -323,7 +323,7 @@ Section gmap.
{
apply
forall_intro
=>
k
;
apply
forall_intro
=>
x
.
apply
impl_intro_l
,
pure_elim_l
=>
?
;
by
apply
big_sepM_lookup
.
}
induction
m
as
[|
i
x
m
?
IH
]
using
map_ind
;
[
rewrite
?big_sepM_empty
;
auto
|].
rewrite
big_sepM_insert
//
-
always
_and_sep_l
.
apply
and_intro
.
rewrite
big_sepM_insert
//
-
persistently
_and_sep_l
.
apply
and_intro
.
-
rewrite
(
forall_elim
i
)
(
forall_elim
x
)
lookup_insert
.
by
rewrite
pure_True
//
True_impl
.
-
rewrite
-
IH
.
apply
forall_mono
=>
k
;
apply
forall_mono
=>
y
.
...
...
@@ -336,10 +336,10 @@ Section gmap.
□
(
∀
k
x
,
⌜
m
!!
k
=
Some
x
⌝
→
Φ
k
x
→
Ψ
k
x
)
∧
([
∗
map
]
k
↦
x
∈
m
,
Φ
k
x
)
⊢
[
∗
map
]
k
↦
x
∈
m
,
Ψ
k
x
.
Proof
.
rewrite
always
_and_sep_l
.
do
2
setoid_rewrite
always
_forall
.
setoid_rewrite
always
_impl
;
setoid_rewrite
always
_pure
.
rewrite
persistently
_and_sep_l
.
do
2
setoid_rewrite
persistently
_forall
.
setoid_rewrite
persistently
_impl
;
setoid_rewrite
persistently
_pure
.
rewrite
-
big_sepM_forall
-
big_sepM_sepM
.
apply
big_sepM_mono
;
auto
=>
k
x
?.
by
rewrite
-
always_wand_impl
always
_elim
wand_elim_l
.
by
rewrite
-
persistently_wand_impl
persistently
_elim
wand_elim_l
.
Qed
.
Global
Instance
big_sepM_empty_persistent
Φ
:
...
...
@@ -460,10 +460,10 @@ Section gset.
▷
^
n
([
∗
set
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
set
]
y
∈
X
,
▷
^
n
Φ
y
).
Proof
.
apply
(
big_opS_commute
_
).
Qed
.
Lemma
big_sepS_
always
Φ
X
:
□
([
∗
set
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
set
]
y
∈
X
,
□
Φ
y
).
Lemma
big_sepS_
persistently
Φ
X
:
□
([
∗
set
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
set
]
y
∈
X
,
□
Φ
y
).
Proof
.
apply
(
big_opS_commute
_
).
Qed
.
Lemma
big_sepS_
always
_if
q
Φ
X
:
Lemma
big_sepS_
persistently
_if
q
Φ
X
:
□
?q
([
∗
set
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
set
]
y
∈
X
,
□
?q
Φ
y
).
Proof
.
apply
(
big_opS_commute
_
).
Qed
.
...
...
@@ -475,7 +475,7 @@ Section gset.
apply
impl_intro_l
,
pure_elim_l
=>
?
;
by
apply
big_sepS_elem_of
.
}
induction
X
as
[|
x
X
?
IH
]
using
collection_ind_L
.
{
rewrite
big_sepS_empty
;
auto
.
}
rewrite
big_sepS_insert
//
-
always
_and_sep_l
.
apply
and_intro
.
rewrite
big_sepS_insert
//
-
persistently
_and_sep_l
.
apply
and_intro
.
-
by
rewrite
(
forall_elim
x
)
pure_True
?True_impl
;
last
set_solver
.
-
rewrite
-
IH
.
apply
forall_mono
=>
y
.
apply
impl_intro_l
,
pure_elim_l
=>
?.
by
rewrite
pure_True
?True_impl
;
last
set_solver
.
...
...
@@ -484,10 +484,10 @@ Section gset.
Lemma
big_sepS_impl
Φ
Ψ
X
:
□
(
∀
x
,
⌜
x
∈
X
⌝
→
Φ
x
→
Ψ
x
)
∧
([
∗
set
]
x
∈
X
,
Φ
x
)
⊢
[
∗
set
]
x
∈
X
,
Ψ
x
.
Proof
.
rewrite
always_and_sep_l
always
_forall
.
setoid_rewrite
always
_impl
;
setoid_rewrite
always
_pure
.
rewrite
persistently_and_sep_l
persistently
_forall
.
setoid_rewrite
persistently
_impl
;
setoid_rewrite
persistently
_pure
.
rewrite
-
big_sepS_forall
-
big_sepS_sepS
.
apply
big_sepS_mono
;
auto
=>
x
?.
by
rewrite
-
always_wand_impl
always
_elim
wand_elim_l
.
by
rewrite
-
persistently_wand_impl
persistently
_elim
wand_elim_l
.
Qed
.
Global
Instance
big_sepS_empty_persistent
Φ
:
Persistent
([
∗
set
]
x
∈
∅
,
Φ
x
).
...
...
@@ -571,10 +571,10 @@ Section gmultiset.
▷
^
n
([
∗
mset
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
mset
]
y
∈
X
,
▷
^
n
Φ
y
).
Proof
.
apply
(
big_opMS_commute
_
).
Qed
.
Lemma
big_sepMS_
always
Φ
X
:
□
([
∗
mset
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
mset
]
y
∈
X
,
□
Φ
y
).
Lemma
big_sepMS_
persistently
Φ
X
:
□
([
∗
mset
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
mset
]
y
∈
X
,
□
Φ
y
).
Proof
.
apply
(
big_opMS_commute
_
).
Qed
.
Lemma
big_sepMS_
always
_if
q
Φ
X
:
Lemma
big_sepMS_
persistently
_if
q
Φ
X
:
□
?q
([
∗
mset
]
y
∈
X
,
Φ
y
)
⊣
⊢
([
∗
mset
]
y
∈
X
,
□
?q
Φ
y
).
Proof
.
apply
(
big_opMS_commute
_
).
Qed
.
...
...
theories/base_logic/derived.v
View file @
b4567fbd
...
...
@@ -16,11 +16,11 @@ Notation "▷? p P" := (uPred_laterN (Nat.b2n p) P)
(
at
level
20
,
p
at
level
9
,
P
at
level
20
,
format
"▷? p P"
)
:
uPred_scope
.
Definition
uPred_
always
_if
{
M
}
(
p
:
bool
)
(
P
:
uPred
M
)
:
uPred
M
:
=
Definition
uPred_
persistently
_if
{
M
}
(
p
:
bool
)
(
P
:
uPred
M
)
:
uPred
M
:
=
(
if
p
then
□
P
else
P
)%
I
.
Instance
:
Params
(@
uPred_
always
_if
)
2
.
Arguments
uPred_
always
_if
_
!
_
_
/.
Notation
"□? p P"
:
=
(
uPred_
always
_if
p
P
)
Instance
:
Params
(@
uPred_
persistently
_if
)
2
.
Arguments
uPred_
persistently
_if
_
!
_
_
/.
Notation
"□? p P"
:
=
(
uPred_
persistently
_if
p
P
)
(
at
level
20
,
p
at
level
9
,
P
at
level
20
,
format
"□? p P"
).
Definition
uPred_except_0
{
M
}
(
P
:
uPred
M
)
:
uPred
M
:
=
▷
False
∨
P
.
...
...
@@ -472,105 +472,105 @@ Lemma sep_forall_r {A} (Φ : A → uPred M) Q : (∀ a, Φ a) ∗ Q ⊢ ∀ a,
Proof
.
by
apply
forall_intro
=>
a
;
rewrite
forall_elim
.
Qed
.
(* Always derived *)
Hint
Resolve
always_mono
always
_elim
.
Global
Instance
always
_mono'
:
Proper
((
⊢
)
==>
(
⊢
))
(@
uPred_
always
M
).
Proof
.
intros
P
Q
;
apply
always
_mono
.
Qed
.
Global
Instance
always
_flip_mono'
:
Proper
(
flip
(
⊢
)
==>
flip
(
⊢
))
(@
uPred_
always
M
).
Proof
.
intros
P
Q
;
apply
always
_mono
.
Qed
.
Hint
Resolve
persistently_mono
persistently
_elim
.
Global
Instance
persistently
_mono'
:
Proper
((
⊢
)
==>
(
⊢
))
(@
uPred_
persistently
M
).
Proof
.
intros
P
Q
;
apply
persistently
_mono
.
Qed
.
Global
Instance
persistently
_flip_mono'
:
Proper
(
flip
(
⊢
)
==>
flip
(
⊢
))
(@
uPred_
persistently
M
).
Proof
.
intros
P
Q
;
apply
persistently
_mono
.
Qed
.
Lemma
always
_intro'
P
Q
:
(
□
P
⊢
Q
)
→
□
P
⊢
□
Q
.
Proof
.
intros
<-.
apply
always
_idemp_2
.
Qed
.
Lemma
always
_idemp
P
:
□
□
P
⊣
⊢
□
P
.
Proof
.
apply
(
anti_symm
_
)
;
auto
using
always
_idemp_2
.
Qed
.
Lemma
persistently
_intro'
P
Q
:
(
□
P
⊢
Q
)
→
□
P
⊢
□
Q
.
Proof
.
intros
<-.
apply
persistently
_idemp_2
.
Qed
.
Lemma
persistently
_idemp
P
:
□
□
P
⊣
⊢
□
P
.
Proof
.
apply
(
anti_symm
_
)
;
auto
using
persistently
_idemp_2
.
Qed
.
Lemma
always
_pure
φ
:
□
⌜φ⌝
⊣
⊢
⌜φ⌝
.
Lemma
persistently
_pure
φ
:
□
⌜φ⌝
⊣
⊢
⌜φ⌝
.
Proof
.
apply
(
anti_symm
_
)
;
auto
.
apply
pure_elim'
=>
H
φ
.
trans
(
∀
x
:
False
,
□
True
:
uPred
M
)%
I
;
[
by
apply
forall_intro
|].
rewrite
always
_forall_2
.
auto
using
always
_mono
,
pure_intro
.
rewrite
persistently
_forall_2
.
auto
using
persistently
_mono
,
pure_intro
.
Qed
.
Lemma
always
_forall
{
A
}
(
Ψ
:
A
→
uPred
M
)
:
(
□
∀
a
,
Ψ
a
)
⊣
⊢
(
∀
a
,
□
Ψ
a
).
Lemma
persistently
_forall
{
A
}
(
Ψ
:
A
→
uPred
M
)
:
(
□
∀
a
,
Ψ
a
)
⊣
⊢
(
∀
a
,
□
Ψ
a
).
Proof
.
apply
(
anti_symm
_
)
;
auto
using
always
_forall_2
.
apply
(
anti_symm
_
)
;
auto
using
persistently
_forall_2
.
apply
forall_intro
=>
x
.
by
rewrite
(
forall_elim
x
).
Qed
.
Lemma
always
_exist
{
A
}
(
Ψ
:
A
→
uPred
M
)
:
(
□
∃
a
,
Ψ
a
)
⊣
⊢
(
∃
a
,
□
Ψ
a
).
Lemma
persistently
_exist
{
A
}
(
Ψ
:
A
→
uPred
M
)
:
(
□
∃
a
,
Ψ
a
)
⊣
⊢
(
∃
a
,
□
Ψ
a
).
Proof
.
apply
(
anti_symm
_
)
;
auto
using
always
_exist_1
.
apply
(
anti_symm
_
)
;
auto
using
persistently
_exist_1
.
apply
exist_elim
=>
x
.
by
rewrite
(
exist_intro
x
).
Qed
.
Lemma
always
_and
P
Q
:
□
(
P
∧
Q
)
⊣
⊢
□
P
∧
□
Q
.
Proof
.
rewrite
!
and_alt
always
_forall
.
by
apply
forall_proper
=>
-[].
Qed
.
Lemma
always
_or
P
Q
:
□
(
P
∨
Q
)
⊣
⊢
□
P
∨
□
Q
.
Proof
.
rewrite
!
or_alt
always
_exist
.
by
apply
exist_proper
=>
-[].
Qed
.
Lemma
always
_impl
P
Q
:
□
(
P
→
Q
)
⊢
□
P
→
□
Q
.
Lemma
persistently
_and
P
Q
:
□
(
P
∧
Q
)
⊣
⊢
□
P
∧
□
Q
.
Proof
.
rewrite
!
and_alt
persistently
_forall
.
by
apply
forall_proper
=>
-[].
Qed
.
Lemma
persistently
_or
P
Q
:
□
(
P
∨
Q
)
⊣
⊢
□
P
∨
□
Q
.
Proof
.
rewrite
!
or_alt
persistently
_exist
.
by
apply
exist_proper
=>
-[].
Qed
.
Lemma
persistently
_impl
P
Q
:
□
(
P
→
Q
)
⊢
□
P
→
□
Q
.
Proof
.
apply
impl_intro_l
;
rewrite
-
always
_and
.
apply
always
_mono
,
impl_elim
with
P
;
auto
.
apply
impl_intro_l
;
rewrite
-
persistently
_and
.
apply
persistently
_mono
,
impl_elim
with
P
;
auto
.
Qed
.
Lemma
always
_internal_eq
{
A
:
ofeT
}
(
a
b
:
A
)
:
□
(
a
≡
b
)
⊣
⊢
a
≡
b
.
Lemma
persistently
_internal_eq
{
A
:
ofeT
}
(
a
b
:
A
)
:
□
(
a
≡
b
)
⊣
⊢
a
≡
b
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
using
always
_elim
.
apply
(
anti_symm
(
⊢
))
;
auto
using
persistently
_elim
.
apply
(
internal_eq_rewrite
a
b
(
λ
b
,
□
(
a
≡
b
))%
I
)
;
auto
.
{
intros
n
;
solve_proper
.
}
rewrite
-(
internal_eq_refl
a
)
always
_pure
;
auto
.
rewrite
-(
internal_eq_refl
a
)
persistently
_pure
;
auto
.
Qed
.
Lemma
always
_and_sep_l'
P
Q
:
□
P
∧
Q
⊣
⊢
□
P
∗
Q
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
using
always
_and_sep_l_1
.
Qed
.
Lemma
always
_and_sep_r'
P
Q
:
P
∧
□
Q
⊣
⊢
P
∗
□
Q
.
Proof
.
by
rewrite
!(
comm
_
P
)
always
_and_sep_l'
.
Qed
.
Lemma
always
_sep_dup'
P
:
□
P
⊣
⊢
□
P
∗
□
P
.
Proof
.
by
rewrite
-
always
_and_sep_l'
idemp
.
Qed
.
Lemma
persistently
_and_sep_l'
P
Q
:
□
P
∧
Q
⊣
⊢
□
P
∗
Q
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
using
persistently
_and_sep_l_1
.
Qed
.
Lemma
persistently
_and_sep_r'
P
Q
:
P
∧
□
Q
⊣
⊢
P
∗
□
Q
.
Proof
.
by
rewrite
!(
comm
_
P
)
persistently
_and_sep_l'
.
Qed
.
Lemma
persistently
_sep_dup'
P
:
□
P
⊣
⊢
□
P
∗
□
P
.
Proof
.
by
rewrite
-
persistently
_and_sep_l'
idemp
.
Qed
.
Lemma
always
_and_sep
P
Q
:
□
(
P
∧
Q
)
⊣
⊢
□
(
P
∗
Q
).
Lemma
persistently
_and_sep
P
Q
:
□
(
P
∧
Q
)
⊣
⊢
□
(
P
∗
Q
).
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
.
rewrite
-{
1
}
always_idemp
always_and
always
_and_sep_l'
;
auto
.
rewrite
-{
1
}
persistently_idemp
persistently_and
persistently
_and_sep_l'
;
auto
.
Qed
.
Lemma
always
_sep
P
Q
:
□
(
P
∗
Q
)
⊣
⊢
□
P
∗
□
Q
.
Proof
.
by
rewrite
-
always_and_sep
-
always_and_sep_l'
always
_and
.
Qed
.
Lemma
persistently
_sep
P
Q
:
□
(
P
∗
Q
)
⊣
⊢
□
P
∗
□
Q
.
Proof
.
by
rewrite
-
persistently_and_sep
-
persistently_and_sep_l'
persistently
_and
.
Qed
.
Lemma
always
_wand
P
Q
:
□
(
P
-
∗
Q
)
⊢
□
P
-
∗
□
Q
.
Proof
.
by
apply
wand_intro_r
;
rewrite
-
always
_sep
wand_elim_l
.
Qed
.
Lemma
always
_wand_impl
P
Q
:
□
(
P
-
∗
Q
)
⊣
⊢
□
(
P
→
Q
).
Lemma
persistently
_wand
P
Q
:
□
(
P
-
∗
Q
)
⊢
□
P
-
∗
□
Q
.
Proof
.
by
apply
wand_intro_r
;
rewrite
-
persistently
_sep
wand_elim_l
.
Qed
.
Lemma
persistently
_wand_impl
P
Q
:
□
(
P
-
∗
Q
)
⊣
⊢
□
(
P
→
Q
).
Proof
.
apply
(
anti_symm
(
⊢
))
;
[|
by
rewrite
-
impl_wand
].
apply
always
_intro'
,
impl_intro_r
.
by
rewrite
always_and_sep_l'
always
_elim
wand_elim_l
.
apply
persistently
_intro'
,
impl_intro_r
.
by
rewrite
persistently_and_sep_l'
persistently
_elim
wand_elim_l
.
Qed
.
Lemma
wand_impl_
always
P
Q
:
((
□
P
)
-
∗
Q
)
⊣
⊢
((
□
P
)
→
Q
).
Lemma
wand_impl_
persistently
P
Q
:
((
□
P
)
-
∗
Q
)
⊣
⊢
((
□
P
)
→
Q
).
Proof
.
apply
(
anti_symm
(
⊢
))
;
[|
by
rewrite
-
impl_wand
].
apply
impl_intro_l
.
by
rewrite
always
_and_sep_l'
wand_elim_r
.
apply
impl_intro_l
.
by
rewrite
persistently
_and_sep_l'
wand_elim_r
.
Qed
.
Lemma
always
_entails_l'
P
Q
:
(
P
⊢
□
Q
)
→
P
⊢
□
Q
∗
P
.
Proof
.
intros
;
rewrite
-
always
_and_sep_l'
;
auto
.
Qed
.
Lemma
always
_entails_r'
P
Q
:
(
P
⊢
□
Q
)
→
P
⊢
P
∗
□
Q
.
Proof
.
intros
;
rewrite
-
always
_and_sep_r'
;
auto
.
Qed
.
Lemma
persistently
_entails_l'
P
Q
:
(
P
⊢
□
Q
)
→
P
⊢
□
Q
∗
P
.
Proof
.
intros
;
rewrite
-
persistently
_and_sep_l'
;
auto
.
Qed
.
Lemma
persistently
_entails_r'
P
Q
:
(
P
⊢
□
Q
)
→
P
⊢
P
∗
□
Q
.
Proof
.
intros
;
rewrite
-
persistently
_and_sep_r'
;
auto
.
Qed
.
Lemma
always
_laterN
n
P
:
□
▷
^
n
P
⊣
⊢
▷
^
n
□
P
.
Proof
.
induction
n
as
[|
n
IH
]
;
simpl
;
auto
.
by
rewrite
always
_later
IH
.
Qed
.
Lemma
persistently
_laterN
n
P
:
□
▷
^
n
P
⊣
⊢
▷
^
n
□
P
.
Proof
.
induction
n
as
[|
n
IH
]
;
simpl
;
auto
.
by
rewrite
persistently
_later
IH
.
Qed
.
Lemma
wand_alt
P
Q
:
(
P
-
∗
Q
)
⊣
⊢
∃
R
,
R
∗
□
(
P
∗
R
→
Q
).
Proof
.
apply
(
anti_symm
(
⊢
)).
-
rewrite
-(
right_id
True
%
I
uPred_sep
(
P
-
∗
Q
)%
I
)
-(
exist_intro
(
P
-
∗
Q
)%
I
).
apply
sep_mono_r
.
rewrite
-
always
_pure
.
apply
always
_mono
,
impl_intro_l
.
apply
sep_mono_r
.
rewrite
-
persistently
_pure
.
apply
persistently
_mono
,
impl_intro_l
.
by
rewrite
wand_elim_r
right_id
.
-
apply
exist_elim
=>
R
.
apply
wand_intro_l
.
rewrite
assoc
-
always
_and_sep_r'
.
by
rewrite
always
_elim
impl_elim_r
.
-
apply
exist_elim
=>
R
.
apply
wand_intro_l
.
rewrite
assoc
-
persistently
_and_sep_r'
.
by
rewrite
persistently
_elim
impl_elim_r
.
Qed
.
Lemma
impl_alt
P
Q
:
(
P
→
Q
)
⊣
⊢
∃
R
,
R
∧
□
(
P
∧
R
-
∗
Q
).
Proof
.
apply
(
anti_symm
(
⊢
)).
-
rewrite
-(
right_id
True
%
I
uPred_and
(
P
→
Q
)%
I
)
-(
exist_intro
(
P
→
Q
)%
I
).
apply
and_mono_r
.
rewrite
-
always
_pure
.
apply
always
_mono
,
wand_intro_l
.
apply
and_mono_r
.
rewrite
-
persistently
_pure
.
apply
persistently
_mono
,
wand_intro_l
.
by
rewrite
impl_elim_r
right_id
.
-
apply
exist_elim
=>
R
.
apply
impl_intro_l
.
rewrite
assoc
always
_and_sep_r'
.
by
rewrite
always
_elim
wand_elim_r
.
-
apply
exist_elim
=>
R
.
apply
impl_intro_l
.
rewrite
assoc
persistently
_and_sep_r'
.
by
rewrite
persistently
_elim
wand_elim_r
.
Qed
.
(* Later derived *)
...
...
@@ -671,33 +671,33 @@ Qed.
Lemma
laterN_iff
n
P
Q
:
▷
^
n
(
P
↔
Q
)
⊢
▷
^
n
P
↔
▷
^
n
Q
.
Proof
.
by
rewrite
/
uPred_iff
laterN_and
!
laterN_impl
.
Qed
.
(* Conditional
always
*)
Global
Instance
always
_if_ne
p
:
NonExpansive
(@
uPred_
always
_if
M
p
).
(* Conditional
persistently
*)
Global
Instance
persistently
_if_ne
p
:
NonExpansive
(@
uPred_
persistently
_if
M
p
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
always
_if_proper
p
:
Proper
((
⊣
⊢
)
==>
(
⊣
⊢
))
(@
uPred_
always
_if
M
p
).
Global
Instance
persistently
_if_proper
p
:
Proper
((
⊣
⊢
)
==>
(
⊣
⊢
))
(@
uPred_
persistently
_if
M
p
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
always
_if_mono
p
:
Proper
((
⊢
)
==>
(
⊢
))
(@
uPred_
always
_if
M
p
).
Global
Instance
persistently
_if_mono
p
:
Proper
((
⊢
)
==>
(
⊢
))
(@
uPred_
persistently
_if
M
p
).
Proof
.
solve_proper
.
Qed
.
Lemma
always
_if_elim
p
P
:
□
?p
P
⊢
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_elim
.
Qed
.
Lemma
always
_elim_if
p
P
:
□
P
⊢
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_elim
.
Qed
.
Lemma
always
_if_pure
p
φ
:
□
?p
⌜φ⌝
⊣
⊢
⌜φ⌝
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_pure
.
Qed
.
Lemma
always
_if_and
p
P
Q
:
□
?p
(
P
∧
Q
)
⊣
⊢
□
?p
P
∧
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_and
.
Qed
.
Lemma
always
_if_or
p
P
Q
:
□
?p
(
P
∨
Q
)
⊣
⊢
□
?p
P
∨
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_or
.
Qed
.
Lemma
always
_if_exist
{
A
}
p
(
Ψ
:
A
→
uPred
M
)
:
(
□
?p
∃
a
,
Ψ
a
)
⊣
⊢
∃
a
,
□
?p
Ψ
a
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_exist
.
Qed
.
Lemma
always
_if_sep
p
P
Q
:
□
?p
(
P
∗
Q
)
⊣
⊢
□
?p
P
∗
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_sep
.
Qed
.
Lemma
always
_if_later
p
P
:
□
?p
▷
P
⊣
⊢
▷
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_later
.
Qed
.
Lemma
always
_if_laterN
p
n
P
:
□
?p
▷
^
n
P
⊣
⊢
▷
^
n
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
always
_laterN
.
Qed
.
Lemma
persistently
_if_elim
p
P
:
□
?p
P
⊢
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_elim
.
Qed
.
Lemma
persistently
_elim_if
p
P
:
□
P
⊢
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_elim
.
Qed
.
Lemma
persistently
_if_pure
p
φ
:
□
?p
⌜φ⌝
⊣
⊢
⌜φ⌝
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_pure
.
Qed
.
Lemma
persistently
_if_and
p
P
Q
:
□
?p
(
P
∧
Q
)
⊣
⊢
□
?p
P
∧
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_and
.
Qed
.
Lemma
persistently
_if_or
p
P
Q
:
□
?p
(
P
∨
Q
)
⊣
⊢
□
?p
P
∨
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_or
.
Qed
.
Lemma
persistently
_if_exist
{
A
}
p
(
Ψ
:
A
→
uPred
M
)
:
(
□
?p
∃
a
,
Ψ
a
)
⊣
⊢
∃
a
,
□
?p
Ψ
a
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_exist
.
Qed
.
Lemma
persistently
_if_sep
p
P
Q
:
□
?p
(
P
∗
Q
)
⊣
⊢
□
?p
P
∗
□
?p
Q
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_sep
.
Qed
.
Lemma
persistently
_if_later
p
P
:
□
?p
▷
P
⊣
⊢
▷
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_later
.
Qed
.
Lemma
persistently
_if_laterN
p
n
P
:
□
?p
▷
^
n
P
⊣
⊢
▷
^
n
□
?p
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently
_laterN
.
Qed
.
(* True now *)
Global
Instance
except_0_ne
:
NonExpansive
(@
uPred_except_0
M
).
...
...
@@ -727,7 +727,7 @@ Lemma except_0_sep P Q : ◇ (P ∗ Q) ⊣⊢ ◇ P ∗ ◇ Q.
Proof
.
rewrite
/
uPred_except_0
.
apply
(
anti_symm
_
).
-
apply
or_elim
;
last
by
auto
.
by
rewrite
-!
or_intro_l
-
always_pure
-
always_later
-
always
_sep_dup'
.
by
rewrite
-!
or_intro_l
-
persistently_pure
-
persistently_later
-
persistently
_sep_dup'
.
-
rewrite
sep_or_r
sep_elim_l
sep_or_l
;
auto
.
Qed
.
Lemma
except_0_forall
{
A
}
(
Φ
:
A
→
uPred
M
)
:
◇
(
∀
a
,
Φ
a
)
⊢
∀
a
,
◇
Φ
a
.
...
...
@@ -743,20 +743,20 @@ Proof.
Qed
.
Lemma
except_0_later
P
:
◇
▷
P
⊢
▷
P
.
Proof
.
by
rewrite
/
uPred_except_0
-
later_or
False_or
.
Qed
.
Lemma
except_0_
always
P
:
◇
□
P
⊣
⊢
□
◇
P
.
Proof
.
by
rewrite
/
uPred_except_0
always_or
always_later
always
_pure
.
Qed
.
Lemma
except_0_
always
_if
p
P
:
◇
□
?p
P
⊣
⊢
□
?p
◇
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
except_0_
always
.
Qed
.
Lemma
except_0_
persistently
P
:
◇
□
P
⊣
⊢
□
◇
P
.
Proof
.
by
rewrite
/
uPred_except_0
persistently_or
persistently_later
persistently
_pure
.
Qed
.
Lemma
except_0_
persistently
_if
p
P
:
◇
□
?p
P
⊣
⊢
□
?p
◇
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
except_0_
persistently
.
Qed
.
Lemma
except_0_frame_l
P
Q
:
P
∗
◇
Q
⊢
◇
(
P
∗
Q
).
Proof
.
by
rewrite
{
1
}(
except_0_intro
P
)
except_0_sep
.
Qed
.
Lemma
except_0_frame_r
P
Q
:
◇
P
∗
Q
⊢
◇
(
P
∗
Q
).
Proof
.
by
rewrite
{
1
}(
except_0_intro
Q
)
except_0_sep
.
Qed
.
(* Own and valid derived *)
Lemma
always
_ownM
(
a
:
M
)
:
CoreId
a
→
□
uPred_ownM
a
⊣
⊢
uPred_ownM
a
.
Lemma
persistently
_ownM
(
a
:
M
)
:
CoreId
a
→
□
uPred_ownM
a
⊣
⊢
uPred_ownM
a
.
Proof
.
intros
;
apply
(
anti_symm
_
)
;
first
by
apply
:
always
_elim
.
by
rewrite
{
1
}
always
_ownM_core
core_id_core
.
intros
;
apply
(
anti_symm
_
)
;
first
by
apply
:
persistently
_elim
.
by
rewrite
{
1
}
persistently
_ownM_core
core_id_core
.
Qed
.
Lemma
ownM_invalid
(
a
:
M
)
:
¬
✓
{
0
}
a
→
uPred_ownM
a
⊢
False
.
Proof
.
by
intros
;
rewrite
ownM_valid
cmra_valid_elim
.
Qed
.
...
...
@@ -764,10 +764,10 @@ Global Instance ownM_mono : Proper (flip (≼) ==> (⊢)) (@uPred_ownM M).
Proof
.
intros
a
b
[
b'
->].
rewrite
ownM_op
.
eauto
.
Qed
.
Lemma
ownM_unit'
:
uPred_ownM
ε
⊣
⊢
True
.
Proof
.
apply
(
anti_symm
_
)
;
first
by
auto
.
apply
ownM_unit
.
Qed
.
Lemma
always
_cmra_valid
{
A
:
cmraT
}
(
a
:
A
)
:
□
✓
a
⊣
⊢
✓
a
.
Lemma
persistently
_cmra_valid
{
A
:
cmraT
}
(
a
:
A
)
:
□
✓
a
⊣
⊢
✓
a
.
Proof
.
intros
;
apply
(
anti_symm
_
)
;
first
by
apply
:
always
_elim
.
apply
:
always
_cmra_valid_1
.
intros
;
apply
(
anti_symm
_
)
;
first
by
apply
:
persistently
_elim
.
apply
:
persistently
_cmra_valid_1
.
Qed
.
(** * Derived rules *)
...
...
@@ -823,8 +823,8 @@ Proof.
apply
or_mono
,
wand_intro_l
;
first
done
.
rewrite
-{
2
}(
l
ö
b
Q
)
;
apply
impl_intro_l
.
rewrite
HQ
/
uPred_except_0
!
and_or_r
.
apply
or_elim
;
last
auto
.
rewrite
-(
always_pure
)
-
always_later
always
_and_sep_l'
.
by
rewrite
assoc
(
comm
_
_
P
)
-
assoc
-
always
_and_sep_l'
impl_elim_r
wand_elim_r
.
rewrite
-(
persistently_pure
)
-
persistently_later
persistently
_and_sep_l'
.
by
rewrite
assoc
(
comm
_
_
P
)
-
assoc
-
persistently
_and_sep_l'
impl_elim_r
wand_elim_r
.
Qed
.
Global
Instance
forall_timeless
{
A
}
(
Ψ
:
A
→
uPred
M
)
:
(
∀
x
,
Timeless
(
Ψ
x
))
→
Timeless
(
∀
x
,
Ψ
x
).
...
...
@@ -842,9 +842,9 @@ Proof.
-
rewrite
/
uPred_except_0
;
auto
.
-
apply
exist_elim
=>
x
.
rewrite
-(
exist_intro
x
)
;
auto
.
Qed
.
Global
Instance
always
_timeless
P
:
Timeless
P
→
Timeless
(
□
P
).
Proof
.
intros
;
rewrite
/
Timeless
except_0_
always
-
always
_later
;
auto
.
Qed
.
Global
Instance
always
_if_timeless
p
P
:
Timeless
P
→
Timeless
(
□
?p
P
).
Global
Instance
persistently
_timeless
P
:
Timeless
P
→
Timeless
(
□
P
).
Proof
.
intros
;
rewrite
/
Timeless
except_0_
persistently
-
persistently
_later
;
auto
.
Qed
.
Global
Instance
persistently
_if_timeless
p
P
:
Timeless
P
→
Timeless
(
□
?p
P
).
Proof
.
destruct
p
;
apply
_
.
Qed
.
Global
Instance
eq_timeless
{
A
:
ofeT
}
(
a
b
:
A
)
:
Discrete
a
→
Timeless
(
a
≡
b
:
uPred
M
)%
I
.
...
...
@@ -867,71 +867,71 @@ Global Instance limit_preserving_Persistent {A:ofeT} `{Cofe A} (Φ : A → uPred
NonExpansive
Φ
→
LimitPreserving
(
λ
x
,
Persistent
(
Φ
x
)).
Proof
.
intros
.
apply
limit_preserving_entails
;
solve_proper
.
Qed
.
Lemma
always_always
P
`
{!
Persistent
P
}
:
□
P
⊣
⊢
P
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
using
always
_elim
.
Qed
.
Lemma
always_if_always
p
P
`
{!
Persistent
P
}
:
□
?p
P
⊣
⊢
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
always_always
.
Qed
.
Lemma
always
_intro
P
Q
`
{!
Persistent
P
}
:
(
P
⊢
Q
)
→
P
⊢
□
Q
.
Proof
.
rewrite
-(
always_always
P
)
;
apply
always
_intro'
.
Qed
.
Lemma
always
_and_sep_l
P
Q
`
{!
Persistent
P
}
:
P
∧
Q
⊣
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
always_always
P
)
always
_and_sep_l'
.
Qed
.
Lemma
always
_and_sep_r
P
Q
`
{!
Persistent
Q
}
:
P
∧
Q
⊣
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
always_always
Q
)
always
_and_sep_r'
.
Qed
.
Lemma
always
_sep_dup
P
`
{!
Persistent
P
}
:
P
⊣
⊢
P
∗
P
.
Proof
.
by
rewrite
-(
always_always
P
)
-
always
_sep_dup'
.
Qed
.
Lemma
always
_entails_l
P
Q
`
{!
Persistent
Q
}
:
(
P
⊢
Q
)
→
P
⊢
Q
∗
P
.
Proof
.
by
rewrite
-(
always_always
Q
)
;
apply
always
_entails_l'
.
Qed
.
Lemma
always
_entails_r
P
Q
`
{!
Persistent
Q
}
:
(
P
⊢
Q
)
→
P
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
always_always
Q
)
;
apply
always
_entails_r'
.
Qed
.
Lemma
always
_impl_wand
P
`
{!
Persistent
P
}
Q
:
(
P
→
Q
)
⊣
⊢
(
P
-
∗
Q
).
Lemma
persistently_persistently
P
`
{!
Persistent
P
}
:
□
P
⊣
⊢
P
.
Proof
.
apply
(
anti_symm
(
⊢
))
;
auto
using
persistently
_elim
.
Qed
.
Lemma
persistently_if_persistently
p
P
`
{!
Persistent
P
}
:
□
?p
P
⊣
⊢
P
.
Proof
.
destruct
p
;
simpl
;
auto
using
persistently_persistently
.
Qed
.
Lemma
persistently
_intro
P
Q
`
{!
Persistent
P
}
:
(
P
⊢
Q
)
→
P
⊢
□
Q
.
Proof
.
rewrite
-(
persistently_persistently
P
)
;
apply
persistently
_intro'
.
Qed
.
Lemma
persistently
_and_sep_l
P
Q
`
{!
Persistent
P
}
:
P
∧
Q
⊣
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
persistently_persistently
P
)
persistently
_and_sep_l'
.
Qed
.
Lemma
persistently
_and_sep_r
P
Q
`
{!
Persistent
Q
}
:
P
∧
Q
⊣
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
persistently_persistently
Q
)
persistently
_and_sep_r'
.
Qed
.
Lemma
persistently
_sep_dup
P
`
{!
Persistent
P
}
:
P
⊣
⊢
P
∗
P
.
Proof
.
by
rewrite
-(
persistently_persistently
P
)
-
persistently
_sep_dup'
.
Qed
.
Lemma
persistently
_entails_l
P
Q
`
{!
Persistent
Q
}
:
(
P
⊢
Q
)
→
P
⊢
Q
∗
P
.
Proof
.
by
rewrite
-(
persistently_persistently
Q
)
;
apply
persistently
_entails_l'
.
Qed
.
Lemma
persistently
_entails_r
P
Q
`
{!
Persistent
Q
}
:
(
P
⊢
Q
)
→
P
⊢
P
∗
Q
.
Proof
.
by
rewrite
-(
persistently_persistently
Q
)
;
apply
persistently
_entails_r'
.
Qed
.
Lemma
persistently
_impl_wand
P
`
{!
Persistent
P
}
Q
:
(
P
→
Q
)
⊣
⊢
(
P
-
∗
Q
).
Proof
.
apply
(
anti_symm
_
)
;
auto
using
impl_wand
.
apply
impl_intro_l
.
by
rewrite
always
_and_sep_l
wand_elim_r
.
apply
impl_intro_l
.
by
rewrite
persistently
_and_sep_l
wand_elim_r
.
Qed
.
(* Persistence *)
Global
Instance
pure_persistent
φ
:
Persistent
(
⌜φ⌝
:
uPred
M
)%
I
.
Proof
.
by
rewrite
/
Persistent
always
_pure
.
Qed
.
Proof
.
by
rewrite
/
Persistent
persistently
_pure
.
Qed
.
Global
Instance
pure_impl_persistent
φ
Q
:
Persistent
Q
→
Persistent
(
⌜φ⌝
→
Q
)%
I
.
Proof
.
rewrite
/
Persistent
pure_impl_forall
always
_forall
.
auto
using
forall_mono
.
rewrite
/
Persistent
pure_impl_forall
persistently
_forall
.
auto
using
forall_mono
.
Qed
.
Global
Instance
pure_wand_persistent
φ
Q
:
Persistent
Q
→
Persistent
(
⌜φ⌝
-
∗
Q
)%
I
.
Proof
.
rewrite
/
Persistent
-
always
_impl_wand
pure_impl_forall
always
_forall
.
rewrite
/
Persistent
-
persistently
_impl_wand
pure_impl_forall
persistently
_forall
.
auto
using
forall_mono
.
Qed
.
Global
Instance
always
_persistent
P
:
Persistent
(
□
P
).
Proof
.
by
intros
;
apply
always
_intro'
.
Qed
.
Global
Instance
persistently
_persistent
P
:
Persistent
(
□
P
).