Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
AVA
FloVer
Commits
b28441ba
Commit
b28441ba
authored
Oct 09, 2017
by
Heiko Becker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prove IEEE connection in Coq
parent
afdfc31e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1337 additions
and
386 deletions
+1337
-386
coq/Commands.v
coq/Commands.v
+16
-0
coq/Expressions.v
coq/Expressions.v
+13
-0
coq/IEEE_connection.v
coq/IEEE_connection.v
+1300
-378
coq/Infra/MachineType.v
coq/Infra/MachineType.v
+8
-8
No files found.
coq/Commands.v
View file @
b28441ba
...
...
@@ -86,3 +86,19 @@ Fixpoint liveVars V (f:cmd V) :NatSet.t :=
|
Let
_
_
e
g
=>
NatSet
.
union
(
usedVars
e
)
(
liveVars
g
)
|
Ret
e
=>
usedVars
e
end
.
Lemma
bstep_eq_env
f
:
forall
E1
E2
Gamma
v
m
,
(
forall
x
,
E1
x
=
E2
x
)
->
bstep
f
E1
Gamma
v
m
->
bstep
f
E2
Gamma
v
m
.
Proof
.
induction
f
;
intros
*
eq_envs
bstep_E1
;
inversion
bstep_E1
;
subst
;
simpl
in
*
.
-
eapply
eval_eq_env
in
H7
;
eauto
.
eapply
let_b
;
eauto
.
eapply
IHf
.
instantiate
(
1
:=
(
updEnv
n
v0
E1
)).
+
intros
;
unfold
updEnv
.
destruct
(
x
=?
n
);
auto
.
+
auto
.
-
apply
ret_b
.
eapply
eval_eq_env
;
eauto
.
Qed
.
\ No newline at end of file
coq/Expressions.v
View file @
b28441ba
...
...
@@ -432,6 +432,19 @@ Proof.
econstructor
;
try
auto
.
Qed
.
Lemma
eval_eq_env
e
:
forall
E1
E2
Gamma
v
m
,
(
forall
x
,
E1
x
=
E2
x
)
->
eval_exp
E1
Gamma
e
v
m
->
eval_exp
E2
Gamma
e
v
m
.
Proof
.
induction
e
;
intros
;
(
match_pat
(
eval_exp
_
_
_
_
_
)
(
fun
H
=>
inversion
H
;
subst
;
simpl
in
*
));
try
eauto
.
eapply
Var_load
;
auto
.
rewrite
<-
(
H
n
);
auto
.
Qed
.
(
*
(
**
Analogous
lemma
for
unary
expressions
.
...
...
coq/IEEE_connection.v
View file @
b28441ba
This diff is collapsed.
Click to expand it.
coq/Infra/MachineType.v
View file @
b28441ba
...
...
@@ -146,17 +146,17 @@ Definition join (m1:mType) (m2:mType) :=
(
*
destruct
m1
,
m2
;
simpl
in
*
;
cbv
in
*
;
try
congruence
;
try
auto
.
*
)
(
*
Qed
.
*
)
Definition
maxExponent
(
m
:
mType
)
:
Z
:=
Definition
maxExponent
(
m
:
mType
)
:
positive
:=
match
m
with
|
M0
=>
0
|
M0
=>
1
|
M16
=>
15
|
M32
=>
127
|
M64
=>
1023
end
.
Definition
minExponentPos
(
m
:
mType
)
:
Z
:=
Definition
minExponentPos
(
m
:
mType
)
:
positive
:=
match
m
with
|
M0
=>
0
|
M0
=>
1
|
M16
=>
14
|
M32
=>
126
|
M64
=>
1022
...
...
@@ -169,16 +169,16 @@ Goldberg - Handbook of Floating-Point Arithmetic: (p.183)
which
simplifies
to
2
^
(
e_max
)
for
base
2
**
)
Definition
maxValue
(
m
:
mType
)
:=
Qpower
(
2
#
1
)
(
maxExponent
m
).
(
Z
.
pow_pos
2
(
maxExponent
m
)
)
#
1
.
Definition
minValue
(
m
:
mType
)
:=
Qinv
(
Qpower
(
2
#
1
)
(
minExponentPos
m
)).
Qinv
(
(
Z
.
pow_pos
2
(
minExponentPos
m
))
#
1
)
.
(
**
Goldberg
-
Handbook
of
Floating
-
Point
Arithmetic
:
(
p
.183
)
𝛃
^
(
e_min
-
p
+
1
)
=
𝛃
^
(
e_min
-
1
)
for
base
2
**
)
Definition
minDenormalValue
(
m
:
mType
)
:=
Qinv
(
Q
pow
er
(
2
#
1
)
(
minExponentPos
m
-
1
)).
Qinv
(
Z
.
pow
_pos
2
(
minExponentPos
m
-
1
)
#
1
).
Definition
normal
(
v
:
Q
)
(
m
:
mType
)
:=
Qle_bool
(
minValue
m
)
(
Qabs
v
)
&&
Qle_bool
(
Qabs
v
)
(
maxValue
m
).
...
...
@@ -190,7 +190,7 @@ Definition Normal (v:R) (m:mType) :=
(
Q2R
(
minValue
m
)
<=
(
Rabs
v
)
/
\
(
Rabs
v
)
<=
Q2R
(
maxValue
m
))
%
R
.
Definition
Denormal
(
v
:
R
)
(
m
:
mType
)
:=
((
Rabs
v
)
<
=
Q2R
(
minValue
m
)
/
\
~
(
v
=
0
))
%
R
.
((
Rabs
v
)
<
Q2R
(
minValue
m
)
/
\
~
(
v
=
0
))
%
R
.
(
**
Predicate
that
is
true
if
and
only
if
the
given
value
v
is
a
valid
floating
-
point
value
according
to
the
the
type
m
.
...
...
Write
Preview
Markdown
is supported
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