Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
examples
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
examples
Merge requests
!2
Amin/logrel
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Amin/logrel
amin/logrel
into
master
Overview
5
Commits
3
Pipelines
0
Changes
43
1 unresolved thread
Hide all comments
Merged
Amin Timany
requested to merge
amin/logrel
into
master
7 years ago
Overview
5
Commits
3
Pipelines
0
Changes
43
1 unresolved thread
Hide all comments
Expand
Add logical relations from IPM paper to iris-examples. This closes
#2 (closed)
.
0
0
Merge request reports
Compare
master
version 1
d593a8fc
7 years ago
master (base)
and
latest version
latest version
eff14744
3 commits,
7 years ago
version 1
d593a8fc
2 commits,
7 years ago
43 files
+
7387
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
43
Search (e.g. *.vue) (Ctrl+P)
theories/logrel/F_mu/fundamental.v
0 → 100644
+
88
−
0
Options
From
iris_examples
.
logrel
.
F_mu
Require
Export
logrel
.
From
iris
.
program_logic
Require
Import
lifting
.
From
iris
.
proofmode
Require
Import
tactics
.
From
iris_examples
.
logrel
.
F_mu
Require
Import
rules
.
From
iris
.
base_logic
Require
Export
big_op
.
Definition
log_typed
`{
irisG
F_mu_lang
Σ
}
(
Γ
:
list
type
)
(
e
:
expr
)
(
τ
:
type
)
:=
∀
Δ
vs
,
env_Persistent
Δ
→
⟦
Γ
⟧
*
Δ
vs
⊢
⟦
τ
⟧
ₑ
Δ
e
.[
env_subst
vs
]
.
Notation
"Γ ⊨ e : τ"
:=
(
log_typed
Γ
e
τ
)
(
at
level
74
,
e
,
τ
at
next
level
)
.
Section
fundamental
.
Context
`{
irisG
F_mu_lang
Σ
}
.
Notation
D
:=
(
valC
-
n
>
iProp
Σ
)
.
Local
Tactic
Notation
"smart_wp_bind"
uconstr
(
ctx
)
ident
(
v
)
constr
(
Hv
)
uconstr
(
Hp
)
:=
iApply
(
wp_bind
(
fill
[
ctx
]));
iApply
(
wp_wand
with
"[-]"
);
[
iApply
Hp
;
trivial
|];
cbn
;
iIntros
(
v
)
Hv
.
Theorem
fundamental
Γ
e
τ
:
Γ
⊢
ₜ
e
:
τ
→
Γ
⊨
e
:
τ
.
Proof
.
induction
1
;
iIntros
(
Δ
vs
HΔ
)
"#HΓ"
;
cbn
.
-
(* var *)
iDestruct
(
interp_env_Some_l
with
"HΓ"
)
as
(
v
)
"[% ?]"
;
first
done
.
rewrite
/
env_subst
.
simplify_option_eq
.
by
iApply
wp_value
.
-
(* unit *)
by
iApply
wp_value
.
-
(* pair *)
smart_wp_bind
(
PairLCtx
e2
.[
env_subst
vs
])
v
"# Hv"
IHtyped1
.
smart_wp_bind
(
PairRCtx
v
)
v'
"# Hv'"
IHtyped2
.
iApply
wp_value
;
eauto
10
.
-
(* fst *)
smart_wp_bind
(
FstCtx
)
v
"# Hv"
IHtyped
;
cbn
.
iDestruct
"Hv"
as
(
w1
w2
)
"#[% [H2 H3]]"
;
subst
.
simpl
.
iApply
wp_pure_step_later
;
auto
.
by
iApply
wp_value
.
-
(* snd *)
smart_wp_bind
(
SndCtx
)
v
"# Hv"
IHtyped
;
cbn
.
iDestruct
"Hv"
as
(
w1
w2
)
"#[% [H2 H3]]"
;
subst
.
simpl
.
iApply
wp_pure_step_later
;
eauto
.
by
iApply
wp_value
.
-
(* injl *)
smart_wp_bind
(
InjLCtx
)
v
"# Hv"
IHtyped
;
cbn
.
iApply
wp_value
;
eauto
.
-
(* injr *)
smart_wp_bind
(
InjRCtx
)
v
"# Hv"
IHtyped
;
cbn
.
iApply
wp_value
;
eauto
.
-
(* case *)
smart_wp_bind
(
CaseCtx
_
_)
v
"#Hv"
IHtyped1
;
cbn
.
iDestruct
(
interp_env_length
with
"HΓ"
)
as
%
?
.
iDestruct
"Hv"
as
"[Hv|Hv]"
;
iDestruct
"Hv"
as
(
w
)
"[% Hw]"
;
simplify_eq
/=.
+
iApply
wp_pure_step_later
;
auto
;
asimpl
.
iNext
.
erewrite
typed_subst_head_simpl
by
naive_solver
.
iApply
(
IHtyped2
Δ
(
w
::
vs
))
.
iApply
interp_env_cons
;
auto
.
+
iApply
wp_pure_step_later
;
auto
1
using
to_of_val
;
asimpl
.
iNext
.
erewrite
typed_subst_head_simpl
by
naive_solver
.
iApply
(
IHtyped3
Δ
(
w
::
vs
))
.
iApply
interp_env_cons
;
auto
.
-
(* lam *)
iApply
wp_value
;
simpl
;
iAlways
;
iIntros
(
w
)
"#Hw"
.
iDestruct
(
interp_env_length
with
"HΓ"
)
as
%
?
.
iApply
wp_pure_step_later
;
auto
1
using
to_of_val
.
iNext
.
asimpl
.
erewrite
typed_subst_head_simpl
by
naive_solver
.
iApply
(
IHtyped
Δ
(
w
::
vs
))
.
iApply
interp_env_cons
;
auto
.
-
(* app *)
smart_wp_bind
(
AppLCtx
(
e2
.[
env_subst
vs
]))
v
"#Hv"
IHtyped1
.
smart_wp_bind
(
AppRCtx
v
)
w
"#Hw"
IHtyped2
.
iApply
wp_mono
;
[|
iApply
"Hv"
];
auto
.
-
(* TLam *)
iApply
wp_value
;
simpl
.
iAlways
;
iIntros
(
τi
)
"%"
.
iApply
wp_pure_step_later
;
auto
.
iNext
.
iApply
IHtyped
.
by
iApply
interp_env_ren
.
-
(* TApp *)
smart_wp_bind
TAppCtx
v
"#Hv"
IHtyped
;
cbn
.
iApply
wp_wand_r
;
iSplitL
;
[
iApply
(
"Hv"
$!
(
⟦
τ'
⟧
Δ
));
iPureIntro
;
apply
_|]
.
iIntros
(
w
)
"?"
.
by
rewrite
interp_subst
.
-
(* Fold *)
smart_wp_bind
FoldCtx
v
"#Hv"
IHtyped
;
cbn
.
iApply
wp_value
.
rewrite
/=
-
interp_subst
fixpoint_unfold
/=.
iAlways
;
eauto
.
-
(* Unfold *)
iApply
(
wp_bind
(
fill
[
UnfoldCtx
]));
iApply
wp_wand_l
;
iSplitL
;
[|
iApply
IHtyped
;
trivial
]
.
iIntros
(
v
)
"#Hv"
.
rewrite
/=
fixpoint_unfold
.
change
(
fixpoint
_)
with
(
⟦
TRec
τ
⟧
Δ
);
simpl
.
iDestruct
"Hv"
as
(
w
)
"#[% Hw]"
;
subst
;
simpl
.
iApply
wp_pure_step_later
;
auto
.
iApply
wp_value
;
iNext
.
by
rewrite
-
interp_subst
.
Qed
.
End
fundamental
.
Loading