diff options
author | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2009-03-20 01:22:58 +0000 |
---|---|---|
committer | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2009-03-20 01:22:58 +0000 |
commit | 7d220f8b61649646692983872626d6a8042446a9 (patch) | |
tree | fefceb2c59cf155c55fffa25ad08bec629de523e /plugins/dp/test_gappa.v | |
parent | ad1fea78e3c23c903b2256d614756012d5f05d87 (diff) |
Directory 'contrib' renamed into 'plugins', to end confusion with archive of user contribs
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11996 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'plugins/dp/test_gappa.v')
-rw-r--r-- | plugins/dp/test_gappa.v | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/plugins/dp/test_gappa.v b/plugins/dp/test_gappa.v new file mode 100644 index 000000000..eb65a59d6 --- /dev/null +++ b/plugins/dp/test_gappa.v @@ -0,0 +1,91 @@ +Require Export Gappa_tactic. +Require Export Reals. + +Open Scope Z_scope. +Open Scope R_scope. + +Lemma test_base10 : + forall x y:R, + 0 <= x <= 4 -> + 0 <= x * (24 * powerRZ 10 (-1)) <= 10. +Proof. + gappa. +Qed. + +(* +@rnd = float< ieee_32, zr >; +a = rnd(a_); b = rnd(b_); +{ a in [3.2,3.3] /\ b in [1.4,1.9] -> + rnd(a - b) - (a - b) in [0,0] } +*) + +Definition rnd := gappa_rounding (rounding_float roundZR 43 (120)). + +Lemma test_float3 : + forall a_ b_ a b : R, + a = rnd a_ -> + b = rnd b_ -> + 52 / 16 <= a <= 53 / 16 -> + 22 / 16 <= b <= 30 / 16 -> + 0 <= rnd (a - b) - (a - b) <= 0. +Proof. + unfold rnd. + gappa. +Qed. + +Lemma test_float2 : + forall x y:R, + 0 <= x <= 1 -> + 0 <= y <= 1 -> + 0 <= gappa_rounding (rounding_float roundNE 53 (1074)) (x+y) <= 2. +Proof. + gappa. +Qed. + +Lemma test_float1 : + forall x y:R, + 0 <= gappa_rounding (rounding_fixed roundDN (0)) x - + gappa_rounding (rounding_fixed roundDN (0)) y <= 0 -> + Rabs (x - y) <= 1. +Proof. + gappa. +Qed. + +Lemma test1 : + forall x y:R, + 0 <= x <= 1 -> + 0 <= -y <= 1 -> + 0 <= x * (-y) <= 1. +Proof. + gappa. +Qed. + +Lemma test2 : + forall x y:R, + 3/4 <= x <= 3 -> + 0 <= sqrt x <= 1775 * (powerRZ 2 (-10)). +Proof. + gappa. +Qed. + +Lemma test3 : + forall x y z:R, + 0 <= x - y <= 3 -> + -2 <= y - z <= 4 -> + -2 <= x - z <= 7. +Proof. + gappa. +Qed. + +Lemma test4 : + forall x1 x2 y1 y2 : R, + 1 <= Rabs y1 <= 1000 -> + 1 <= Rabs y2 <= 1000 -> + - powerRZ 2 (-53) <= (x1 - y1) / y1 <= powerRZ 2 (-53) -> + - powerRZ 2 (-53) <= (x2 - y2) / y2 <= powerRZ 2 (-53) -> + - powerRZ 2 (-51) <= (x1 * x2 - y1 * y2) / (y1 * y2) <= powerRZ 2 (-51). +Proof. + gappa. +Qed. + + |