Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris-coq
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
Janno
iris-coq
Commits
678fdce7
Commit
678fdce7
authored
9 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
switch the language over to integers
tests.v is temporarily broken
parent
6a054461
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
heap_lang/derived.v
+6
-6
6 additions, 6 deletions
heap_lang/derived.v
heap_lang/heap_lang.v
+10
-7
10 additions, 7 deletions
heap_lang/heap_lang.v
heap_lang/notation.v
+3
-1
3 additions, 1 deletion
heap_lang/notation.v
with
19 additions
and
14 deletions
heap_lang/derived.v
+
6
−
6
View file @
678fdce7
...
...
@@ -32,28 +32,28 @@ Proof.
by
rewrite
-
wp_let
//=
?gsubst_correct
?subst_empty
?to_of_val
.
Qed
.
Lemma
wp_le
E
(
n1
n2
:
nat
)
P
Q
:
Lemma
wp_le
E
(
n1
n2
:
Z
)
P
Q
:
(
n1
≤
n2
→
P
⊑
▷
Q
(
LitV
$
LitBool
true
))
→
(
n2
<
n1
→
P
⊑
▷
Q
(
LitV
$
LitBool
false
))
→
P
⊑
wp
E
(
BinOp
LeOp
(
Lit
$
Lit
Na
t
n1
)
(
Lit
$
Lit
Na
t
n2
))
Q
.
P
⊑
wp
E
(
BinOp
LeOp
(
Lit
$
Lit
In
t
n1
)
(
Lit
$
Lit
In
t
n2
))
Q
.
Proof
.
intros
.
rewrite
-
wp_bin_op
//
;
[]
.
destruct
(
bool_decide_reflect
(
n1
≤
n2
));
by
eauto
with
omega
.
Qed
.
Lemma
wp_lt
E
(
n1
n2
:
nat
)
P
Q
:
Lemma
wp_lt
E
(
n1
n2
:
Z
)
P
Q
:
(
n1
<
n2
→
P
⊑
▷
Q
(
LitV
$
LitBool
true
))
→
(
n2
≤
n1
→
P
⊑
▷
Q
(
LitV
$
LitBool
false
))
→
P
⊑
wp
E
(
BinOp
LtOp
(
Lit
$
Lit
Na
t
n1
)
(
Lit
$
Lit
Na
t
n2
))
Q
.
P
⊑
wp
E
(
BinOp
LtOp
(
Lit
$
Lit
In
t
n1
)
(
Lit
$
Lit
In
t
n2
))
Q
.
Proof
.
intros
.
rewrite
-
wp_bin_op
//
;
[]
.
destruct
(
bool_decide_reflect
(
n1
<
n2
));
by
eauto
with
omega
.
Qed
.
Lemma
wp_eq
E
(
n1
n2
:
nat
)
P
Q
:
Lemma
wp_eq
E
(
n1
n2
:
Z
)
P
Q
:
(
n1
=
n2
→
P
⊑
▷
Q
(
LitV
$
LitBool
true
))
→
(
n1
≠
n2
→
P
⊑
▷
Q
(
LitV
$
LitBool
false
))
→
P
⊑
wp
E
(
BinOp
EqOp
(
Lit
$
Lit
Na
t
n1
)
(
Lit
$
Lit
Na
t
n2
))
Q
.
P
⊑
wp
E
(
BinOp
EqOp
(
Lit
$
Lit
In
t
n1
)
(
Lit
$
Lit
In
t
n2
))
Q
.
Proof
.
intros
.
rewrite
-
wp_bin_op
//
;
[]
.
destruct
(
bool_decide_reflect
(
n1
=
n2
));
by
eauto
with
omega
.
...
...
This diff is collapsed.
Click to expand it.
heap_lang/heap_lang.v
+
10
−
7
View file @
678fdce7
...
...
@@ -2,13 +2,15 @@ Require Export program_logic.language prelude.strings.
Require
Import
prelude
.
gmap
.
Module
heap_lang
.
Open
Scope
Z_scope
.
(** Expressions and vals. *)
Definition
loc
:=
positive
.
(* Really, any countable type. *)
Inductive
base_lit
:
Set
:=
|
Lit
Na
t
(
n
:
nat
)
|
LitBool
(
b
:
bool
)
|
LitUnit
.
|
Lit
In
t
(
n
:
Z
)
|
LitBool
(
b
:
bool
)
|
LitUnit
.
Inductive
un_op
:
Set
:=
|
NegOp
.
|
NegOp
|
MinusUnOp
.
Inductive
bin_op
:
Set
:=
|
PlusOp
|
MinusOp
|
LeOp
|
LtOp
|
EqOp
.
...
...
@@ -152,16 +154,17 @@ Fixpoint subst (e : expr) (x : string) (v : val) : expr :=
Definition
un_op_eval
(
op
:
un_op
)
(
l
:
base_lit
)
:
option
base_lit
:=
match
op
,
l
with
|
NegOp
,
LitBool
b
=>
Some
(
LitBool
(
negb
b
))
|
MinusUnOp
,
LitInt
n
=>
Some
(
LitInt
(
-
n
))
|
_,
_
=>
None
end
.
Definition
bin_op_eval
(
op
:
bin_op
)
(
l1
l2
:
base_lit
)
:
option
base_lit
:=
match
op
,
l1
,
l2
with
|
PlusOp
,
Lit
Na
t
n1
,
Lit
Na
t
n2
=>
Some
$
Lit
Na
t
(
n1
+
n2
)
|
MinusOp
,
Lit
Na
t
n1
,
Lit
Na
t
n2
=>
Some
$
Lit
Na
t
(
n1
-
n2
)
|
LeOp
,
Lit
Na
t
n1
,
Lit
Na
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
≤
n2
)
|
LtOp
,
Lit
Na
t
n1
,
Lit
Na
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
<
n2
)
|
EqOp
,
Lit
Na
t
n1
,
Lit
Na
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
=
n2
)
|
PlusOp
,
Lit
In
t
n1
,
Lit
In
t
n2
=>
Some
$
Lit
In
t
(
n1
+
n2
)
|
MinusOp
,
Lit
In
t
n1
,
Lit
In
t
n2
=>
Some
$
Lit
In
t
(
n1
-
n2
)
|
LeOp
,
Lit
In
t
n1
,
Lit
In
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
≤
n2
)
|
LtOp
,
Lit
In
t
n1
,
Lit
In
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
<
n2
)
|
EqOp
,
Lit
In
t
n1
,
Lit
In
t
n2
=>
Some
$
LitBool
$
bool_decide
(
n1
=
n2
)
|
_,
_,
_
=>
None
end
.
...
...
This diff is collapsed.
Click to expand it.
heap_lang/notation.v
+
3
−
1
View file @
678fdce7
...
...
@@ -4,7 +4,7 @@ Delimit Scope lang_scope with L.
Bind
Scope
lang_scope
with
expr
val
.
Arguments
wp
{_
_}
_
_
%
L
_
.
Coercion
Lit
Na
t
:
nat
>->
base_lit
.
Coercion
Lit
In
t
:
Z
>->
base_lit
.
Coercion
LitBool
:
bool
>->
base_lit
.
(** No coercion from base_lit to expr. This makes is slightly easier to tell
apart language and Coq expressions. *)
...
...
@@ -22,6 +22,8 @@ Notation "e1 + e2" := (BinOp PlusOp e1%L e2%L)
(
at
level
50
,
left
associativity
)
:
lang_scope
.
Notation
"e1 - e2"
:=
(
BinOp
MinusOp
e1
%
L
e2
%
L
)
(
at
level
50
,
left
associativity
)
:
lang_scope
.
Notation
"- e"
:=
(
UnOp
MinusUnOp
e
%
L
)
(
at
level
35
,
right
associativity
)
:
lang_scope
.
Notation
"~ e"
:=
(
UnOp
NegOp
e
%
L
)
(
at
level
75
,
right
associativity
)
:
lang_scope
.
Notation
"e1 ≤ e2"
:=
(
BinOp
LeOp
e1
%
L
e2
%
L
)
(
at
level
70
)
:
lang_scope
.
Notation
"e1 < e2"
:=
(
BinOp
LtOp
e1
%
L
e2
%
L
)
(
at
level
70
)
:
lang_scope
.
Notation
"e1 = e2"
:=
(
BinOp
EqOp
e1
%
L
e2
%
L
)
(
at
level
70
)
:
lang_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