Commit d8fc5d05 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Weaken hypotheses of mag_div.

parent d79ac40f
...@@ -8,7 +8,7 @@ Version 3.0.0: ...@@ -8,7 +8,7 @@ Version 3.0.0:
- changed nan_pl into a boolean predicate - changed nan_pl into a boolean predicate
- replaced Z2R with Coq 8.7's IZR - replaced Z2R with Coq 8.7's IZR
- removed Zeven and its theorems in favor of Z.even of the standard library - removed Zeven and its theorems in favor of Z.even of the standard library
- modified statement of Rcompare_sqr, ulp_DN, mult_error_FLT - modified statements of Rcompare_sqr, ulp_DN, mult_error_FLT, mag_div
- added theorems about the remainder being in the format (in Div_sqrt_error) - added theorems about the remainder being in the format (in Div_sqrt_error)
- renamed theorem more uniformly - renamed theorem more uniformly
. bpow_plus1 -> bpow_plus_1 . bpow_plus1 -> bpow_plus_1
......
...@@ -1983,7 +1983,7 @@ Qed. ...@@ -1983,7 +1983,7 @@ Qed.
Lemma mag_div : Lemma mag_div :
forall x y : R, forall x y : R,
(0 < x)%R -> (0 < y)%R -> x <> 0%R -> y <> 0%R ->
(mag x - mag y <= mag (x / y) <= mag x - mag y + 1)%Z. (mag x - mag y <= mag (x / y) <= mag x - mag y + 1)%Z.
Proof. Proof.
intros x y Px Py. intros x y Px Py.
...@@ -1991,44 +1991,41 @@ destruct (mag x) as (ex,Hex). ...@@ -1991,44 +1991,41 @@ destruct (mag x) as (ex,Hex).
destruct (mag y) as (ey,Hey). destruct (mag y) as (ey,Hey).
simpl. simpl.
unfold Rdiv. unfold Rdiv.
rewrite Rabs_right in Hex; [|now apply Rle_ge; apply Rlt_le]. assert (Heiy : (bpow (- ey) < Rabs (/ y) <= bpow (- ey + 1))%R).
rewrite Rabs_right in Hey; [|now apply Rle_ge; apply Rlt_le]. { rewrite Rabs_Rinv by easy.
assert (Heiy : (bpow (- ey) < / y <= bpow (- ey + 1))%R). split.
{ split.
- rewrite bpow_opp. - rewrite bpow_opp.
apply Rinv_lt_contravar. apply Rinv_lt_contravar.
+ apply Rmult_lt_0_compat; [exact Py|]. + apply Rmult_lt_0_compat.
now apply Rabs_pos_lt.
now apply bpow_gt_0. now apply bpow_gt_0.
+ apply Hey. + now apply Hey.
now apply Rgt_not_eq.
- replace (_ + _)%Z with (- (ey - 1))%Z by ring. - replace (_ + _)%Z with (- (ey - 1))%Z by ring.
rewrite bpow_opp. rewrite bpow_opp.
apply Rinv_le; [now apply bpow_gt_0|]. apply Rinv_le; [now apply bpow_gt_0|].
apply Hey. now apply Hey. }
now apply Rgt_not_eq. }
split. split.
- apply mag_ge_bpow. - apply mag_ge_bpow.
apply Rabs_ge; right.
replace (_ - _)%Z with (ex - 1 - ey)%Z by ring. replace (_ - _)%Z with (ex - 1 - ey)%Z by ring.
unfold Zminus at 1; rewrite bpow_plus. unfold Zminus at 1; rewrite bpow_plus.
rewrite Rabs_mult.
apply Rmult_le_compat. apply Rmult_le_compat.
+ now apply bpow_ge_0. + now apply bpow_ge_0.
+ now apply bpow_ge_0. + now apply bpow_ge_0.
+ apply Hex. + now apply Hex.
now apply Rgt_not_eq. + now apply Rlt_le; apply Heiy.
+ apply Rlt_le; apply Heiy. - apply mag_le_bpow.
- assert (Pxy : (0 < x * / y)%R). + apply Rmult_integral_contrapositive_currified.
{ apply Rmult_lt_0_compat; [exact Px|]. exact Px.
now apply Rinv_0_lt_compat. } now apply Rinv_neq_0_compat.
apply mag_le_bpow. + replace (_ + 1)%Z with (ex + (- ey + 1))%Z by ring.
+ now apply Rgt_not_eq.
+ rewrite Rabs_right; [|now apply Rle_ge; apply Rlt_le].
replace (_ + 1)%Z with (ex + (- ey + 1))%Z by ring.
rewrite bpow_plus. rewrite bpow_plus.
apply Rlt_le_trans with (bpow ex * / y)%R. apply Rlt_le_trans with (bpow ex * Rabs (/ y))%R.
* apply Rmult_lt_compat_r; [now apply Rinv_0_lt_compat|]. * rewrite Rabs_mult.
apply Hex. apply Rmult_lt_compat_r.
now apply Rgt_not_eq. apply Rabs_pos_lt.
now apply Rinv_neq_0_compat.
now apply Hex.
* apply Rmult_le_compat_l; [now apply bpow_ge_0|]. * apply Rmult_le_compat_l; [now apply bpow_ge_0|].
apply Heiy. apply Heiy.
Qed. Qed.
......
...@@ -3702,7 +3702,7 @@ Lemma mag_div_disj : ...@@ -3702,7 +3702,7 @@ Lemma mag_div_disj :
\/ (mag (x / y) = mag x - mag y + 1 :> Z)%Z). \/ (mag (x / y) = mag x - mag y + 1 :> Z)%Z).
Proof. Proof.
intros x y Px Py. intros x y Px Py.
generalize (mag_div beta x y Px Py). generalize (mag_div beta x y (Rgt_not_eq _ _ Px) (Rgt_not_eq _ _ Py)).
omega. omega.
Qed. Qed.
......
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