Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
George Pirlea
Iris
Commits
a314151d
Commit
a314151d
authored
Jul 25, 2016
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify weakestpre_fix construction.
parent
1c48ea12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
41 deletions
+23
-41
program_logic/weakestpre_fix.v
program_logic/weakestpre_fix.v
+23
-41
No files found.
program_logic/weakestpre_fix.v
View file @
a314151d
...
...
@@ -13,11 +13,10 @@ wp on paper. We show that the two versions are equivalent. *)
Section
def
.
Context
{
Λ
:
language
}
{
Σ
:
iFunctor
}.
Local
Notation
iProp
:
=
(
iProp
Λ
Σ
).
Local
Notation
coPsetC
:
=
(
leibnizC
(
coPset
)).
Program
Definition
wp_pre
(
wp
:
coPset
C
-
n
>
expr
C
Λ
-
n
>
(
val
C
Λ
-
n
>
iProp
)
-
n
>
iProp
)
(
E
:
coPset
)
(
e1
:
expr
Λ
)
(
Φ
:
val
C
Λ
-
n
>
iProp
)
:
iProp
:
=
(
wp
:
coPset
-
c
>
expr
Λ
-
c
>
(
val
Λ
-
c
>
iProp
)
-
c
>
iProp
)
:
coPset
-
c
>
expr
Λ
-
c
>
(
val
Λ
-
c
>
iProp
)
-
c
>
iProp
:
=
λ
E
e1
Φ
,
{|
uPred_holds
n
r1
:
=
∀
k
Ef
σ
1
rf
,
0
≤
k
<
n
→
E
⊥
Ef
→
wsat
(
S
k
)
(
E
∪
Ef
)
σ
1
(
r1
⋅
rf
)
→
...
...
@@ -46,49 +45,32 @@ Next Obligation.
Qed
.
Next
Obligation
.
repeat
intro
;
eauto
.
Qed
.
Lemma
wp_pre_contractive'
n
E
e
Φ
1
Φ
2
r
(
wp1
wp2
:
coPsetC
-
n
>
exprC
Λ
-
n
>
(
valC
Λ
-
n
>
iProp
)
-
n
>
iProp
)
:
(
∀
i
:
nat
,
i
<
n
→
wp1
≡
{
i
}
≡
wp2
)
→
Φ
1
≡
{
n
}
≡
Φ
2
→
wp_pre
wp1
E
e
Φ
1
n
r
→
wp_pre
wp2
E
e
Φ
2
n
r
.
Local
Instance
pre_wp_contractive
:
Contractive
wp_pre
.
Proof
.
intros
HI
H
Φ
Hwp
k
Ef
σ
1
rf
???.
destruct
(
Hwp
k
Ef
σ
1
rf
)
as
[
Hval
Hstep
]
;
auto
.
split
.
{
intros
v
?.
destruct
(
Hval
v
)
as
(
r2
&?&?)
;
auto
.
exists
r2
.
split
;
[
apply
H
Φ
|]
;
auto
.
}
intros
??.
destruct
Hstep
as
[
Hred
Hpstep
]
;
auto
.
split
;
[
done
|]=>
e2
σ
2
ef
?.
destruct
(
Hpstep
e2
σ
2
ef
)
as
(
r2
&
r2'
&?&?&?)
;
[
done
..|].
exists
r2
,
r2'
;
split_and
?
;
auto
.
-
apply
HI
with
k
;
auto
.
assert
(
wp1
E
e2
Φ
2
≡
{
n
}
≡
wp1
E
e2
Φ
1
)
as
Hwp
Φ
by
(
by
rewrite
H
Φ
).
apply
Hwp
Φ
;
auto
.
-
destruct
ef
as
[
ef
|]
;
simpl
in
*
;
last
done
.
apply
HI
with
k
;
auto
.
Qed
.
Instance
wp_pre_ne
n
wp
E
e
:
Proper
(
dist
n
==>
dist
n
)
(
wp_pre
wp
E
e
).
Proof
.
split
;
split
;
eapply
wp_pre_contractive'
;
eauto
using
dist_le
,
(
symmetry
(
R
:
=
dist
_
)).
Qed
.
Definition
wp_preC
(
wp
:
coPsetC
-
n
>
exprC
Λ
-
n
>
(
valC
Λ
-
n
>
iProp
)
-
n
>
iProp
)
:
coPsetC
-
n
>
exprC
Λ
-
n
>
(
valC
Λ
-
n
>
iProp
)
-
n
>
iProp
:
=
CofeMor
(
λ
E
:
coPsetC
,
CofeMor
(
λ
e
:
exprC
Λ
,
CofeMor
(
wp_pre
wp
E
e
))).
Local
Instance
pre_wp_contractive
:
Contractive
wp_preC
.
Proof
.
split
;
split
;
eapply
wp_pre_contractive'
;
auto
using
(
symmetry
(
R
:
=
dist
_
)).
assert
(
∀
n
E
e
Φ
r
(
wp1
wp2
:
coPset
-
c
>
expr
Λ
-
c
>
(
val
Λ
-
c
>
iProp
)
-
c
>
iProp
),
(
∀
i
:
nat
,
i
<
n
→
wp1
≡
{
i
}
≡
wp2
)
→
wp_pre
wp1
E
e
Φ
n
r
→
wp_pre
wp2
E
e
Φ
n
r
)
as
help
.
{
intros
n
E
e
Φ
r
wp1
wp2
HI
Hwp
k
Ef
σ
1
rf
???.
destruct
(
Hwp
k
Ef
σ
1
rf
)
as
[
Hval
Hstep
]
;
auto
.
split
;
first
done
.
intros
??.
destruct
Hstep
as
[
Hred
Hpstep
]
;
auto
.
split
;
[
done
|]=>
e2
σ
2
ef
?.
destruct
(
Hpstep
e2
σ
2
ef
)
as
(
r2
&
r2'
&?&?&?)
;
[
done
..|].
exists
r2
,
r2'
;
split_and
?
;
auto
.
-
apply
HI
with
k
;
auto
.
-
destruct
ef
as
[
ef
|]
;
simpl
in
*
;
last
done
.
apply
HI
with
k
;
auto
.
}
split
;
split
;
eapply
help
;
auto
using
(
symmetry
(
R
:
=
dist
_
)).
Qed
.
Definition
wp_fix
:
coPset
C
-
n
>
expr
C
Λ
-
n
>
(
val
C
Λ
-
n
>
iProp
)
-
n
>
iProp
:
=
fixpoint
wp_pre
C
.
Definition
wp_fix
:
coPset
→
expr
Λ
→
(
val
Λ
→
iProp
)
→
iProp
:
=
fixpoint
wp_pre
.
Lemma
wp_fix_unfold
E
e
Φ
:
wp_fix
E
e
Φ
⊣
⊢
wp_pre
C
wp_fix
E
e
Φ
.
Proof
.
by
rewrite
/
wp_fix
-
fixpoint_unfold
.
Qed
.
Lemma
wp_fix_unfold
E
e
Φ
:
wp_fix
E
e
Φ
⊣
⊢
wp_pre
wp_fix
E
e
Φ
.
Proof
.
apply
(
fixpoint_unfold
wp_pre
)
.
Qed
.
Lemma
wp_fix_correct
E
e
(
Φ
:
val
C
Λ
-
n
>
iProp
)
:
wp_fix
E
e
Φ
⊣
⊢
wp
E
e
Φ
.
Lemma
wp_fix_correct
E
e
(
Φ
:
val
Λ
→
iProp
)
:
wp_fix
E
e
Φ
⊣
⊢
wp
E
e
Φ
.
Proof
.
split
=>
n
r
Hr
.
rewrite
wp_eq
/
wp_def
{
2
}/
uPred_holds
.
split
;
revert
r
E
e
Φ
Hr
.
...
...
Write
Preview
Markdown
is supported
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