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
Rodolphe Lepigre
Iris
Commits
45aa85cb
Commit
45aa85cb
authored
Nov 16, 2015
by
Robbert Krebbers
Browse files
Rename iProp into uPred.
parent
0f025d83
Changes
1
Hide whitespace changes
Inline
Side-by-side
iris/logic.v
View file @
45aa85cb
...
...
@@ -3,27 +3,27 @@ Local Hint Extern 1 (_ ≼ _) => etransitivity; [eassumption|].
Local
Hint
Extern
1
(
_
≼
_
)
=>
etransitivity
;
[|
eassumption
].
Local
Hint
Extern
10
(
_
≤
_
)
=>
omega
.
Structure
i
Pr
op
(
M
:
cmraT
)
:
Type
:
=
IProp
{
iprop
_holds
:
>
nat
→
M
->
Prop
;
iprop
_ne
x1
x2
n
:
iprop
_holds
n
x1
→
x1
={
n
}=
x2
→
iprop
_holds
n
x2
;
iprop
_weaken
x1
x2
n1
n2
:
x1
≼
x2
→
n2
≤
n1
→
validN
n2
x2
→
iprop
_holds
n1
x1
→
iprop
_holds
n2
x2
Structure
u
Pr
ed
(
M
:
cmraT
)
:
Type
:
=
IProp
{
uPred
_holds
:
>
nat
→
M
->
Prop
;
uPred
_ne
x1
x2
n
:
uPred
_holds
n
x1
→
x1
={
n
}=
x2
→
uPred
_holds
n
x2
;
uPred
_weaken
x1
x2
n1
n2
:
x1
≼
x2
→
n2
≤
n1
→
validN
n2
x2
→
uPred
_holds
n1
x1
→
uPred
_holds
n2
x2
}.
Add
Printing
Constructor
i
Pr
op
.
Instance
:
Params
(@
iprop
_holds
)
3
.
Add
Printing
Constructor
u
Pr
ed
.
Instance
:
Params
(@
uPred
_holds
)
3
.
Instance
iprop
_equiv
(
M
:
cmraT
)
:
Equiv
(
i
Pr
op
M
)
:
=
λ
P
Q
,
∀
x
n
,
Instance
uPred
_equiv
(
M
:
cmraT
)
:
Equiv
(
u
Pr
ed
M
)
:
=
λ
P
Q
,
∀
x
n
,
validN
n
x
→
P
n
x
↔
Q
n
x
.
Instance
iprop
_dist
(
M
:
cmraT
)
:
Dist
(
i
Pr
op
M
)
:
=
λ
n
P
Q
,
∀
x
n'
,
Instance
uPred
_dist
(
M
:
cmraT
)
:
Dist
(
u
Pr
ed
M
)
:
=
λ
n
P
Q
,
∀
x
n'
,
n'
<
n
→
validN
n'
x
→
P
n'
x
↔
Q
n'
x
.
Program
Instance
iprop
_compl
(
M
:
cmraT
)
:
Compl
(
i
Pr
op
M
)
:
=
λ
c
,
{|
iprop
_holds
n
x
:
=
c
(
S
n
)
n
x
|}.
Next
Obligation
.
by
intros
M
c
x
y
n
??
;
simpl
in
*
;
apply
iprop
_ne
with
x
.
Qed
.
Program
Instance
uPred
_compl
(
M
:
cmraT
)
:
Compl
(
u
Pr
ed
M
)
:
=
λ
c
,
{|
uPred
_holds
n
x
:
=
c
(
S
n
)
n
x
|}.
Next
Obligation
.
by
intros
M
c
x
y
n
??
;
simpl
in
*
;
apply
uPred
_ne
with
x
.
Qed
.
Next
Obligation
.
intros
M
c
x1
x2
n1
n2
????
;
simpl
in
*.
apply
(
chain_cauchy
c
(
S
n2
)
(
S
n1
))
;
eauto
using
iprop
_weaken
,
cmra_valid_le
.
apply
(
chain_cauchy
c
(
S
n2
)
(
S
n1
))
;
eauto
using
uPred
_weaken
,
cmra_valid_le
.
Qed
.
Instance
iprop
_cofe
(
M
:
cmraT
)
:
Cofe
(
i
Pr
op
M
).
Instance
uPred
_cofe
(
M
:
cmraT
)
:
Cofe
(
u
Pr
ed
M
).
Proof
.
split
.
*
intros
P
Q
;
split
;
[
by
intros
HPQ
n
x
i
??
;
apply
HPQ
|].
...
...
@@ -36,70 +36,70 @@ Proof.
*
intros
P
Q
x
i
??
;
lia
.
*
intros
c
n
x
i
??
;
apply
(
chain_cauchy
c
(
S
i
)
n
)
;
auto
.
Qed
.
Instance
iprop
_holds_ne
{
M
}
(
P
:
i
Pr
op
M
)
n
:
Proper
(
dist
n
==>
iff
)
(
P
n
).
Proof
.
intros
x1
x2
Hx
;
split
;
eauto
using
iprop
_ne
.
Qed
.
Instance
iprop
_holds_proper
{
M
}
(
P
:
i
Pr
op
M
)
n
:
Proper
((
≡
)
==>
iff
)
(
P
n
).
Proof
.
by
intros
x1
x2
Hx
;
apply
iprop
_holds_ne
,
equiv_dist
.
Qed
.
Definition
i
Pr
op
C
(
M
:
cmraT
)
:
cofeT
:
=
CofeT
(
i
Pr
op
M
).
Instance
uPred
_holds_ne
{
M
}
(
P
:
u
Pr
ed
M
)
n
:
Proper
(
dist
n
==>
iff
)
(
P
n
).
Proof
.
intros
x1
x2
Hx
;
split
;
eauto
using
uPred
_ne
.
Qed
.
Instance
uPred
_holds_proper
{
M
}
(
P
:
u
Pr
ed
M
)
n
:
Proper
((
≡
)
==>
iff
)
(
P
n
).
Proof
.
by
intros
x1
x2
Hx
;
apply
uPred
_holds_ne
,
equiv_dist
.
Qed
.
Definition
u
Pr
ed
C
(
M
:
cmraT
)
:
cofeT
:
=
CofeT
(
u
Pr
ed
M
).
(** functor *)
Program
Definition
iprop
_map
{
M1
M2
:
cmraT
}
(
f
:
M2
→
M1
)
Program
Definition
uPred
_map
{
M1
M2
:
cmraT
}
(
f
:
M2
→
M1
)
`
{!
∀
n
,
Proper
(
dist
n
==>
dist
n
)
f
,
!
CMRAPreserving
f
}
(
P
:
i
Pr
op
M1
)
:
i
Pr
op
M2
:
=
{|
iprop
_holds
n
x
:
=
P
n
(
f
x
)
|}.
(
P
:
u
Pr
ed
M1
)
:
u
Pr
ed
M2
:
=
{|
uPred
_holds
n
x
:
=
P
n
(
f
x
)
|}.
Next
Obligation
.
by
intros
M1
M2
f
??
P
y1
y2
n
?
Hy
;
simpl
;
rewrite
<-
Hy
.
Qed
.
Next
Obligation
.
by
intros
M1
M2
f
??
P
y1
y2
n
i
???
;
simpl
;
apply
iprop
_weaken
;
auto
;
by
intros
M1
M2
f
??
P
y1
y2
n
i
???
;
simpl
;
apply
uPred
_weaken
;
auto
;
apply
validN_preserving
||
apply
included_preserving
.
Qed
.
Instance
iprop
_map_ne
{
M1
M2
:
cmraT
}
(
f
:
M2
→
M1
)
Instance
uPred
_map_ne
{
M1
M2
:
cmraT
}
(
f
:
M2
→
M1
)
`
{!
∀
n
,
Proper
(
dist
n
==>
dist
n
)
f
,
!
CMRAPreserving
f
}
:
Proper
(
dist
n
==>
dist
n
)
(
iprop
_map
f
).
Proper
(
dist
n
==>
dist
n
)
(
uPred
_map
f
).
Proof
.
by
intros
n
x1
x2
Hx
y
n'
;
split
;
apply
Hx
;
try
apply
validN_preserving
.
Qed
.
Definition
iprop
C_map
{
M1
M2
:
cmraT
}
(
f
:
M2
-
n
>
M1
)
`
{!
CMRAPreserving
f
}
:
i
Pr
op
C
M1
-
n
>
i
Pr
op
C
M2
:
=
CofeMor
(
iprop
_map
f
:
i
Pr
op
C
M1
→
i
Pr
op
C
M2
).
Definition
uPred
C_map
{
M1
M2
:
cmraT
}
(
f
:
M2
-
n
>
M1
)
`
{!
CMRAPreserving
f
}
:
u
Pr
ed
C
M1
-
n
>
u
Pr
ed
C
M2
:
=
CofeMor
(
uPred
_map
f
:
u
Pr
ed
C
M1
→
u
Pr
ed
C
M2
).
(** logical entailement *)
Instance
iprop
_entails
{
M
}
:
SubsetEq
(
i
Pr
op
M
)
:
=
λ
P
Q
,
∀
x
n
,
Instance
uPred
_entails
{
M
}
:
SubsetEq
(
u
Pr
ed
M
)
:
=
λ
P
Q
,
∀
x
n
,
validN
n
x
→
P
n
x
→
Q
n
x
.
(** logical connectives *)
Program
Definition
iprop
_const
{
M
}
(
P
:
Prop
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
P
|}.
Program
Definition
uPred
_const
{
M
}
(
P
:
Prop
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
P
|}.
Solve
Obligations
with
done
.
Program
Definition
iprop
_and
{
M
}
(
P
Q
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
P
n
x
∧
Q
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
iprop_ne
,
iprop
_weaken
.
Program
Definition
iprop
_or
{
M
}
(
P
Q
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
P
n
x
∨
Q
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
iprop_ne
,
iprop
_weaken
.
Program
Definition
iprop
_impl
{
M
}
(
P
Q
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∀
x'
n'
,
Program
Definition
uPred
_and
{
M
}
(
P
Q
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
P
n
x
∧
Q
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
uPred_ne
,
uPred
_weaken
.
Program
Definition
uPred
_or
{
M
}
(
P
Q
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
P
n
x
∨
Q
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
uPred_ne
,
uPred
_weaken
.
Program
Definition
uPred
_impl
{
M
}
(
P
Q
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∀
x'
n'
,
x
≼
x'
→
n'
≤
n
→
validN
n'
x'
→
P
n'
x'
→
Q
n'
x'
|}.
Next
Obligation
.
intros
M
P
Q
x1'
x1
n1
HPQ
Hx1
x2
n2
????.
destruct
(
cmra_included_dist_l
x1
x2
x1'
n1
)
as
(
x2'
&?&
Hx2
)
;
auto
.
assert
(
x2'
={
n2
}=
x2
)
as
Hx2'
by
(
by
apply
dist_le
with
n1
).
assert
(
validN
n2
x2'
)
by
(
by
rewrite
Hx2'
)
;
rewrite
<-
Hx2'
.
by
apply
HPQ
,
iprop
_weaken
with
x2'
n2
,
iprop
_ne
with
x2
.
by
apply
HPQ
,
uPred
_weaken
with
x2'
n2
,
uPred
_ne
with
x2
.
Qed
.
Next
Obligation
.
naive_solver
eauto
2
with
lia
.
Qed
.
Program
Definition
iprop
_forall
{
M
A
}
(
P
:
A
→
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∀
a
,
P
a
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
iprop_ne
,
iprop
_weaken
.
Program
Definition
iprop
_exist
{
M
A
}
(
P
:
A
→
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∃
a
,
P
a
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
iprop_ne
,
iprop
_weaken
.
Program
Definition
uPred
_forall
{
M
A
}
(
P
:
A
→
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∀
a
,
P
a
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
uPred_ne
,
uPred
_weaken
.
Program
Definition
uPred
_exist
{
M
A
}
(
P
:
A
→
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∃
a
,
P
a
n
x
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
uPred_ne
,
uPred
_weaken
.
Program
Definition
iprop
_eq
{
M
}
{
A
:
cofeT
}
(
a1
a2
:
A
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
a1
={
n
}=
a2
|}.
Program
Definition
uPred
_eq
{
M
}
{
A
:
cofeT
}
(
a1
a2
:
A
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
a1
={
n
}=
a2
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
(
dist_le
(
A
:
=
A
)).
Program
Definition
iprop
_sep
{
M
}
(
P
Q
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∃
x1
x2
,
x
={
n
}=
x1
⋅
x2
∧
P
n
x1
∧
Q
n
x2
|}.
Program
Definition
uPred
_sep
{
M
}
(
P
Q
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∃
x1
x2
,
x
={
n
}=
x1
⋅
x2
∧
P
n
x1
∧
Q
n
x2
|}.
Next
Obligation
.
by
intros
M
P
Q
x
y
n
(
x1
&
x2
&?&?&?)
Hxy
;
exists
x1
,
x2
;
rewrite
<-
Hxy
.
Qed
.
...
...
@@ -110,14 +110,14 @@ Next Obligation.
exists
(
x2
⋅
z
)
;
split
;
eauto
using
ra_included_l
.
apply
dist_le
with
n1
;
auto
.
by
rewrite
(
associative
op
),
<-
Hx
,
Hy
.
}
exists
x1
,
x2'
;
split_ands
;
auto
.
*
apply
iprop
_weaken
with
x1
n1
;
auto
.
*
apply
uPred
_weaken
with
x1
n1
;
auto
.
by
apply
cmra_valid_op_l
with
x2'
;
rewrite
<-
Hy
.
*
apply
iprop
_weaken
with
x2
n1
;
auto
.
*
apply
uPred
_weaken
with
x2
n1
;
auto
.
by
apply
cmra_valid_op_r
with
x1
;
rewrite
<-
Hy
.
Qed
.
Program
Definition
iprop
_wand
{
M
}
(
P
Q
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∀
x'
n'
,
Program
Definition
uPred
_wand
{
M
}
(
P
Q
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∀
x'
n'
,
n'
≤
n
→
validN
n'
(
x
⋅
x'
)
→
P
n'
x'
→
Q
n'
(
x
⋅
x'
)
|}.
Next
Obligation
.
intros
M
P
Q
x1
x2
n1
HPQ
Hx
x3
n2
???
;
simpl
in
*.
...
...
@@ -126,65 +126,65 @@ Next Obligation.
Qed
.
Next
Obligation
.
intros
M
P
Q
x1
x2
n1
n2
???
HPQ
x3
n3
???
;
simpl
in
*.
apply
iprop
_weaken
with
(
x1
⋅
x3
)
n3
;
auto
using
ra_preserving_r
.
apply
uPred
_weaken
with
(
x1
⋅
x3
)
n3
;
auto
using
ra_preserving_r
.
apply
HPQ
;
auto
.
apply
cmra_valid_included
with
(
x2
⋅
x3
)
;
auto
using
ra_preserving_r
.
Qed
.
Program
Definition
iprop
_later
{
M
}
(
P
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
match
n
return
_
with
0
=>
True
|
S
n'
=>
P
n'
x
end
|}.
Next
Obligation
.
intros
M
P
??
[|
n
]
;
eauto
using
iprop
_ne
,(
dist_le
(
A
:
=
M
)).
Qed
.
Program
Definition
uPred
_later
{
M
}
(
P
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
match
n
return
_
with
0
=>
True
|
S
n'
=>
P
n'
x
end
|}.
Next
Obligation
.
intros
M
P
??
[|
n
]
;
eauto
using
uPred
_ne
,(
dist_le
(
A
:
=
M
)).
Qed
.
Next
Obligation
.
intros
M
P
x1
x2
[|
n1
]
[|
n2
]
????
;
auto
with
lia
.
apply
iprop
_weaken
with
x1
n1
;
eauto
using
cmra_valid_S
.
apply
uPred
_weaken
with
x1
n1
;
eauto
using
cmra_valid_S
.
Qed
.
Program
Definition
iprop
_always
{
M
}
(
P
:
i
Pr
op
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
P
n
(
unit
x
)
|}.
Program
Definition
uPred
_always
{
M
}
(
P
:
u
Pr
ed
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
P
n
(
unit
x
)
|}.
Next
Obligation
.
by
intros
M
P
x1
x2
n
?
Hx
;
simpl
in
*
;
rewrite
<-
Hx
.
Qed
.
Next
Obligation
.
intros
M
P
x1
x2
n1
n2
????
;
eapply
iprop
_weaken
with
(
unit
x1
)
n1
;
intros
M
P
x1
x2
n1
n2
????
;
eapply
uPred
_weaken
with
(
unit
x1
)
n1
;
auto
using
ra_unit_preserving
,
cmra_unit_valid
.
Qed
.
Program
Definition
iprop
_own
{
M
:
cmraT
}
(
a
:
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
∃
a'
,
x
={
n
}=
a
⋅
a'
|}.
Program
Definition
uPred
_own
{
M
:
cmraT
}
(
a
:
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
∃
a'
,
x
={
n
}=
a
⋅
a'
|}.
Next
Obligation
.
by
intros
M
a
x1
x2
n
[
a'
Hx
]
?
;
exists
a'
;
rewrite
<-
Hx
.
Qed
.
Next
Obligation
.
intros
M
a
x1
x
n1
n2
;
rewrite
ra_included_spec
;
intros
[
x2
Hx
]
??
[
a'
Hx1
].
exists
(
a'
⋅
x2
).
by
rewrite
(
associative
op
),
<-(
dist_le
_
_
_
_
Hx1
),
Hx
.
Qed
.
Program
Definition
iprop
_valid
{
M
:
cmraT
}
(
a
:
M
)
:
i
Pr
op
M
:
=
{|
iprop
_holds
n
x
:
=
validN
n
a
|}.
Program
Definition
uPred
_valid
{
M
:
cmraT
}
(
a
:
M
)
:
u
Pr
ed
M
:
=
{|
uPred
_holds
n
x
:
=
validN
n
a
|}.
Solve
Obligations
with
naive_solver
eauto
2
using
cmra_valid_le
.
Definition
iprop
_fixpoint
{
M
}
(
P
:
i
Pr
op
M
→
i
Pr
op
M
)
`
{!
Contractive
P
}
:
i
Pr
op
M
:
=
fixpoint
P
(
iprop
_const
True
).
Definition
uPred
_fixpoint
{
M
}
(
P
:
u
Pr
ed
M
→
u
Pr
ed
M
)
`
{!
Contractive
P
}
:
u
Pr
ed
M
:
=
fixpoint
P
(
uPred
_const
True
).
Delimit
Scope
iprop
_scope
with
I
.
Bind
Scope
iprop
_scope
with
i
Pr
op
.
Arguments
iprop
_holds
{
_
}
_
%
I
_
_
.
Delimit
Scope
uPred
_scope
with
I
.
Bind
Scope
uPred
_scope
with
u
Pr
ed
.
Arguments
uPred
_holds
{
_
}
_
%
I
_
_
.
Notation
"'False'"
:
=
(
iprop
_const
False
)
:
iprop
_scope
.
Notation
"'True'"
:
=
(
iprop
_const
True
)
:
iprop
_scope
.
Infix
"∧"
:
=
iprop
_and
:
iprop
_scope
.
Infix
"∨"
:
=
iprop
_or
:
iprop
_scope
.
Infix
"→"
:
=
iprop
_impl
:
iprop
_scope
.
Infix
"★"
:
=
iprop
_sep
(
at
level
80
,
right
associativity
)
:
iprop
_scope
.
Infix
"-★"
:
=
iprop
_wand
(
at
level
90
)
:
iprop
_scope
.
Notation
"'False'"
:
=
(
uPred
_const
False
)
:
uPred
_scope
.
Notation
"'True'"
:
=
(
uPred
_const
True
)
:
uPred
_scope
.
Infix
"∧"
:
=
uPred
_and
:
uPred
_scope
.
Infix
"∨"
:
=
uPred
_or
:
uPred
_scope
.
Infix
"→"
:
=
uPred
_impl
:
uPred
_scope
.
Infix
"★"
:
=
uPred
_sep
(
at
level
80
,
right
associativity
)
:
uPred
_scope
.
Infix
"-★"
:
=
uPred
_wand
(
at
level
90
)
:
uPred
_scope
.
Notation
"∀ x .. y , P"
:
=
(
iprop
_forall
(
λ
x
,
..
(
iprop
_forall
(
λ
y
,
P
))
..))
:
iprop
_scope
.
(
uPred
_forall
(
λ
x
,
..
(
uPred
_forall
(
λ
y
,
P
))
..))
:
uPred
_scope
.
Notation
"∃ x .. y , P"
:
=
(
iprop
_exist
(
λ
x
,
..
(
iprop
_exist
(
λ
y
,
P
))
..))
:
iprop
_scope
.
Notation
"▷ P"
:
=
(
iprop
_later
P
)
(
at
level
20
)
:
iprop
_scope
.
Notation
"□ P"
:
=
(
iprop
_always
P
)
(
at
level
20
)
:
iprop
_scope
.
(
uPred
_exist
(
λ
x
,
..
(
uPred
_exist
(
λ
y
,
P
))
..))
:
uPred
_scope
.
Notation
"▷ P"
:
=
(
uPred
_later
P
)
(
at
level
20
)
:
uPred
_scope
.
Notation
"□ P"
:
=
(
uPred
_always
P
)
(
at
level
20
)
:
uPred
_scope
.
Section
logic
.
Context
{
M
:
cmraT
}.
Implicit
Types
P
Q
:
i
Pr
op
M
.
Implicit
Types
P
Q
:
u
Pr
ed
M
.
Global
Instance
iprop
_preorder
:
PreOrder
((
⊆
)
:
relation
(
i
Pr
op
M
)).
Global
Instance
uPred
_preorder
:
PreOrder
((
⊆
)
:
relation
(
u
Pr
ed
M
)).
Proof
.
split
.
by
intros
P
x
i
.
by
intros
P
Q
Q'
HP
HQ
x
i
??
;
apply
HQ
,
HP
.
Qed
.
Lemma
iprop
_equiv_spec
P
Q
:
P
≡
Q
↔
P
⊆
Q
∧
Q
⊆
P
.
Lemma
uPred
_equiv_spec
P
Q
:
P
≡
Q
↔
P
⊆
Q
∧
Q
⊆
P
.
Proof
.
split
.
*
intros
HPQ
;
split
;
intros
x
i
;
apply
HPQ
.
...
...
@@ -192,142 +192,142 @@ Proof.
Qed
.
(** Non-expansiveness *)
Global
Instance
iprop
_const_proper
:
Proper
(
iff
==>
(
≡
))
(@
iprop
_const
M
).
Global
Instance
uPred
_const_proper
:
Proper
(
iff
==>
(
≡
))
(@
uPred
_const
M
).
Proof
.
intros
P
Q
HPQ
???
;
apply
HPQ
.
Qed
.
Global
Instance
iprop
_and_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_and
M
).
Global
Instance
uPred
_and_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_and
M
).
Proof
.
intros
P
P'
HP
Q
Q'
HQ
;
split
;
intros
[??]
;
split
;
by
apply
HP
||
by
apply
HQ
.
Qed
.
Global
Instance
iprop
_and_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_and
M
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_or_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_or
M
).
Global
Instance
uPred
_and_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_and
M
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_or_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_or
M
).
Proof
.
intros
P
P'
HP
Q
Q'
HQ
;
split
;
intros
[?|?]
;
first
[
by
left
;
apply
HP
|
by
right
;
apply
HQ
].
Qed
.
Global
Instance
iprop
_or_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_or
M
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_impl_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_impl
M
).
Global
Instance
uPred
_or_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_or
M
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_impl_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_impl
M
).
Proof
.
intros
P
P'
HP
Q
Q'
HQ
;
split
;
intros
HPQ
x'
n''
????
;
apply
HQ
,
HPQ
,
HP
;
auto
.
Qed
.
Global
Instance
iprop
_impl_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_impl
M
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_sep_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_sep
M
).
Global
Instance
uPred
_impl_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_impl
M
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_sep_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_sep
M
).
Proof
.
intros
P
P'
HP
Q
Q'
HQ
x
n'
?
Hx'
;
split
;
intros
(
x1
&
x2
&
Hx
&?&?)
;
exists
x1
,
x2
;
rewrite
Hx
in
Hx'
;
split_ands
;
try
apply
HP
;
try
apply
HQ
;
eauto
using
cmra_valid_op_l
,
cmra_valid_op_r
.
Qed
.
Global
Instance
iprop
_sep_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_sep
M
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_wand_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_wand
M
).
Global
Instance
uPred
_sep_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_sep
M
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_wand_ne
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_wand
M
).
Proof
.
intros
P
P'
HP
Q
Q'
HQ
x
n'
??
;
split
;
intros
HPQ
x'
n''
???
;
apply
HQ
,
HPQ
,
HP
;
eauto
using
cmra_valid_op_r
.
Qed
.
Global
Instance
iprop
_wand_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_wand
M
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_eq_ne
{
A
:
cofeT
}
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
iprop
_eq
M
A
).
Global
Instance
uPred
_wand_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_wand
M
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_eq_ne
{
A
:
cofeT
}
n
:
Proper
(
dist
n
==>
dist
n
==>
dist
n
)
(@
uPred
_eq
M
A
).
Proof
.
intros
x
x'
Hx
y
y'
Hy
z
n'
;
split
;
intros
;
simpl
in
*.
*
by
rewrite
<-(
dist_le
_
_
_
_
Hx
),
<-(
dist_le
_
_
_
_
Hy
)
by
auto
.
*
by
rewrite
(
dist_le
_
_
_
_
Hx
),
(
dist_le
_
_
_
_
Hy
)
by
auto
.
Qed
.
Global
Instance
iprop
_eq_proper
{
A
:
cofeT
}
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
iprop
_eq
M
A
)
:
=
ne_proper_2
_
.
Global
Instance
iprop
_forall_ne
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
dist
n
)
==>
dist
n
)
(@
iprop
_forall
M
A
).
Global
Instance
uPred
_eq_proper
{
A
:
cofeT
}
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(@
uPred
_eq
M
A
)
:
=
ne_proper_2
_
.
Global
Instance
uPred
_forall_ne
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
dist
n
)
==>
dist
n
)
(@
uPred
_forall
M
A
).
Proof
.
by
intros
n
P1
P2
HP12
x
n'
;
split
;
intros
HP
a
;
apply
HP12
.
Qed
.
Global
Instance
iprop
_forall_proper
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
≡
)
==>
(
≡
))
(@
iprop
_forall
M
A
).
Global
Instance
uPred
_forall_proper
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
≡
)
==>
(
≡
))
(@
uPred
_forall
M
A
).
Proof
.
by
intros
P1
P2
HP12
x
n'
;
split
;
intros
HP
a
;
apply
HP12
.
Qed
.
Global
Instance
iprop
_exists_ne
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
dist
n
)
==>
dist
n
)
(@
iprop
_exist
M
A
).
Global
Instance
uPred
_exists_ne
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
dist
n
)
==>
dist
n
)
(@
uPred
_exist
M
A
).
Proof
.
by
intros
n
P1
P2
HP12
x
n'
;
split
;
intros
[
a
HP
]
;
exists
a
;
apply
HP12
.
Qed
.
Global
Instance
iprop
_exist_proper
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
≡
)
==>
(
≡
))
(@
iprop
_exist
M
A
).
Global
Instance
uPred
_exist_proper
{
A
:
cofeT
}
:
Proper
(
pointwise_relation
_
(
≡
)
==>
(
≡
))
(@
uPred
_exist
M
A
).
Proof
.
by
intros
P1
P2
HP12
x
n'
;
split
;
intros
[
a
HP
]
;
exists
a
;
apply
HP12
.
Qed
.
Global
Instance
iprop
_later_contractive
:
Contractive
(@
iprop
_later
M
).
Global
Instance
uPred
_later_contractive
:
Contractive
(@
uPred
_later
M
).
Proof
.
intros
n
P
Q
HPQ
x
[|
n'
]
??
;
simpl
;
[
done
|].
apply
HPQ
;
eauto
using
cmra_valid_S
.
Qed
.
Global
Instance
iprop
_later_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
iprop
_later
M
)
:
=
ne_proper
_
.
Global
Instance
iprop
_always_ne
n
:
Proper
(
dist
n
==>
dist
n
)
(@
iprop
_always
M
).
Global
Instance
uPred
_later_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
uPred
_later
M
)
:
=
ne_proper
_
.
Global
Instance
uPred
_always_ne
n
:
Proper
(
dist
n
==>
dist
n
)
(@
uPred
_always
M
).
Proof
.
intros
P1
P2
HP
x
n'
;
split
;
apply
HP
;
eauto
using
cmra_unit_valid
.
Qed
.
Global
Instance
iprop
_always_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
iprop
_always
M
)
:
=
ne_proper
_
.
Global
Instance
iprop
_own_ne
n
:
Proper
(
dist
n
==>
dist
n
)
(@
iprop
_own
M
).
Global
Instance
uPred
_always_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
uPred
_always
M
)
:
=
ne_proper
_
.
Global
Instance
uPred
_own_ne
n
:
Proper
(
dist
n
==>
dist
n
)
(@
uPred
_own
M
).
Proof
.
by
intros
a1
a2
Ha
x
n'
;
split
;
intros
[
a'
?]
;
exists
a'
;
simpl
;
first
[
rewrite
<-(
dist_le
_
_
_
_
Ha
)
by
lia
|
rewrite
(
dist_le
_
_
_
_
Ha
)
by
lia
].
Qed
.
Global
Instance
iprop
_own_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
iprop
_own
M
)
:
=
ne_proper
_
.
Global
Instance
uPred
_own_proper
:
Proper
((
≡
)
==>
(
≡
))
(@
uPred
_own
M
)
:
=
ne_proper
_
.
(** Introduction and elimination rules *)
Lemma
iprop
_True_intro
P
:
P
⊆
True
%
I
.
Lemma
uPred
_True_intro
P
:
P
⊆
True
%
I
.
Proof
.
done
.
Qed
.
Lemma
iprop
_False_elim
P
:
False
%
I
⊆
P
.
Lemma
uPred
_False_elim
P
:
False
%
I
⊆
P
.
Proof
.
by
intros
x
n
?.
Qed
.
Lemma
iprop
_and_elim_l
P
Q
:
(
P
∧
Q
)%
I
⊆
P
.
Lemma
uPred
_and_elim_l
P
Q
:
(
P
∧
Q
)%
I
⊆
P
.
Proof
.
by
intros
x
n
?
[??].
Qed
.
Lemma
iprop
_and_elim_r
P
Q
:
(
P
∧
Q
)%
I
⊆
Q
.
Lemma
uPred
_and_elim_r
P
Q
:
(
P
∧
Q
)%
I
⊆
Q
.
Proof
.
by
intros
x
n
?
[??].
Qed
.
Lemma
iprop
_and_intro
R
P
Q
:
R
⊆
P
→
R
⊆
Q
→
R
⊆
(
P
∧
Q
)%
I
.
Lemma
uPred
_and_intro
R
P
Q
:
R
⊆
P
→
R
⊆
Q
→
R
⊆
(
P
∧
Q
)%
I
.
Proof
.
intros
HP
HQ
x
n
??
;
split
.
by
apply
HP
.
by
apply
HQ
.
Qed
.
Lemma
iprop
_or_intro_l
P
Q
:
P
⊆
(
P
∨
Q
)%
I
.
Lemma
uPred
_or_intro_l
P
Q
:
P
⊆
(
P
∨
Q
)%
I
.
Proof
.
by
left
.
Qed
.
Lemma
iprop
_or_intro_r
P
Q
:
Q
⊆
(
P
∨
Q
)%
I
.
Lemma
uPred
_or_intro_r
P
Q
:
Q
⊆
(
P
∨
Q
)%
I
.
Proof
.
by
right
.
Qed
.
Lemma
iprop
_or_elim
R
P
Q
:
P
⊆
R
→
Q
⊆
R
→
(
P
∨
Q
)%
I
⊆
R
.
Lemma
uPred
_or_elim
R
P
Q
:
P
⊆
R
→
Q
⊆
R
→
(
P
∨
Q
)%
I
⊆
R
.
Proof
.
intros
HP
HQ
x
n
?
[?|?].
by
apply
HP
.
by
apply
HQ
.
Qed
.
Lemma
iprop
_impl_intro
P
Q
R
:
(
R
∧
P
)%
I
⊆
Q
→
R
⊆
(
P
→
Q
)%
I
.
Lemma
uPred
_impl_intro
P
Q
R
:
(
R
∧
P
)%
I
⊆
Q
→
R
⊆
(
P
→
Q
)%
I
.
Proof
.
intros
HQ
x
n
??
x'
n'
????
;
apply
HQ
;
naive_solver
eauto
using
iprop
_weaken
.
intros
HQ
x
n
??
x'
n'
????
;
apply
HQ
;
naive_solver
eauto
using
uPred
_weaken
.
Qed
.
Lemma
iprop
_impl_elim
P
Q
:
((
P
→
Q
)
∧
P
)%
I
⊆
Q
.
Lemma
uPred
_impl_elim
P
Q
:
((
P
→
Q
)
∧
P
)%
I
⊆
Q
.
Proof
.
by
intros
x
n
?
[
HQ
HP
]
;
apply
HQ
.
Qed
.
Lemma
iprop
_forall_intro
P
`
(
Q
:
A
→
i
Pr
op
M
)
:
(
∀
a
,
P
⊆
Q
a
)
→
P
⊆
(
∀
a
,
Q
a
)%
I
.
Lemma
uPred
_forall_intro
P
`
(
Q
:
A
→
u
Pr
ed
M
)
:
(
∀
a
,
P
⊆
Q
a
)
→
P
⊆
(
∀
a
,
Q
a
)%
I
.
Proof
.
by
intros
HPQ
x
n
??
a
;
apply
HPQ
.
Qed
.
Lemma
iprop
_forall_elim
`
(
P
:
A
→
i
Pr
op
M
)
a
:
(
∀
a
,
P
a
)%
I
⊆
P
a
.
Lemma
uPred
_forall_elim
`
(
P
:
A
→
u
Pr
ed
M
)
a
:
(
∀
a
,
P
a
)%
I
⊆
P
a
.
Proof
.
intros
x
n
?
HP
;
apply
HP
.
Qed
.
Lemma
iprop
_exist_intro
`
(
P
:
A
→
i
Pr
op
M
)
a
:
P
a
⊆
(
∃
a
,
P
a
)%
I
.
Lemma
uPred
_exist_intro
`
(
P
:
A
→
u
Pr
ed
M
)
a
:
P
a
⊆
(
∃
a
,
P
a
)%
I
.
Proof
.
by
intros
x
n
??
;
exists
a
.
Qed
.
Lemma
iprop
_exist_elim
`
(
P
:
A
→
i
Pr
op
M
)
Q
:
(
∀
a
,
P
a
⊆
Q
)
→
(
∃
a
,
P
a
)%
I
⊆
Q
.
Lemma
uPred
_exist_elim
`
(
P
:
A
→
u
Pr
ed
M
)
Q
:
(
∀
a
,
P
a
⊆
Q
)
→
(
∃
a
,
P
a
)%
I
⊆
Q
.
Proof
.
by
intros
HPQ
x
n
?
[
a
?]
;
apply
HPQ
with
a
.
Qed
.
(* BI connectives *)
Lemma
iprop
_sep_elim_l
P
Q
:
(
P
★
Q
)%
I
⊆
P
.
Lemma
uPred
_sep_elim_l
P
Q
:
(
P
★
Q
)%
I
⊆
P
.
Proof
.
intros
x
n
Hvalid
(
x1
&
x2
&
Hx
&?&?)
;
rewrite
Hx
in
Hvalid
|-
*.
by
apply
iprop
_weaken
with
x1
n
;
auto
using
ra_included_l
.
by
apply
uPred
_weaken
with
x1
n
;
auto
using
ra_included_l
.
Qed
.
Global
Instance
iprop
_sep_left_id
:
LeftId
(
≡
)
True
%
I
(@
iprop
_sep
M
).
Global
Instance
uPred
_sep_left_id
:
LeftId
(
≡
)
True
%
I
(@
uPred
_sep
M
).
Proof
.
intros
P
x
n
Hvalid
;
split
.
*
intros
(
x1
&
x2
&
Hx
&
_
&?)
;
rewrite
Hx
in
Hvalid
|-
*.
apply
iprop
_weaken
with
x2
n
;
auto
using
ra_included_r
.
apply
uPred
_weaken
with
x2
n
;
auto
using
ra_included_r
.
*
by
intros
?
;
exists
(
unit
x
),
x
;
rewrite
ra_unit_l
.
Qed
.
Global
Instance
iprop
_sep_commutative
:
Commutative
(
≡
)
(@
iprop
_sep
M
).
Global
Instance
uPred
_sep_commutative
:
Commutative
(
≡
)
(@
uPred
_sep
M
).
Proof
.
by
intros
P
Q
x
n
?
;
split
;
intros
(
x1
&
x2
&?&?&?)
;
exists
x2
,
x1
;
rewrite
(
commutative
op
).
Qed
.
Global
Instance
iprop
_sep_associative
:
Associative
(
≡
)
(@
iprop
_sep
M
).
Global
Instance
uPred
_sep_associative
:
Associative
(
≡
)
(@
uPred
_sep
M
).
Proof
.
intros
P
Q
R
x
n
?
;
split
.
*
intros
(
x1
&
x2
&
Hx
&?&
y1
&
y2
&
Hy
&?&?)
;
exists
(
x1
⋅
y1
),
y2
;
split_ands
;
auto
.
...
...
@@ -337,65 +337,65 @@ Proof.
+
by
rewrite
(
associative
op
),
<-
Hy
,
<-
Hx
.
+
by
exists
y2
,
x2
.
Qed
.
Lemma
iprop
_wand_intro
P
Q
R
:
(
R
★
P
)%
I
⊆
Q
→
R
⊆
(
P
-
★
Q
)%
I
.
Lemma
uPred
_wand_intro
P
Q
R
:
(
R
★
P
)%
I
⊆
Q
→
R
⊆
(
P
-
★
Q
)%
I
.
Proof
.
intros
HPQ
x
n
??
x'
n'
???
;
apply
HPQ
;
auto
.
exists
x
,
x'
;
split_ands
;
auto
.
eapply
iprop
_weaken
with
x
n
;
eauto
using
cmra_valid_op_l
.
eapply
uPred
_weaken
with
x
n
;
eauto
using
cmra_valid_op_l
.
Qed
.
Lemma
iprop
_wand_elim
P
Q
:
((
P
-
★
Q
)
★
P
)%
I
⊆
Q
.
Lemma
uPred
_wand_elim
P
Q
:
((
P
-
★
Q
)
★
P
)%
I
⊆
Q
.
Proof
.
by
intros
x
n
Hvalid
(
x1
&
x2
&
Hx
&
HPQ
&?)
;
rewrite
Hx
in
Hvalid
|-
*
;
apply
HPQ
.
Qed
.
Lemma
iprop
_sep_or
P
Q
R
:
((
P
∨
Q
)
★
R
)%
I
≡
((
P
★
R
)
∨
(
Q
★
R
))%
I
.
Lemma
uPred
_sep_or
P
Q
R
:
((
P
∨
Q
)
★
R
)%
I
≡
((
P
★
R
)
∨
(
Q
★
R
))%
I
.
Proof
.
split
;
[
by
intros
(
x1
&
x2
&
Hx
&[?|?]&?)
;
[
left
|
right
]
;
exists
x1
,
x2
|].
intros
[(
x1
&
x2
&
Hx
&?&?)|(
x1
&
x2
&
Hx
&?&?)]
;
exists
x1
,
x2
;
split_ands
;
first
[
by
left
|
by
right
|
done
].