Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flocq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Flocq
flocq
Commits
e509148d
Commit
e509148d
authored
Apr 08, 2009
by
Guillaume Melquiond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split format definitions.
parent
95a6b1b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
36 deletions
+61
-36
src/Flocq_rnd_FIX.v
src/Flocq_rnd_FIX.v
+27
-16
src/Flocq_rnd_FLX.v
src/Flocq_rnd_FLX.v
+22
-10
src/Flocq_rnd_generic.v
src/Flocq_rnd_generic.v
+12
-10
No files found.
src/Flocq_rnd_FIX.v
View file @
e509148d
...
@@ -19,11 +19,22 @@ Definition FIX_format (x : R) :=
...
@@ -19,11 +19,22 @@ Definition FIX_format (x : R) :=
Definition
FIX_RoundingModeP
(
rnd
:
R
->
R
)
:=
Definition
FIX_RoundingModeP
(
rnd
:
R
->
R
)
:=
Rounding_for_Format
FIX_format
rnd
.
Rounding_for_Format
FIX_format
rnd
.
Theorem
FIX_format_satisfies_any
:
Definition
FIX_exp
(
e
:
Z
)
:=
emin
.
satisfies_any
FIX_format
.
Theorem
FIX_exp_correct
:
valid_exp
FIX_exp
.
Proof
.
intros
k
.
unfold
FIX_exp
.
split
;
intros
H
.
now
apply
Zlt_le_weak
.
split
.
apply
Zle_refl
.
now
intros
_
_.
Qed
.
Theorem
FIX_format_generic
:
forall
x
:
R
,
generic_format
beta
FIX_exp
x
<->
FIX_format
x
.
Proof
.
Proof
.
pose
(
fexp
(
e
:
Z
)
:=
emin
).
refine
(
satisfies_any_eq
_
_
_
(
generic_format_satisfies_any
beta
fexp
_
)).
split
.
split
.
(
*
.
*
)
(
*
.
*
)
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
...
@@ -38,23 +49,23 @@ repeat split.
...
@@ -38,23 +49,23 @@ repeat split.
rewrite
Hx1
.
rewrite
Hx1
.
apply
(
f_equal
(
fun
e
=>
F2R
(
Float
beta
xm
e
))).
apply
(
f_equal
(
fun
e
=>
F2R
(
Float
beta
xm
e
))).
simpl
in
Hx2
.
simpl
in
Hx2
.
unfold
fexp
in
Hx2
.
now
unfold
FIX_exp
in
Hx2
.
apply
Hx2
.
(
*
.
*
)
(
*
.
*
)
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
exists
(
Float
beta
xm
(
f
exp
xe
)).
exists
(
Float
beta
xm
(
FIX_
exp
xe
)).
split
.
split
.
unfold
f
exp
.
unfold
FIX_
exp
.
now
rewrite
<-
Hx2
.
now
rewrite
<-
Hx2
.
now
intros
Hx3
.
now
intros
Hx3
.
(
*
.
*
)
Qed
.
intros
k
.
unfold
fexp
.
Theorem
FIX_format_satisfies_any
:
split
;
intros
H
.
satisfies_any
FIX_format
.
now
apply
Zlt_le_weak
.
Proof
.
split
.
pose
(
fexp
(
e
:
Z
)
:=
emin
).
apply
Zle_refl
.
refine
(
satisfies_any_eq
_
_
_
(
generic_format_satisfies_any
beta
fexp
_
)).
now
intros
_
_.
exact
FIX_format_generic
.
exact
FIX_exp_correct
.
Qed
.
Qed
.
End
RND_FIX
.
End
RND_FIX
.
src/Flocq_rnd_FLX.v
View file @
e509148d
...
@@ -21,11 +21,18 @@ Definition FLX_format (x : R) :=
...
@@ -21,11 +21,18 @@ Definition FLX_format (x : R) :=
Definition
FLX_RoundingModeP
(
rnd
:
R
->
R
)
:=
Definition
FLX_RoundingModeP
(
rnd
:
R
->
R
)
:=
Rounding_for_Format
FLX_format
rnd
.
Rounding_for_Format
FLX_format
rnd
.
Theorem
FLX_format_satisfies_any
:
Definition
FLX_exp
(
e
:
Z
)
:=
(
e
-
prec
)
%
Z
.
satisfies_any
FLX_format
.
Theorem
FLX_exp_correct
:
valid_exp
FLX_exp
.
Proof
.
intros
k
.
unfold
FLX_exp
.
repeat
split
;
intros
;
omega
.
Qed
.
Theorem
FLX_format_generic
:
forall
x
:
R
,
generic_format
beta
FLX_exp
x
<->
FLX_format
x
.
Proof
.
Proof
.
pose
(
fexp
e
:=
(
e
-
prec
)
%
Z
).
refine
(
satisfies_any_eq
_
_
_
(
generic_format_satisfies_any
beta
fexp
_
)).
split
.
split
.
(
*
.
*
)
(
*
.
*
)
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
intros
((
xm
,
xe
),
(
Hx1
,
Hx2
)).
...
@@ -51,7 +58,7 @@ apply Rmult_lt_reg_r with (bpow (ex - prec)%Z).
...
@@ -51,7 +58,7 @@ apply Rmult_lt_reg_r with (bpow (ex - prec)%Z).
apply
epow_gt_0
.
apply
epow_gt_0
.
rewrite
<-
epow_add
.
rewrite
<-
epow_add
.
replace
(
prec
+
(
ex
-
prec
))
%
Z
with
ex
by
ring
.
replace
(
prec
+
(
ex
-
prec
))
%
Z
with
ex
by
ring
.
change
(
ex
-
prec
)
%
Z
with
(
f
exp
ex
).
change
(
ex
-
prec
)
%
Z
with
(
FLX_
exp
ex
).
rewrite
<-
Hx2
.
rewrite
<-
Hx2
.
replace
(
Z2R
(
Zabs
xm
)
*
bpow
xe
)
%
R
with
(
Rabs
x
).
replace
(
Z2R
(
Zabs
xm
)
*
bpow
xe
)
%
R
with
(
Rabs
x
).
exact
(
proj2
Hx4
).
exact
(
proj2
Hx4
).
...
@@ -78,16 +85,21 @@ replace (ex - 1 - (prec - 1))%Z with (ex - prec)%Z in Hx5 by ring.
...
@@ -78,16 +85,21 @@ replace (ex - 1 - (prec - 1))%Z with (ex - prec)%Z in Hx5 by ring.
rewrite
Hx5
.
rewrite
Hx5
.
eexists
;
repeat
split
.
eexists
;
repeat
split
.
intros
H
.
intros
H
.
change
(
Fexp
(
Float
beta
mx
(
ex
-
prec
)))
with
(
f
exp
ex
).
change
(
Fexp
(
Float
beta
mx
(
ex
-
prec
)))
with
(
FLX_
exp
ex
).
apply
f_equal
.
apply
f_equal
.
apply
sym_eq
.
apply
sym_eq
.
apply
ln_beta_unique
.
apply
ln_beta_unique
.
rewrite
<-
Hx5
.
rewrite
<-
Hx5
.
now
rewrite
<-
Hx1
.
now
rewrite
<-
Hx1
.
(
*
.
*
)
Qed
.
intros
k
.
unfold
fexp
.
Theorem
FLX_format_satisfies_any
:
repeat
split
;
intros
;
omega
.
satisfies_any
FLX_format
.
Proof
.
pose
(
fexp
e
:=
(
e
-
prec
)
%
Z
).
refine
(
satisfies_any_eq
_
_
_
(
generic_format_satisfies_any
beta
fexp
_
)).
exact
FLX_format_generic
.
exact
FLX_exp_correct
.
Qed
.
Qed
.
End
RND_FIX
.
End
RND_FIX
.
src/Flocq_rnd_generic.v
View file @
e509148d
...
@@ -11,13 +11,15 @@ Notation bpow := (epow beta).
...
@@ -11,13 +11,15 @@ Notation bpow := (epow beta).
Variable
fexp
:
Z
->
Z
.
Variable
fexp
:
Z
->
Z
.
Variable
valid_fexp
:
Definition
valid_exp
:=
forall
k
:
Z
,
forall
k
:
Z
,
(
(
fexp
k
<
k
)
%
Z
->
(
fexp
(
k
+
1
)
<=
k
)
%
Z
)
/
\
(
(
fexp
k
<
k
)
%
Z
->
(
fexp
(
k
+
1
)
<=
k
)
%
Z
)
/
\
(
(
k
<=
fexp
k
)
%
Z
->
(
(
k
<=
fexp
k
)
%
Z
->
(
fexp
(
fexp
k
+
1
)
<=
fexp
k
)
%
Z
/
\
(
fexp
(
fexp
k
+
1
)
<=
fexp
k
)
%
Z
/
\
forall
l
:
Z
,
(
l
<=
fexp
k
)
%
Z
->
fexp
l
=
fexp
k
).
forall
l
:
Z
,
(
l
<=
fexp
k
)
%
Z
->
fexp
l
=
fexp
k
).
Variable
prop_exp
:
valid_exp
.
Definition
generic_format
(
x
:
R
)
:=
Definition
generic_format
(
x
:
R
)
:=
exists
f
:
float
beta
,
exists
f
:
float
beta
,
x
=
F2R
f
/
\
forall
(
H
:
x
<>
R0
),
x
=
F2R
f
/
\
forall
(
H
:
x
<>
R0
),
...
@@ -237,7 +239,7 @@ apply Rle_trans with (bpow ge).
...
@@ -237,7 +239,7 @@ apply Rle_trans with (bpow ge).
apply
->
epow_le
.
apply
->
epow_le
.
simpl
in
Hg2
.
simpl
in
Hg2
.
rewrite
Hg2
.
rewrite
Hg2
.
rewrite
(
proj2
(
proj2
(
valid_f
exp
ex
)
He1
)
ge
'
).
rewrite
(
proj2
(
proj2
(
prop_
exp
ex
)
He1
)
ge
'
).
exact
He1
.
exact
He1
.
apply
Zle_trans
with
(
2
:=
He1
).
apply
Zle_trans
with
(
2
:=
He1
).
cut
(
ge
'
-
1
<
ex
)
%
Z
.
omega
.
cut
(
ge
'
-
1
<
ex
)
%
Z
.
omega
.
...
@@ -370,7 +372,7 @@ apply Rle_lt_trans with (1 := Hbr).
...
@@ -370,7 +372,7 @@ apply Rle_lt_trans with (1 := Hbr).
exact
Hx
.
exact
Hx
.
(
*
-
.
.
a
radix
power
*
)
(
*
-
.
.
a
radix
power
*
)
rewrite
<-
Hbl2
.
rewrite
<-
Hbl2
.
generalize
(
proj1
(
valid_f
exp
_
)
He1
).
generalize
(
proj1
(
prop_
exp
_
)
He1
).
clear
.
clear
.
intros
He2
.
intros
He2
.
exists
(
Float
beta
(
-
Zpower
(
radix_val
beta
)
(
ex
-
fexp
(
ex
+
1
)))
(
fexp
(
ex
+
1
))).
exists
(
Float
beta
(
-
Zpower
(
radix_val
beta
)
(
ex
-
fexp
(
ex
+
1
)))
(
fexp
(
ex
+
1
))).
...
@@ -449,7 +451,7 @@ rewrite Ropp_mult_distr_l_reverse.
...
@@ -449,7 +451,7 @@ rewrite Ropp_mult_distr_l_reverse.
rewrite
Rmult_1_l
.
rewrite
Rmult_1_l
.
(
*
-
.
rounded
*
)
(
*
-
.
rounded
*
)
split
.
split
.
destruct
(
proj2
(
valid_f
exp
_
)
He1
)
as
(
He2
,
_
).
destruct
(
proj2
(
prop_
exp
_
)
He1
)
as
(
He2
,
_
).
exists
(
Float
beta
(
-
Zpower
(
radix_val
beta
)
(
fexp
ex
-
fexp
(
fexp
ex
+
1
)))
(
fexp
(
fexp
ex
+
1
))).
exists
(
Float
beta
(
-
Zpower
(
radix_val
beta
)
(
fexp
ex
-
fexp
(
fexp
ex
+
1
)))
(
fexp
(
fexp
ex
+
1
))).
unfold
F2R
.
simpl
.
unfold
F2R
.
simpl
.
split
.
split
.
...
@@ -500,7 +502,7 @@ apply <- epow_lt.
...
@@ -500,7 +502,7 @@ apply <- epow_lt.
apply
Rle_lt_trans
with
(
1
:=
proj1
Hge
).
apply
Rle_lt_trans
with
(
1
:=
proj1
Hge
).
apply
Ropp_lt_cancel
.
apply
Ropp_lt_cancel
.
now
rewrite
Ropp_involutive
.
now
rewrite
Ropp_involutive
.
rewrite
(
proj2
(
proj2
(
valid_f
exp
_
)
He1
)
_
Hge
'
)
in
Hg2
.
rewrite
(
proj2
(
proj2
(
prop_
exp
_
)
He1
)
_
Hge
'
)
in
Hg2
.
rewrite
<-
Hg2
in
Hge
'
.
rewrite
<-
Hg2
in
Hge
'
.
apply
Rlt_not_le
with
(
1
:=
proj2
Hge
).
apply
Rlt_not_le
with
(
1
:=
proj2
Hge
).
rewrite
Hg1
.
rewrite
Hg1
.
...
...
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