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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Service Desk
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
lambda-rust
Commits
e16a6143
Commit
e16a6143
authored
3 years ago
by
Yusuke Matsushita
Browse files
Options
Downloads
Patches
Plain Diff
More on assert
parent
abcff5ec
No related branches found
No related tags found
No related merge requests found
Pipeline
#64385
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/typing/lib/panic.v
+20
-3
20 additions, 3 deletions
theories/typing/lib/panic.v
with
20 additions
and
3 deletions
theories/typing/lib/panic.v
+
20
−
3
View file @
e16a6143
...
...
@@ -15,8 +15,7 @@ Notation "assert: e" := (if: e then #☠ else stuck_term)%E (at level 9) : expr_
Section
panic
.
Context
`{
!
typeG
Σ
}
.
Definition
panic
:
val
:=
fn
:
[]
:=
stuck_term
.
Definition
panic
:
val
:=
fn
:
[]
:=
stuck_term
.
(* Rust's panic! *)
Lemma
panic_type
:
typed_val
panic
(
fn
(
∅
)
→
∅
)
(
λ
_
_,
False
)
.
...
...
@@ -26,7 +25,6 @@ Section panic.
iMod
(
proph_obs_false
with
"PROPH Obs"
)
as
"[]"
;
[
done
|
move
=>
?[]]
.
Qed
.
(* Rust's assert! *)
Lemma
type_assert_instr
E
L
p
:
typed_instr
E
L
+
[
p
◁
bool_ty
]
(
assert
:
p
)
(
const
+
[])
(
λ
post
'
-
[
b
],
if
b
then
post
-
[]
else
False
)
.
...
...
@@ -48,4 +46,23 @@ Section panic.
iApply
type_seq
;
[
by
apply
type_assert_instr
|
solve_typing
|
|
done
]
.
destruct
Extr
as
[
Htrx
_]=>??
/=.
apply
Htrx
.
by
case
.
Qed
.
Definition
assert
:
val
:=
fn
:
[
"bb"
]
:=
let
:
"b"
:=
!
"bb"
in
delete
[
#
1
;
"bb"
];;
assert
:
"b"
;;
let
:
"r"
:=
new
[
#
0
]
in
return
:
[
"r"
]
.
(* Rust's assert! *)
Lemma
assert_type
:
typed_val
assert
(
fn
(
∅
;
bool_ty
)
→
())
(
λ
post
'
-
[
b
],
if
b
then
post
()
else
False
)
.
Proof
.
eapply
type_fn
;
[
apply
_|]=>
???[?[]]
.
simpl_subst
.
via_tr_impl
.
{
iApply
type_deref
;
[
solve_extract
|
solve_typing
|
done
|]
.
intro_subst
.
iApply
type_delete
;
[
solve_extract
|
done
..|]
.
iApply
type_assert
;
[
solve_extract
|]
.
iApply
type_new
;
[
done
|]
.
intro_subst
.
iApply
type_jump
;
[
solve_typing
|
solve_extract
|
solve_typing
]
.
}
by
move
=>
?[?[]]
.
Qed
.
End
panic
.
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