Commit 9a70d79a authored by MARCHE Claude's avatar MARCHE Claude

added my_cosine example in regression tests (program version)

parent 9ab5b167
......@@ -148,7 +148,6 @@ why.conf
/examples/genealogy/
/examples/programs/course/
/examples/programs/wcet_hull/
/examples/programs/my_cosine/
/examples/programs/binary_search2/
/examples/programs/vacid_0_sparse_array/
/examples/programs/vacid_0_red_black_trees/
......
(* This file is generated by Why3's Coq driver *)
(* Beware! Only edit allowed sections below *)
Require Import ZArith.
Require Import Rbase.
Require Import Rbasic_fun.
Require Import R_sqrt.
Require Import Rtrigo.
Require Import AltSeries. (* for def of pi *)
Definition unit := unit.
Parameter ignore: forall (a:Type), a -> unit.
Implicit Arguments ignore.
Parameter label_ : Type.
Parameter at1: forall (a:Type), a -> label_ -> a.
Implicit Arguments at1.
Parameter old: forall (a:Type), a -> a.
Implicit Arguments old.
Axiom Abs_le : forall (x:R) (y:R), ((Rabs x) <= y)%R <-> (((-y)%R <= x)%R /\
(x <= y)%R).
Axiom Sqrt_positive : forall (x:R), ((0)%R <= x)%R -> ((0)%R <= (sqrt x))%R.
Axiom Sqrt_square : forall (x:R), ((0)%R <= x)%R -> ((Rsqr (sqrt x)) = x).
Axiom Square_sqrt : forall (x:R), ((0)%R <= x)%R -> ((sqrt (x * x)%R) = x).
Axiom Pythagorean_identity : forall (x:R),
(((Rsqr (Rtrigo_def.cos x)) + (Rsqr (Rtrigo_def.sin x)))%R = (1)%R).
Axiom Cos_le_one : forall (x:R), ((Rabs (Rtrigo_def.cos x)) <= (1)%R)%R.
Axiom Sin_le_one : forall (x:R), ((Rabs (Rtrigo_def.sin x)) <= (1)%R)%R.
Axiom Cos_0 : ((Rtrigo_def.cos (0)%R) = (1)%R).
Axiom Sin_0 : ((Rtrigo_def.sin (0)%R) = (0)%R).
Axiom Pi_interval : ((314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196 / 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)%R < PI)%R /\
(PI < (314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038197 / 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)%R)%R.
Axiom Cos_pi : ((Rtrigo_def.cos PI) = (-(1)%R)%R).
Axiom Sin_pi : ((Rtrigo_def.sin PI) = (0)%R).
Axiom Cos_pi2 : ((Rtrigo_def.cos ((05 / 10)%R * PI)%R) = (0)%R).
Axiom Sin_pi2 : ((Rtrigo_def.sin ((05 / 10)%R * PI)%R) = (1)%R).
Axiom Cos_plus_pi : forall (x:R),
((Rtrigo_def.cos (x + PI)%R) = (-(Rtrigo_def.cos x))%R).
Axiom Sin_plus_pi : forall (x:R),
((Rtrigo_def.sin (x + PI)%R) = (-(Rtrigo_def.sin x))%R).
Axiom Cos_plus_pi2 : forall (x:R),
((Rtrigo_def.cos (x + ((05 / 10)%R * PI)%R)%R) = (-(Rtrigo_def.sin x))%R).
Axiom Sin_plus_pi2 : forall (x:R),
((Rtrigo_def.sin (x + ((05 / 10)%R * PI)%R)%R) = (Rtrigo_def.cos x)).
Axiom Cos_neg : forall (x:R), ((Rtrigo_def.cos (-x)%R) = (Rtrigo_def.cos x)).
Axiom Sin_neg : forall (x:R),
((Rtrigo_def.sin (-x)%R) = (-(Rtrigo_def.sin x))%R).
Axiom Cos_sum : forall (x:R) (y:R),
((Rtrigo_def.cos (x + y)%R) = (((Rtrigo_def.cos x) * (Rtrigo_def.cos y))%R - ((Rtrigo_def.sin x) * (Rtrigo_def.sin y))%R)%R).
Axiom Sin_sum : forall (x:R) (y:R),
((Rtrigo_def.sin (x + y)%R) = (((Rtrigo_def.sin x) * (Rtrigo_def.cos y))%R + ((Rtrigo_def.cos x) * (Rtrigo_def.sin y))%R)%R).
Parameter atan: R -> R.
Axiom Tan_atan : forall (x:R), ((Rtrigo.tan (atan x)) = x).
Inductive mode :=
| NearestTiesToEven : mode
| ToZero : mode
| Up : mode
| Down : mode
| NearTiesToAway : mode .
Parameter single : Type.
Axiom Zero : ((IZR 0%Z) = (0)%R).
Axiom One : ((IZR 1%Z) = (1)%R).
Axiom Add : forall (x:Z) (y:Z), ((IZR (x + y)%Z) = ((IZR x) + (IZR y))%R).
Axiom Sub : forall (x:Z) (y:Z), ((IZR (x - y)%Z) = ((IZR x) - (IZR y))%R).
Axiom Mul : forall (x:Z) (y:Z), ((IZR (x * y)%Z) = ((IZR x) * (IZR y))%R).
Axiom Neg : forall (x:Z), ((IZR (-x)%Z) = (-(IZR x))%R).
Parameter round: mode -> R -> R.
Parameter round_logic: mode -> R -> single.
Parameter value: single -> R.
Parameter exact: single -> R.
Parameter model: single -> R.
Definition round_error(x:single): R := (Rabs ((value x) - (exact x))%R).
Definition total_error(x:single): R := (Rabs ((value x) - (model x))%R).
Definition no_overflow(m:mode) (x:R): Prop := ((Rabs (round m
x)) <= (33554430 * 10141204801825835211973625643008)%R)%R.
Axiom Bounded_real_no_overflow : forall (m:mode) (x:R),
((Rabs x) <= (33554430 * 10141204801825835211973625643008)%R)%R ->
(no_overflow m x).
Axiom Round_monotonic : forall (m:mode) (x:R) (y:R), (x <= y)%R -> ((round m
x) <= (round m y))%R.
Axiom Exact_rounding_for_integers : forall (m:mode) (i:Z),
(((-16777216%Z)%Z <= i)%Z /\ (i <= 16777216%Z)%Z) -> ((round m
(IZR i)) = (IZR i)).
Axiom Round_down_le : forall (x:R), ((round (Down ) x) <= x)%R.
Axiom Round_up_ge : forall (x:R), (x <= (round (Up ) x))%R.
Axiom Round_down_neg : forall (x:R), ((round (Down ) (-x)%R) = (-(round (Up )
x))%R).
Axiom Round_up_neg : forall (x:R), ((round (Up ) (-x)%R) = (-(round (Down )
x))%R).
Theorem WP_parameter_my_cosine : forall (x:single),
((Rabs (value x)) <= (1 / 32)%R)%R ->
((Rabs (((1)%R - (((value x) * (value x))%R * (05 / 10)%R)%R)%R - (Rtrigo_def.cos (value x)))%R) <= (1 / 16777216)%R)%R.
(* YOU MAY EDIT THE PROOF BELOW *)
intros x H.
Require Import Interval_tactic.
interval with (i_bisect_diff (value x)).
Qed.
(* DO NOT EDIT BELOW *)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE why3session SYSTEM "why3session.dtd">
<why3session name="examples/programs/my_cosine/why3session.xml">
<file name="../my_cosine.mlw" verified="true" expanded="true">
<theory name="M" verified="true" expanded="true">
<goal name="WP_parameter my_cosine" expl="correctness of parameter my_cosine" sum="986f977f7129151df7340d17164762c3" proved="true" expanded="true">
<transf name="split_goal" proved="true" expanded="true">
<goal name="WP_parameter my_cosine.1" expl="assertion" sum="42f9206597da619fa67e4871bf991914" proved="true" expanded="true">
<proof prover="coq" timelimit="2" edited="my_cosine.mlw_M_WP_parameter my_cosine_1.v" obsolete="false">
<result status="valid" time="3.82"/>
</proof>
</goal>
<goal name="WP_parameter my_cosine.2" expl="precondition" sum="be0701645667327c36cf66484840bf90" proved="true" expanded="true">
<proof prover="gappa" timelimit="2" edited="" obsolete="false">
<result status="valid" time="0.01"/>
</proof>
</goal>
<goal name="WP_parameter my_cosine.3" expl="precondition" sum="3ad91864f24b8a31a628b48823b41ea2" proved="true" expanded="true">
<proof prover="gappa" timelimit="2" edited="" obsolete="false">
<result status="valid" time="0.01"/>
</proof>
</goal>
<goal name="WP_parameter my_cosine.4" expl="precondition" sum="6a3e5463b9408c699f0550a24603937a" proved="true" expanded="true">
<proof prover="gappa" timelimit="2" edited="" obsolete="false">
<result status="valid" time="0.01"/>
</proof>
</goal>
<goal name="WP_parameter my_cosine.5" expl="normal postcondition" sum="9148268517dc60d188ee0ee3565f9253" proved="true" expanded="true">
<proof prover="gappa" timelimit="2" edited="" obsolete="false">
<result status="valid" time="0.02"/>
</proof>
</goal>
</transf>
</goal>
</theory>
</file>
</why3session>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment