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
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
121
Issues
121
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
a6391c21
Commit
a6391c21
authored
Dec 20, 2010
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
my cosine in logic, proved
parent
2579fe40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
examples/my_cosine.why
examples/my_cosine.why
+25
-2
examples/programs/my_cosine/project.db
examples/programs/my_cosine/project.db
+0
-0
No files found.
examples/my_cosine.why
View file @
a6391c21
...
...
@@ -11,11 +11,33 @@ use import floating_point.Single
lemma MethodError: forall x:real. abs x <= 0x1p-5 ->
abs (1.0 - x * x * 0.5 - cos x) <= 0x1p-24
abs (1.0 - 0.5 * (x * x) - cos x) <= 0x1p-24
(* this one is proved in Coq + interval tactics *)
(* computation in single precision *)
lemma TotalErrorFullyExpanded:
forall x:single. abs (value x) <= 0x1p-5 ->
(* total error as hypothesis, for Gappa *)
abs (1.0 - 0.5 * (value x * value x) - cos (value x)) <= 0x1p-24 ->
forall x2 x2o2 cos_x: real.
x2 = round NearestTiesToEven (value x * value x) ->
x2o2 = round NearestTiesToEven (0.5 * x2) ->
cos_x = round NearestTiesToEven (1.0 - x2o2) ->
abs (cos_x - cos (value x)) <= 0x1p-23
(* fully expanded version, proved by gappa *)
lemma TotalErrorExpanded:
forall x:single. abs (value x) <= 0x1p-5 ->
let x2 = round NearestTiesToEven (value x * value x) in
let x2o2 = round NearestTiesToEven (0.5 * x2) in
let cos_x = round NearestTiesToEven (1.0 - x2o2) in
abs (cos_x - cos (value x)) <= 0x1p-23
(* same as above but with let, proved by SMT solvers *)
(* the same as above, under the form of a logic function *)
logic round_single (m:mode) (x:real) : single
axiom RoundSingle: forall m:mode, x:real.
...
...
@@ -28,7 +50,8 @@ logic cos_single (x:single) : single =
lemma TotalError: forall x:single. abs (value x) <= 0x1p-5 ->
let cos_x = cos_single x in
abs (value cos_x - cos (value x)) <= 0x1p-24
abs (value cos_x - cos (value x)) <= 0x1p-23
(* proved by SMT solvers from TotalErrorExpanded *)
end
...
...
examples/programs/my_cosine/project.db
View file @
a6391c21
No preview for this file type
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