Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
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
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Pierre Roux
Iris
Commits
6ac4c4eb
Commit
6ac4c4eb
authored
6 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
move option notation to lang.v so we can use it to define CAS compare safety
parent
53216eb5
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/heap_lang/lang.v
+12
-6
12 additions, 6 deletions
theories/heap_lang/lang.v
theories/heap_lang/notation.v
+0
-6
0 additions, 6 deletions
theories/heap_lang/notation.v
with
12 additions
and
12 deletions
theories/heap_lang/lang.v
+
12
−
6
View file @
6ac4c4eb
...
@@ -66,6 +66,9 @@ Inductive expr :=
...
@@ -66,6 +66,9 @@ Inductive expr :=
|
CAS
(
e0
:
expr
)
(
e1
:
expr
)
(
e2
:
expr
)
|
CAS
(
e0
:
expr
)
(
e1
:
expr
)
(
e2
:
expr
)
|
FAA
(
e1
:
expr
)
(
e2
:
expr
)
.
|
FAA
(
e1
:
expr
)
(
e2
:
expr
)
.
Notation
NONE
:=
(
InjL
(
Lit
LitUnit
))
(
only
parsing
)
.
Notation
SOME
x
:=
(
InjR
x
)
(
only
parsing
)
.
Bind
Scope
expr_scope
with
expr
.
Bind
Scope
expr_scope
with
expr
.
Fixpoint
is_closed
(
X
:
list
string
)
(
e
:
expr
)
:
bool
:=
Fixpoint
is_closed
(
X
:
list
string
)
(
e
:
expr
)
:
bool
:=
...
@@ -94,6 +97,9 @@ Inductive val :=
...
@@ -94,6 +97,9 @@ Inductive val :=
|
InjLV
(
v
:
val
)
|
InjLV
(
v
:
val
)
|
InjRV
(
v
:
val
)
.
|
InjRV
(
v
:
val
)
.
Notation
NONEV
:=
(
InjLV
(
LitV
LitUnit
))
(
only
parsing
)
.
Notation
SOMEV
x
:=
(
InjRV
x
)
(
only
parsing
)
.
Bind
Scope
val_scope
with
val
.
Bind
Scope
val_scope
with
val
.
Fixpoint
of_val
(
v
:
val
)
:
expr
:=
Fixpoint
of_val
(
v
:
val
)
:
expr
:=
...
@@ -365,12 +371,12 @@ Definition bin_op_eval (op : bin_op) (v1 v2 : val) : option val :=
...
@@ -365,12 +371,12 @@ Definition bin_op_eval (op : bin_op) (v1 v2 : val) : option val :=
Definition
vals_cas_compare_safe
(
vl
v1
:
val
)
:
Prop
:=
Definition
vals_cas_compare_safe
(
vl
v1
:
val
)
:
Prop
:=
match
vl
,
v1
with
match
vl
,
v1
with
|
LitV
_,
LitV
_
=>
True
|
LitV
_,
LitV
_
=>
True
(* We want to support CAS'ing [NONEV
:= InjLV LitUnit] to [SOMEV #l := InjRV
(* We want to support CAS'ing [NONEV
] to [SOMEV #l]. An implementation of
(LitV l)]. An implementation of
this is possible if literals have an invalid
this is possible if literals have an invalid
bit pattern that can be used to
bit pattern that can be used to
represent NONE. *)
represent NONE. *)
|
InjLV
(
LitV
LitUnit
),
InjLV
(
LitV
LitUnit
)
=>
True
|
NONEV
,
NONEV
=>
True
|
InjLV
(
LitV
LitUnit
),
InjR
V
(
LitV
_)
=>
True
|
NONEV
,
SOME
V
(
LitV
_)
=>
True
|
InjR
V
(
LitV
_),
InjLV
(
LitV
LitUnit
)
=>
True
|
SOME
V
(
LitV
_),
NONEV
=>
True
|
_,
_
=>
False
|
_,
_
=>
False
end
.
end
.
(** Just a sanity check. *)
(** Just a sanity check. *)
...
...
This diff is collapsed.
Click to expand it.
theories/heap_lang/notation.v
+
0
−
6
View file @
6ac4c4eb
...
@@ -144,12 +144,6 @@ Notation "e1 || e2" :=
...
@@ -144,12 +144,6 @@ Notation "e1 || e2" :=
(
If
e1
%
E
(
Lit
(
LitBool
true
))
e2
%
E
)
(
only
parsing
)
:
expr_scope
.
(
If
e1
%
E
(
Lit
(
LitBool
true
))
e2
%
E
)
(
only
parsing
)
:
expr_scope
.
(** Notations for option *)
(** Notations for option *)
Notation
NONE
:=
(
InjL
#
())
(
only
parsing
)
.
Notation
SOME
x
:=
(
InjR
x
)
(
only
parsing
)
.
Notation
NONEV
:=
(
InjLV
#
())
(
only
parsing
)
.
Notation
SOMEV
x
:=
(
InjRV
x
)
(
only
parsing
)
.
Notation
"'match:' e0 'with' 'NONE' => e1 | 'SOME' x => e2 'end'"
:=
Notation
"'match:' e0 'with' 'NONE' => e1 | 'SOME' x => e2 'end'"
:=
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
...
...
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