Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
Iris
Commits
15c368d5
Commit
15c368d5
authored
Feb 09, 2016
by
Robbert Krebbers
Browse files
Remove sum2bool.
parent
0c801b09
Changes
2
Hide whitespace changes
Inline
Side-by-side
heap_lang/heap_lang.v
View file @
15c368d5
...
...
@@ -135,20 +135,13 @@ Definition un_op_eval (op : un_op) (l : base_lit) : option base_lit :=
|
_
,
_
=>
None
end
.
(* FIXME RJ I am *sure* this already exists somewhere... but I can't find it. *)
Definition
sum2bool
{
A
B
}
(
x
:
{
A
}
+
{
B
})
:
bool
:
=
match
x
with
|
left
_
=>
true
|
right
_
=>
false
end
.
Definition
bin_op_eval
(
op
:
bin_op
)
(
l1
l2
:
base_lit
)
:
option
base_lit
:
=
match
op
,
l1
,
l2
with
|
PlusOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitNat
(
n1
+
n2
)
|
MinusOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitNat
(
n1
-
n2
)
|
LeOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
sum2
bool
$
decide
(
n1
≤
n2
)
|
LtOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
sum2
bool
$
decide
(
n1
<
n2
)
|
EqOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
sum2
bool
$
decide
(
n1
=
n2
)
|
LeOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
bool
_
decide
(
n1
≤
n2
)
|
LtOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
bool
_
decide
(
n1
<
n2
)
|
EqOp
,
LitNat
n1
,
LitNat
n2
=>
Some
$
LitBool
$
bool
_
decide
(
n1
=
n2
)
|
_
,
_
,
_
=>
None
end
.
...
...
heap_lang/sugar.v
View file @
15c368d5
...
...
@@ -101,7 +101,7 @@ Lemma wp_le E (n1 n2 : nat) P Q :
P
⊑
wp
E
(
BinOp
LeOp
(
Lit
n1
)
(
Lit
n2
))
Q
.
Proof
.
intros
?
?.
rewrite
-
wp_bin_op
//
;
[].
destruct
(
decide
_
)
;
by
eauto
with
omega
.
destruct
(
bool_
decide_
reflect
(
n1
≤
n2
)
)
;
by
eauto
with
omega
.
Qed
.
Lemma
wp_lt
E
(
n1
n2
:
nat
)
P
Q
:
...
...
@@ -110,7 +110,7 @@ Lemma wp_lt E (n1 n2 : nat) P Q :
P
⊑
wp
E
(
BinOp
LtOp
(
Lit
n1
)
(
Lit
n2
))
Q
.
Proof
.
intros
?
?.
rewrite
-
wp_bin_op
//
;
[].
destruct
(
decide
_
)
;
by
eauto
with
omega
.
destruct
(
bool_
decide_
reflect
(
n1
<
n2
)
)
;
by
eauto
with
omega
.
Qed
.
Lemma
wp_eq
E
(
n1
n2
:
nat
)
P
Q
:
...
...
@@ -119,7 +119,7 @@ Lemma wp_eq E (n1 n2 : nat) P Q :
P
⊑
wp
E
(
BinOp
EqOp
(
Lit
n1
)
(
Lit
n2
))
Q
.
Proof
.
intros
?
?.
rewrite
-
wp_bin_op
//
;
[].
destruct
(
decide
_
)
;
by
eauto
with
omega
.
destruct
(
bool_
decide_
reflect
(
n1
=
n2
)
)
;
by
eauto
with
omega
.
Qed
.
End
suger
.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment