Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
transfinite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
transfinite
Commits
7894bd0d
Commit
7894bd0d
authored
5 months ago
by
Simon Spies
Browse files
Options
Downloads
Patches
Plain Diff
add an example instance
parent
6ee7c69e
No related branches found
No related tags found
No related merge requests found
Pipeline
#110506
passed
5 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/examples/refinements/memoization.v
+42
-0
42 additions, 0 deletions
theories/examples/refinements/memoization.v
with
42 additions
and
0 deletions
theories/examples/refinements/memoization.v
+
42
−
0
View file @
7894bd0d
...
...
@@ -20,6 +20,16 @@ Proof.
intros
?
%
IHK
.
by
eapply
fill_item_injective
.
Qed
.
Lemma
pure_exec_pure_step
(
e1
e2
:
expr
)
φ
:
PureExec
φ
1 e1
e2
→
φ
→
pure_step
e1
e2
.
Proof
.
intros
Hpure
Hφ
.
eapply
nsteps_once_inv
,
Hpure
,
Hφ
.
Qed
.
Definition
eq_heaplang
:
val
:=
(
λ
:
"n1"
"n2"
,
"n1"
=
"n2"
)
.
Notation
exec
:=
(
tc
(
@
pure_step
heap_lang
))
.
...
...
@@ -1910,5 +1920,37 @@ Section levenshtein.
}
iApply
"H"
.
Qed
.
Definition
lev_mem
:
val
:=
λ
:
"x"
,
(
let
:
"strlen"
:=
mem_rec
eq_heaplang
strlen_template
in
mem_rec
eq_pair
(
lev_template
"strlen"
))
"x"
.
Definition
lev_src
:
val
:=
λ
:
"x"
,
lev
"x"
.
Lemma
lev_deep_memoized_refinement
K
(
x
y
:
val
)
:
src
(
fill
K
(
lev_src
y
))
∗
pair_imm_stringRel
x
y
⊢
SEQ
(
lev_mem
x
)
⟨⟨
w
,
∃
w'
,
src
(
fill
K
(
Val
w'
))
∗
natRel
w
w'
⟩⟩
.
Proof
using
Sync
Fin
.
iIntros
"[Hsrc Himm] Hna"
.
iApply
(
rwp_take_step
with
"[Himm Hna] [Hsrc]"
);
first
done
;
last
first
.
{
iApply
(
step_pure_cred
with
"Hsrc"
)
.
apply
:
pure_step_ctx
.
rewrite
/
lev_src
.
apply
:
pure_exec_pure_step
.
done
.
}
simpl
.
iIntros
"[Hsrc Hc]"
.
wp_rec
.
wp_bind
((
let
:
"strlen"
:=
mem_rec
eq_heaplang
strlen_template
in
mem_rec
eq_pair
(
lev_template
"strlen"
)))
%
E
.
iApply
(
rwp_wand
with
"[Hc Hna]"
)
.
{
iApply
(
lev_deep_memoized
with
"[Hc] Hna"
)
.
iDestruct
"Hc"
as
"[Hc1 Hc2]"
.
iFrame
"Hc1 Hc2"
.
}
iIntros
(
w
)
"[Hna Himpl]"
.
rewrite
/
tf_implements
.
iSpecialize
(
"Himpl"
$!
_
_
0
with
"Himm Hsrc Hna"
)
.
iApply
(
rwp_wand
with
"Himpl"
)
.
iIntros
(
u
)
"[Hna Hrel]"
.
iDestruct
"Hrel"
as
(
w'
)
"[Hnat [_ [Hsrc _]]]"
.
iFrame
.
iExists
_
.
iFrame
.
Qed
.
End
levenshtein
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment