Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambda-rust
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Simon Spies
lambda-rust
Commits
1b2ed249
Commit
1b2ed249
authored
8 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
experiment with writing rules as Hoare triples (for proofs about unsafe code)
parent
c21039a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/typing/fixpoint.v
+0
-3
0 additions, 3 deletions
theories/typing/fixpoint.v
theories/typing/programs.v
+20
-7
20 additions, 7 deletions
theories/typing/programs.v
with
20 additions
and
10 deletions
theories/typing/fixpoint.v
+
0
−
3
View file @
1b2ed249
...
@@ -8,9 +8,6 @@ Section fixpoint.
...
@@ -8,9 +8,6 @@ Section fixpoint.
Context
(
T
:
type
→
type
)
`{
Contractive
T
}
.
Context
(
T
:
type
→
type
)
`{
Contractive
T
}
.
(* FIXME : Contrarily to the rule on paper, these rules are
coinductive: they let one assume [ty] is [Copy]/[Send]/[Sync] to
prove that [T ty] is [Copy]/[Send]/[Sync]. *)
Global
Instance
fixpoint_copy
:
Global
Instance
fixpoint_copy
:
(
∀
`
(
!
Copy
ty
),
Copy
(
T
ty
))
→
Copy
(
fixpoint
T
)
.
(
∀
`
(
!
Copy
ty
),
Copy
(
T
ty
))
→
Copy
(
fixpoint
T
)
.
Proof
.
Proof
.
...
...
This diff is collapsed.
Click to expand it.
theories/typing/programs.v
+
20
−
7
View file @
1b2ed249
...
@@ -157,13 +157,15 @@ Section typing_rules.
...
@@ -157,13 +157,15 @@ Section typing_rules.
by
iFrame
.
by
iFrame
.
Qed
.
Qed
.
Lemma
type_memcpy
E
L
ty1
ty1'
ty2
ty2'
ty
n
p1
p2
:
Lemma
type_memcpy
_iris
E
qE
L
qL
tid
ty1
ty1'
ty2
ty2'
ty
n
p1
p2
:
ty
.(
ty_size
)
=
n
→
typed_write
E
L
ty1
ty
ty1'
→
typed_read
E
L
ty2
ty
ty2'
→
ty
.(
ty_size
)
=
n
→
typed_write
E
L
ty1
ty
ty1'
→
typed_read
E
L
ty2
ty
ty2'
→
typed_instruction
E
L
[
p1
◁
ty1
;
p2
◁
ty2
]
(
p1
<-
{
n
}
!
p2
)
{{{
heap_ctx
∗
lft_ctx
∗
na_own
tid
⊤
∗
elctx_interp
E
qE
∗
llctx_interp
L
qL
∗
(
λ
_,
[
p1
◁
ty1'
;
p2
◁
ty2'
]
%
TC
)
.
tctx_elt_interp
tid
(
p1
◁
ty1
)
∗
tctx_elt_interp
tid
(
p2
◁
ty2
)
}}}
(
p1
<-
{
n
}
!
p2
)
{{{
RET
#
();
na_own
tid
⊤
∗
elctx_interp
E
qE
∗
llctx_interp
L
qL
∗
tctx_elt_interp
tid
(
p1
◁
ty1'
)
∗
tctx_elt_interp
tid
(
p2
◁
ty2'
)
}}}
.
Proof
.
Proof
.
iIntros
(
Hsz
Hwrt
Hread
tid
qE
)
"#HEAP #LFT Htl [HE1 HE2] [HL1 HL2]"
.
iIntros
(
Hsz
Hwrt
Hread
Φ
)
"(#HEAP & #LFT & Htl & [HE1 HE2] & [HL1 HL2] & [Hp1 Hp2]) HΦ"
.
rewrite
tctx_interp_cons
tctx_interp_singleton
.
iIntros
"[Hp1 Hp2]"
.
wp_bind
p1
.
iApply
(
wp_hasty
with
"Hp1"
)
.
iIntros
(
v1
)
"% Hown1"
.
wp_bind
p1
.
iApply
(
wp_hasty
with
"Hp1"
)
.
iIntros
(
v1
)
"% Hown1"
.
wp_bind
p2
.
iApply
(
wp_hasty
with
"Hp2"
)
.
iIntros
(
v2
)
"% Hown2"
.
wp_bind
p2
.
iApply
(
wp_hasty
with
"Hp2"
)
.
iIntros
(
v2
)
"% Hown2"
.
iMod
(
Hwrt
with
"* LFT HE1 HL1 Hown1"
)
iMod
(
Hwrt
with
"* LFT HE1 HL1 Hown1"
)
...
@@ -173,9 +175,20 @@ Section typing_rules.
...
@@ -173,9 +175,20 @@ Section typing_rules.
iAssert
(
▷⌜
length
vl2
=
ty
.(
ty_size
)
⌝
)
%
I
with
"[#]"
as
">%"
.
iAssert
(
▷⌜
length
vl2
=
ty
.(
ty_size
)
⌝
)
%
I
with
"[#]"
as
">%"
.
{
by
iApply
ty_size_eq
.
}
subst
v1
v2
.
iApply
wp_fupd
.
{
by
iApply
ty_size_eq
.
}
subst
v1
v2
.
iApply
wp_fupd
.
iApply
(
wp_memcpy
with
"[$HEAP $Hl1 $Hl2]"
);
first
done
;
try
congruence
;
[]
.
iApply
(
wp_memcpy
with
"[$HEAP $Hl1 $Hl2]"
);
first
done
;
try
congruence
;
[]
.
rewrite
tctx_interp_cons
tctx_interp_singleton
!
tctx_hasty_val'
//.
iNext
.
iIntros
"[Hl1 Hl2]"
.
iApply
(
"HΦ"
with
">"
)
.
rewrite
!
tctx_hasty_val'
//.
iNext
.
iIntros
"[Hl1 Hl2]"
.
iMod
(
"Hcl1"
with
"[Hl1 Hown2]"
)
as
"($ & $ & $)"
.
iMod
(
"Hcl1"
with
"[Hl1 Hown2]"
)
as
"($ & $ & $)"
.
{
iExists
_
.
iFrame
.
}
{
iExists
_
.
iFrame
.
}
iMod
(
"Hcl2"
with
"Hl2"
)
as
"($ & $ & $ & $)"
.
done
.
iMod
(
"Hcl2"
with
"Hl2"
)
as
"($ & $ & $ & $)"
.
done
.
Qed
.
Qed
.
Lemma
type_memcpy
E
L
ty1
ty1'
ty2
ty2'
ty
n
p1
p2
:
ty
.(
ty_size
)
=
n
→
typed_write
E
L
ty1
ty
ty1'
→
typed_read
E
L
ty2
ty
ty2'
→
typed_instruction
E
L
[
p1
◁
ty1
;
p2
◁
ty2
]
(
p1
<-
{
n
}
!
p2
)
(
λ
_,
[
p1
◁
ty1'
;
p2
◁
ty2'
]
%
TC
)
.
Proof
.
iIntros
(
Hsz
Hwrt
Hread
tid
qE
)
"#HEAP #LFT Htl HE HL HT"
.
iApply
(
type_memcpy_iris
with
"[$HEAP $LFT $Htl $HE $HL HT]"
);
try
done
.
{
by
rewrite
tctx_interp_cons
tctx_interp_singleton
.
}
rewrite
tctx_interp_cons
tctx_interp_singleton
.
auto
.
Qed
.
End
typing_rules
.
End
typing_rules
.
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