Commit a962d8f3 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Rename ln_beta into mag.

parent 25fa9f62
...@@ -104,18 +104,18 @@ intros K; contradict Hz. ...@@ -104,18 +104,18 @@ intros K; contradict Hz.
rewrite K, Rabs_R0; apply Rlt_not_le. rewrite K, Rabs_R0; apply Rlt_not_le.
apply bpow_gt_0. apply bpow_gt_0.
assert (cexp (z/2) = cexp z -1)%Z. assert (cexp (z/2) = cexp z -1)%Z.
assert (prec+emin < ln_beta radix2 z)%Z. assert (prec+emin < mag radix2 z)%Z.
apply lt_bpow with radix2. apply lt_bpow with radix2.
destruct ln_beta as (e,He); simpl. destruct mag as (e,He); simpl.
apply Rle_lt_trans with (1:=Hz). apply Rle_lt_trans with (1:=Hz).
now apply He. now apply He.
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
replace ((ln_beta radix2 (z/2))-prec)%Z with ((ln_beta radix2 z -1) -prec)%Z. replace ((mag radix2 (z/2))-prec)%Z with ((mag radix2 z -1) -prec)%Z.
rewrite Z.max_l; try omega. rewrite Z.max_l; try omega.
rewrite Z.max_l; try omega. rewrite Z.max_l; try omega.
apply Zplus_eq_compat; try reflexivity. apply Zplus_eq_compat; try reflexivity.
apply sym_eq, ln_beta_unique. apply sym_eq, mag_unique.
destruct (ln_beta radix2 z) as (e,He); simpl. destruct (mag radix2 z) as (e,He); simpl.
unfold Rdiv; rewrite Rabs_mult. unfold Rdiv; rewrite Rabs_mult.
rewrite (Rabs_right (/2)). rewrite (Rabs_right (/2)).
split. split.
...@@ -154,7 +154,7 @@ rewrite ulp_neq_0. ...@@ -154,7 +154,7 @@ rewrite ulp_neq_0.
case (Rle_or_lt (bpow (emin+prec-1)) u); intros Hu. case (Rle_or_lt (bpow (emin+prec-1)) u); intros Hu.
unfold ulp; rewrite cexp_FLT_FLX. unfold ulp; rewrite cexp_FLT_FLX.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
destruct (ln_beta radix2 u) as (e,He); simpl. destruct (mag radix2 u) as (e,He); simpl.
apply Rle_trans with (bpow (e-1)). apply Rle_trans with (bpow (e-1)).
apply bpow_le. apply bpow_le.
unfold Prec_gt_0 in prec_gt_0_; omega. unfold Prec_gt_0 in prec_gt_0_; omega.
...@@ -201,7 +201,7 @@ rewrite cexp_FLT_FLX. ...@@ -201,7 +201,7 @@ rewrite cexp_FLT_FLX.
rewrite cexp_FLT_FLX; trivial. rewrite cexp_FLT_FLX; trivial.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
replace 2 with (bpow 1) by reflexivity. replace 2 with (bpow 1) by reflexivity.
rewrite Rmult_comm, ln_beta_mult_bpow. rewrite Rmult_comm, mag_mult_bpow.
omega. omega.
intros H; contradict Hu. intros H; contradict Hu.
apply Rlt_not_le; rewrite H, Rabs_R0. apply Rlt_not_le; rewrite H, Rabs_R0.
...@@ -290,48 +290,48 @@ omega. ...@@ -290,48 +290,48 @@ omega.
apply Rlt_le_trans with (2:=H1). apply Rlt_le_trans with (2:=H1).
apply bpow_lt. apply bpow_lt.
unfold Prec_gt_0 in prec_gt_0_; omega. unfold Prec_gt_0 in prec_gt_0_; omega.
assert (M:(prec + emin +1 <= ln_beta radix2 f)%Z). assert (M:(prec + emin +1 <= mag radix2 f)%Z).
apply ln_beta_ge_bpow. apply mag_ge_bpow.
replace (prec+emin+1-1)%Z with (prec+emin)%Z by ring. replace (prec+emin+1-1)%Z with (prec+emin)%Z by ring.
rewrite Rabs_right; try assumption. rewrite Rabs_right; try assumption.
apply Rle_ge; now left. apply Rle_ge; now left.
assert (T1:(ulp_flt (pred_flt f) = ulp_flt f) assert (T1:(ulp_flt (pred_flt f) = ulp_flt f)
\/ ( ulp_flt (pred_flt f) = /2* ulp_flt f \/ ( ulp_flt (pred_flt f) = /2* ulp_flt f
/\ f = bpow (ln_beta radix2 f -1))). /\ f = bpow (mag radix2 f -1))).
generalize H; rewrite pred_eq_pos; [idtac|now left]. generalize H; rewrite pred_eq_pos; [idtac|now left].
unfold pred_pos; case Req_bool_spec; intros K HH. unfold pred_pos; case Req_bool_spec; intros K HH.
(**) (**)
right; split; try assumption. right; split; try assumption.
rewrite ulp_neq_0;[idtac|now apply Rgt_not_eq]. rewrite ulp_neq_0;[idtac|now apply Rgt_not_eq].
apply trans_eq with (bpow (ln_beta radix2 f- prec -1)). apply trans_eq with (bpow (mag radix2 f- prec -1)).
apply f_equal. apply f_equal.
unfold cexp. unfold cexp.
apply trans_eq with (FLT_exp emin prec (ln_beta radix2 f -1)%Z). apply trans_eq with (FLT_exp emin prec (mag radix2 f -1)%Z).
apply f_equal. apply f_equal.
unfold FLT_exp. unfold FLT_exp.
rewrite Z.max_l. rewrite Z.max_l.
2: omega. 2: omega.
apply ln_beta_unique. apply mag_unique.
rewrite Rabs_right. rewrite Rabs_right.
split. split.
apply Rplus_le_reg_l with (bpow (ln_beta radix2 f -1-prec)). apply Rplus_le_reg_l with (bpow (mag radix2 f -1-prec)).
ring_simplify. ring_simplify.
apply Rle_trans with (bpow (ln_beta radix2 f - 1 - 1) + bpow (ln_beta radix2 f - 1 - 1)). apply Rle_trans with (bpow (mag radix2 f - 1 - 1) + bpow (mag radix2 f - 1 - 1)).
apply Rplus_le_compat_r. apply Rplus_le_compat_r.
apply bpow_le. apply bpow_le.
unfold Prec_gt_0 in prec_gt_0_; omega. unfold Prec_gt_0 in prec_gt_0_; omega.
apply Rle_trans with (bpow 1*bpow (ln_beta radix2 f - 1 - 1)). apply Rle_trans with (bpow 1*bpow (mag radix2 f - 1 - 1)).
simpl; right; ring. simpl; right; ring.
rewrite <- bpow_plus. rewrite <- bpow_plus.
apply Rle_trans with (bpow (ln_beta radix2 f -1)). apply Rle_trans with (bpow (mag radix2 f -1)).
apply bpow_le; omega. apply bpow_le; omega.
rewrite <- K; now right. rewrite <- K; now right.
rewrite <- K. rewrite <- K.
apply Rplus_lt_reg_l with (-f+bpow (ln_beta radix2 f-1-prec)); ring_simplify. apply Rplus_lt_reg_l with (-f+bpow (mag radix2 f-1-prec)); ring_simplify.
apply bpow_gt_0. apply bpow_gt_0.
apply Rle_ge. apply Rle_ge.
rewrite K at 1. rewrite K at 1.
apply Rplus_le_reg_l with (bpow (ln_beta radix2 f - 1 - prec)). apply Rplus_le_reg_l with (bpow (mag radix2 f - 1 - prec)).
ring_simplify. ring_simplify.
apply bpow_le. apply bpow_le.
unfold Prec_gt_0 in prec_gt_0_; omega. unfold Prec_gt_0 in prec_gt_0_; omega.
...@@ -345,8 +345,8 @@ unfold cexp, FLT_exp. ...@@ -345,8 +345,8 @@ unfold cexp, FLT_exp.
rewrite Z.max_l;[ring|omega]. rewrite Z.max_l;[ring|omega].
(**) (**)
left. left.
assert (bpow (ln_beta radix2 f -1) < f). assert (bpow (mag radix2 f -1) < f).
destruct (ln_beta radix2 f); simpl in *. destruct (mag radix2 f); simpl in *.
destruct a. destruct a.
now apply Rgt_not_eq. now apply Rgt_not_eq.
rewrite Rabs_right in H0. rewrite Rabs_right in H0.
...@@ -354,7 +354,7 @@ destruct H0; try assumption. ...@@ -354,7 +354,7 @@ destruct H0; try assumption.
contradict H0. contradict H0.
now apply sym_not_eq. now apply sym_not_eq.
apply Rle_ge; now left. apply Rle_ge; now left.
assert (bpow (ln_beta radix2 f -1) + ulp_flt (bpow (ln_beta radix2 f-1)) <= f). assert (bpow (mag radix2 f -1) + ulp_flt (bpow (mag radix2 f-1)) <= f).
rewrite <- succ_eq_pos;[idtac|apply bpow_ge_0]. rewrite <- succ_eq_pos;[idtac|apply bpow_ge_0].
apply succ_le_lt... apply succ_le_lt...
apply FLT_format_bpow... apply FLT_format_bpow...
...@@ -363,26 +363,26 @@ rewrite ulp_bpow in H4. ...@@ -363,26 +363,26 @@ rewrite ulp_bpow in H4.
unfold FLT_exp in H4. unfold FLT_exp in H4.
rewrite Z.max_l in H4. rewrite Z.max_l in H4.
2: omega. 2: omega.
replace (ln_beta radix2 f - 1 + 1 - prec)%Z with (ln_beta radix2 f - prec)%Z in H4 by ring. replace (mag radix2 f - 1 + 1 - prec)%Z with (mag radix2 f - prec)%Z in H4 by ring.
rewrite ulp_neq_0; try now apply Rgt_not_eq. rewrite ulp_neq_0; try now apply Rgt_not_eq.
rewrite ulp_neq_0 at 2; try now apply Rgt_not_eq. rewrite ulp_neq_0 at 2; try now apply Rgt_not_eq.
unfold cexp. unfold cexp.
apply f_equal; apply f_equal. apply f_equal; apply f_equal.
replace (ulp_flt f) with (bpow (ln_beta radix2 f -prec)). replace (ulp_flt f) with (bpow (mag radix2 f -prec)).
apply ln_beta_unique. apply mag_unique.
rewrite Rabs_right. rewrite Rabs_right.
split. split.
apply Rplus_le_reg_l with (bpow (ln_beta radix2 f -prec)). apply Rplus_le_reg_l with (bpow (mag radix2 f -prec)).
ring_simplify. ring_simplify.
apply Rle_trans with (2:=H4); right; ring. apply Rle_trans with (2:=H4); right; ring.
apply Rlt_trans with f. apply Rlt_trans with f.
apply Rplus_lt_reg_l with (-f+bpow (ln_beta radix2 f - prec)). apply Rplus_lt_reg_l with (-f+bpow (mag radix2 f - prec)).
ring_simplify. ring_simplify.
apply bpow_gt_0. apply bpow_gt_0.
apply Rle_lt_trans with (1:=RRle_abs _). apply Rle_lt_trans with (1:=RRle_abs _).
apply bpow_ln_beta_gt. apply bpow_mag_gt.
apply Rle_ge. apply Rle_ge.
apply Rplus_le_reg_l with (bpow (ln_beta radix2 f - prec)). apply Rplus_le_reg_l with (bpow (mag radix2 f - prec)).
ring_simplify. ring_simplify.
left; apply Rle_lt_trans with (2:=H0). left; apply Rle_lt_trans with (2:=H0).
apply bpow_le. apply bpow_le.
...@@ -395,7 +395,7 @@ omega. ...@@ -395,7 +395,7 @@ omega.
assert (T: (ulp_flt (pred_flt f) = ulp_flt f \/ assert (T: (ulp_flt (pred_flt f) = ulp_flt f \/
(ulp_flt (pred_flt f) = / 2 * ulp_flt f /\ - h < / 4 * ulp_flt f)) (ulp_flt (pred_flt f) = / 2 * ulp_flt f /\ - h < / 4 * ulp_flt f))
\/ (ulp_flt (pred_flt f) = / 2 * ulp_flt f /\ \/ (ulp_flt (pred_flt f) = / 2 * ulp_flt f /\
f = bpow (ln_beta radix2 f - 1) /\ f = bpow (mag radix2 f - 1) /\
- h = / 4 * ulp_flt f) ). - h = / 4 * ulp_flt f) ).
destruct T1. destruct T1.
left; now left. left; now left.
...@@ -470,7 +470,7 @@ rewrite Y1. ...@@ -470,7 +470,7 @@ rewrite Y1.
right; field. right; field.
(* complex case: even choosing *) (* complex case: even choosing *)
elim H0; intros T1 (T2,T3); clear H0. elim H0; intros T1 (T2,T3); clear H0.
assert (pred_flt f = bpow (ln_beta radix2 f - 1) - bpow (ln_beta radix2 f - 1 -prec)). assert (pred_flt f = bpow (mag radix2 f - 1) - bpow (mag radix2 f - 1 -prec)).
rewrite pred_eq_pos; try now left. rewrite pred_eq_pos; try now left.
unfold pred_pos; case Req_bool_spec. unfold pred_pos; case Req_bool_spec.
intros _; rewrite <- T2. intros _; rewrite <- T2.
...@@ -503,7 +503,7 @@ apply ulp_ge_0. ...@@ -503,7 +503,7 @@ apply ulp_ge_0.
fourier. fourier.
rewrite T1, H0, <- T2. rewrite T1, H0, <- T2.
replace h with (--h) by ring; rewrite T3. replace h with (--h) by ring; rewrite T3.
replace (bpow (ln_beta radix2 f - 1 - prec)) with (/2*ulp_flt f). replace (bpow (mag radix2 f - 1 - prec)) with (/2*ulp_flt f).
field. field.
replace (/2) with (bpow (-1)) by reflexivity. replace (/2) with (bpow (-1)) by reflexivity.
rewrite T2 at 1. rewrite T2 at 1.
...@@ -799,8 +799,8 @@ replace (/4) with (bpow (-2)) by reflexivity. ...@@ -799,8 +799,8 @@ replace (/4) with (bpow (-2)) by reflexivity.
rewrite <- bpow_plus. rewrite <- bpow_plus.
apply bpow_le. apply bpow_le.
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
assert (emin+prec+prec+1 -1 < ln_beta radix2 (x/2))%Z. assert (emin+prec+prec+1 -1 < mag radix2 (x/2))%Z.
destruct (ln_beta radix2 (x/2)) as (e,He). destruct (mag radix2 (x/2)) as (e,He).
simpl. simpl.
apply lt_bpow with radix2. apply lt_bpow with radix2.
apply Rle_lt_trans with (Rabs (x/2)). apply Rle_lt_trans with (Rabs (x/2)).
...@@ -1019,7 +1019,7 @@ omega. ...@@ -1019,7 +1019,7 @@ omega.
now left. now left.
replace (bpow emin /2) with (bpow (emin-1)). replace (bpow emin /2) with (bpow (emin-1)).
unfold round, scaled_mantissa, cexp, FLT_exp. unfold round, scaled_mantissa, cexp, FLT_exp.
rewrite ln_beta_bpow. rewrite mag_bpow.
replace (emin - 1 + 1 - prec)%Z with (emin-prec)%Z by ring. replace (emin - 1 + 1 - prec)%Z with (emin-prec)%Z by ring.
rewrite Z.max_r. rewrite Z.max_r.
2: unfold Prec_gt_0 in prec_gt_0_; omega. 2: unfold Prec_gt_0 in prec_gt_0_; omega.
...@@ -1516,9 +1516,9 @@ replace 2 with (bpow 1) by reflexivity. ...@@ -1516,9 +1516,9 @@ replace 2 with (bpow 1) by reflexivity.
rewrite <- bpow_plus. rewrite <- bpow_plus.
apply bpow_le. apply bpow_le.
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
rewrite Rmult_comm, ln_beta_mult_bpow; trivial. rewrite Rmult_comm, mag_mult_bpow; trivial.
rewrite <- Z.add_max_distr_l. rewrite <- Z.add_max_distr_l.
replace (ln_beta radix2 b + 1 - prec)%Z with (1 + (ln_beta radix2 b - prec))%Z by ring. replace (mag radix2 b + 1 - prec)%Z with (1 + (mag radix2 b - prec))%Z by ring.
apply Z.max_le_compat_l. apply Z.max_le_compat_l.
omega. omega.
(* . splitting case of av=0 *) (* . splitting case of av=0 *)
......
...@@ -38,7 +38,7 @@ Theorem pred_gt_0: forall f, ...@@ -38,7 +38,7 @@ Theorem pred_gt_0: forall f,
format f -> (0 < f)%R -> (0 < pred beta (FLX_exp prec) f)%R. format f -> (0 < f)%R -> (0 < pred beta (FLX_exp prec) f)%R.
intros f Hf Zf. intros f Hf Zf.
unfold pred, Fcore_ulp.ulp, canonic_exp, FLX_exp. unfold pred, Fcore_ulp.ulp, canonic_exp, FLX_exp.
destruct (ln_beta beta f) as (ef,Hef). destruct (mag beta f) as (ef,Hef).
simpl. simpl.
assert (Zf2: (f <>0)%R) by now apply Rgt_not_eq. assert (Zf2: (f <>0)%R) by now apply Rgt_not_eq.
specialize (Hef Zf2). specialize (Hef Zf2).
...@@ -140,7 +140,7 @@ Qed. ...@@ -140,7 +140,7 @@ Qed.
Theorem implies_MinOrMax_bpow: Theorem implies_MinOrMax_bpow:
forall x f, format f -> forall x f, format f ->
f = bpow (ln_beta beta f) -> f = bpow (mag beta f) ->
(Rabs (f-x) < /2* ulp f)%R -> (Rabs (f-x) < /2* ulp f)%R ->
MinOrMax x f. MinOrMax x f.
intros x f Hf1 Hf2 Hxf. intros x f Hf1 Hf2 Hxf.
......
This diff is collapsed.
This diff is collapsed.
...@@ -595,7 +595,7 @@ unfold truncate_aux. ...@@ -595,7 +595,7 @@ unfold truncate_aux.
apply generic_format_F2R. apply generic_format_F2R.
intros Hd. intros Hd.
unfold cexp. unfold cexp.
rewrite ln_beta_F2R_Zdigits with (1 := Hd). rewrite mag_F2R_Zdigits with (1 := Hd).
rewrite Zdigits_div_Zpower with (1 := Hm). rewrite Zdigits_div_Zpower with (1 := Hm).
replace (Zdigits beta m - k + (e + k))%Z with (Zdigits beta m + e)%Z by ring. replace (Zdigits beta m - k + (e + k))%Z with (Zdigits beta m + e)%Z by ring.
unfold k. unfold k.
...@@ -615,7 +615,7 @@ now apply Zgt_lt. ...@@ -615,7 +615,7 @@ now apply Zgt_lt.
destruct (Zle_lt_or_eq _ _ Hm) as [Hm'|Hm']. destruct (Zle_lt_or_eq _ _ Hm) as [Hm'|Hm'].
apply generic_format_F2R. apply generic_format_F2R.
unfold cexp. unfold cexp.
rewrite ln_beta_F2R_Zdigits. rewrite mag_F2R_Zdigits.
2: now apply Zgt_not_eq. 2: now apply Zgt_not_eq.
unfold k in Hk. clear -Hk. unfold k in Hk. clear -Hk.
omega. omega.
...@@ -635,7 +635,7 @@ Proof. ...@@ -635,7 +635,7 @@ Proof.
intros m e Hm x Fx He. intros m e Hm x Fx He.
assert (Hc: cexp beta fexp x = fexp (Zdigits beta m + e)). assert (Hc: cexp beta fexp x = fexp (Zdigits beta m + e)).
unfold cexp, x. unfold cexp, x.
now rewrite ln_beta_F2R_Zdigits. now rewrite mag_F2R_Zdigits.
unfold truncate. unfold truncate.
rewrite <- Hc. rewrite <- Hc.
set (k := (cexp beta fexp x - e)%Z). set (k := (cexp beta fexp x - e)%Z).
...@@ -698,17 +698,17 @@ assert (He: (e + k = cexp beta fexp x)%Z). ...@@ -698,17 +698,17 @@ assert (He: (e + k = cexp beta fexp x)%Z).
unfold cexp. unfold cexp.
destruct (Zle_lt_or_eq _ _ Hm) as [Hm'|Hm']. destruct (Zle_lt_or_eq _ _ Hm) as [Hm'|Hm'].
(* .. 0 < m *) (* .. 0 < m *)
rewrite ln_beta_F2R_bounds with (1 := Hm') (2 := Hx'). rewrite mag_F2R_bounds with (1 := Hm') (2 := Hx').
assert (H: m <> Z0). assert (H: m <> Z0).
apply sym_not_eq. apply sym_not_eq.
now apply Zlt_not_eq. now apply Zlt_not_eq.
rewrite ln_beta_F2R with (1 := H). rewrite mag_F2R with (1 := H).
rewrite <- Zdigits_ln_beta with (1 := H). rewrite <- Zdigits_mag with (1 := H).
unfold k. unfold k.
ring. ring.
(* .. m = 0 *) (* .. m = 0 *)
rewrite <- Hm' in H2. rewrite <- Hm' in H2.
destruct (ln_beta beta x) as (ex, Hex). destruct (mag beta x) as (ex, Hex).
simpl. simpl.
specialize (Hex (Rgt_not_eq _ _ Hx)). specialize (Hex (Rgt_not_eq _ _ Hx)).
unfold k. unfold k.
...@@ -781,7 +781,7 @@ rewrite H. ...@@ -781,7 +781,7 @@ rewrite H.
apply generic_format_F2R. apply generic_format_F2R.
intros Zm. intros Zm.
unfold cexp. unfold cexp.
rewrite ln_beta_F2R_Zdigits with (1 := Zm). rewrite mag_F2R_Zdigits with (1 := Zm).
now apply Zlt_le_weak. now apply Zlt_le_weak.
(* x = 0 *) (* x = 0 *)
assert (Hm: m = Z0). assert (Hm: m = Z0).
......
...@@ -58,11 +58,11 @@ rewrite H1. ...@@ -58,11 +58,11 @@ rewrite H1.
apply generic_format_F2R. apply generic_format_F2R.
intros Zmx. intros Zmx.
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
rewrite ln_beta_F2R with (1 := Zmx). rewrite mag_F2R with (1 := Zmx).
apply Zmax_lub with (2 := H3). apply Zmax_lub with (2 := H3).
apply Zplus_le_reg_r with (prec - ex)%Z. apply Zplus_le_reg_r with (prec - ex)%Z.
ring_simplify. ring_simplify.
now apply ln_beta_le_Zpower. now apply mag_le_Zpower.
Qed. Qed.
Theorem FLT_format_generic : Theorem FLT_format_generic :
...@@ -87,7 +87,7 @@ destruct (Req_dec x 0) as [Hx0|Hx0]. ...@@ -87,7 +87,7 @@ destruct (Req_dec x 0) as [Hx0|Hx0].
rewrite Hx0, Rabs_R0. rewrite Hx0, Rabs_R0.
apply bpow_gt_0. apply bpow_gt_0.
unfold cexp in ex. unfold cexp in ex.
destruct (ln_beta beta x) as (ex', He). destruct (mag beta x) as (ex', He).
simpl in ex. simpl in ex.
specialize (He Hx0). specialize (He Hx0).
apply Rlt_le_trans with (1 := proj2 He). apply Rlt_le_trans with (1 := proj2 He).
...@@ -132,7 +132,7 @@ intros H1; rewrite H1, Rabs_R0 in Hx. ...@@ -132,7 +132,7 @@ intros H1; rewrite H1, Rabs_R0 in Hx.
contradict Hx; apply Rlt_not_le, bpow_gt_0. contradict Hx; apply Rlt_not_le, bpow_gt_0.
unfold cexp. unfold cexp.
apply Zmax_left. apply Zmax_left.
destruct (ln_beta beta x) as (ex, He). destruct (mag beta x) as (ex, He).
unfold FLX_exp. simpl. unfold FLX_exp. simpl.
specialize (He Hx0). specialize (He Hx0).
cut (emin + prec - 1 < ex)%Z. omega. cut (emin + prec - 1 < ex)%Z. omega.
...@@ -189,7 +189,7 @@ intros x Hx0 Hx. ...@@ -189,7 +189,7 @@ intros x Hx0 Hx.
unfold cexp. unfold cexp.
apply Zmax_right. apply Zmax_right.
unfold FIX_exp. unfold FIX_exp.
destruct (ln_beta beta x) as (ex, Hex). destruct (mag beta x) as (ex, Hex).
simpl. simpl.
cut (ex - 1 < emin + prec)%Z. omega. cut (ex - 1 < emin + prec)%Z. omega.
apply (lt_bpow beta). apply (lt_bpow beta).
...@@ -244,8 +244,8 @@ omega. ...@@ -244,8 +244,8 @@ omega.
(* x <> 0 *) (* x <> 0 *)
apply f_equal; unfold cexp, FLT_exp. apply f_equal; unfold cexp, FLT_exp.
apply Z.max_r. apply Z.max_r.
assert (ln_beta beta x-1 < emin+prec)%Z;[idtac|omega]. assert (mag beta x-1 < emin+prec)%Z;[idtac|omega].
destruct (ln_beta beta x) as (e,He); simpl. destruct (mag beta x) as (e,He); simpl.
apply lt_bpow with beta. apply lt_bpow with beta.
apply Rle_lt_trans with (2:=Hx). apply Rle_lt_trans with (2:=Hx).
now apply He. now apply He.
...@@ -261,7 +261,7 @@ assert (Zx : (x <> 0)%R). ...@@ -261,7 +261,7 @@ assert (Zx : (x <> 0)%R).
rewrite Z, Rabs_R0; apply bpow_gt_0. rewrite Z, Rabs_R0; apply bpow_gt_0.
rewrite ulp_neq_0 with (1 := Zx). rewrite ulp_neq_0 with (1 := Zx).
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
destruct (ln_beta beta x) as (e,He). destruct (mag beta x) as (e,He).
apply Rle_trans with (bpow (e-1)*bpow (1-prec))%R. apply Rle_trans with (bpow (e-1)*bpow (1-prec))%R.
rewrite <- bpow_plus. rewrite <- bpow_plus.
right; apply f_equal. right; apply f_equal.
...@@ -284,10 +284,10 @@ rewrite Hx, ulp_FLT_small, Rabs_R0, Rmult_0_l; try apply bpow_gt_0. ...@@ -284,10 +284,10 @@ rewrite Hx, ulp_FLT_small, Rabs_R0, Rmult_0_l; try apply bpow_gt_0.
rewrite Rabs_R0; apply bpow_gt_0. rewrite Rabs_R0; apply bpow_gt_0.
rewrite ulp_neq_0; try exact Hx. rewrite ulp_neq_0; try exact Hx.
unfold cexp, FLT_exp. unfold cexp, FLT_exp.
apply Rlt_le_trans with (bpow (ln_beta beta x)*bpow (-prec))%R. apply Rlt_le_trans with (bpow (mag beta x)*bpow (-prec))%R.
apply Rmult_lt_compat_r. apply Rmult_lt_compat_r.
apply bpow_gt_0. apply bpow_gt_0.
now apply bpow_ln_beta_gt. now apply bpow_mag_gt.
rewrite <- bpow_plus. rewrite <- bpow_plus.
apply bpow_le. apply bpow_le.
apply Z.le_max_l. apply Z.le_max_l.
......
...@@ -81,12 +81,12 @@ rewrite scaled_mantissa_mult_bpow. ...@@ -81,12 +81,12 @@ rewrite scaled_mantissa_mult_bpow.
rewrite Z2R_Zpower, <- bpow_plus. rewrite Z2R_Zpower, <- bpow_plus.
2: now apply Zlt_le_weak. 2: now apply Zlt_le_weak.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
ring_simplify (prec + (ln_beta beta (Rabs x) - prec))%Z. ring_simplify (prec + (mag beta (Rabs x) - prec))%Z.
rewrite ln_beta_abs. rewrite mag_abs.
destruct (Req_dec x 0) as [Hx|Hx]. destruct (Req_dec x 0) as [Hx|Hx].
rewrite Hx, Rabs_R0. rewrite Hx, Rabs_R0.
apply bpow_gt_0. apply bpow_gt_0.
destruct (ln_beta beta x) as (ex, Ex). destruct (mag beta x) as (ex, Ex).
now apply Ex. now apply Ex.
Qed. Qed.
...@@ -100,10 +100,10 @@ rewrite H1. ...@@ -100,10 +100,10 @@ rewrite H1.
apply generic_format_F2R. apply generic_format_F2R.
intros Zmx. intros Zmx.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
rewrite ln_beta_F2R with (1 := Zmx). rewrite mag_F2R with (1 := Zmx).
apply Zplus_le_reg_r with (prec - ex)%Z. apply Zplus_le_reg_r with (prec - ex)%Z.
ring_simplify. ring_simplify.
now apply ln_beta_le_Zpower. now apply mag_le_Zpower.
Qed. Qed.
Theorem FLX_format_satisfies_any : Theorem FLX_format_satisfies_any :
...@@ -174,9 +174,9 @@ rewrite <- scaled_mantissa_abs. ...@@ -174,9 +174,9 @@ rewrite <- scaled_mantissa_abs.
rewrite <- cexp_abs. rewrite <- cexp_abs.
rewrite scaled_mantissa_mult_bpow. rewrite scaled_mantissa_mult_bpow.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
rewrite ln_beta_abs. rewrite mag_abs.
ring_simplify (prec - 1 + (ln_beta beta x - prec))%Z. ring_simplify (prec - 1 + (mag beta x - prec))%Z.
destruct (ln_beta beta x) as (ex,Ex). destruct (mag beta x) as (ex,Ex).
now apply Ex. now apply Ex.
(* *) (* *)
apply lt_Z2R. apply lt_Z2R.
...@@ -190,9 +190,9 @@ rewrite <- scaled_mantissa_abs. ...@@ -190,9 +190,9 @@ rewrite <- scaled_mantissa_abs.
rewrite <- cexp_abs. rewrite <- cexp_abs.
rewrite scaled_mantissa_mult_bpow. rewrite scaled_mantissa_mult_bpow.
unfold cexp, FLX_exp. unfold cexp, FLX_exp.
rewrite ln_beta_abs. rewrite mag_abs.
ring_simplify (prec + (ln_beta beta x - prec))%Z. ring_simplify (prec + (mag beta x - prec))%Z.
destruct (ln_beta beta x) as (ex,Ex). destruct (mag beta x) as (ex,Ex).
now apply Ex. now apply Ex.
Qed. Qed.
...@@ -222,11 +222,11 @@ rewrite Hx, ulp_FLX_0, Rabs_R0. ...@@ -222,11 +222,11 @@ rewrite Hx, ulp_FLX_0, Rabs_R0.
right; ring. right; ring.