Commit 416d16fe authored by Guillaume Melquiond's avatar Guillaume Melquiond

Changed epow to bpow, Lemma to Theorem, Rabs_Z2R to abs_Z2R.

parent 3106df88
This diff is collapsed.
......@@ -10,7 +10,7 @@ Implicit Arguments Fexp [[beta]].
Variable beta : radix.
Definition F2R (f : float beta) :=
(Z2R (Fnum f) * epow beta (Fexp f))%R.
(Z2R (Fnum f) * bpow beta (Fexp f))%R.
Definition MonotoneP (rnd : R -> R) :=
forall x y : R,
......
......@@ -6,7 +6,7 @@ Section Flocq_float_ops.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Definition Falign (f1 f2 : float beta) :=
let '(Float m1 e1) := f1 in
......@@ -60,7 +60,7 @@ Theorem mult_F2R :
Proof.
intros (m1, e1) (m2, e2).
unfold Fmult, F2R. simpl.
rewrite mult_Z2R, epow_add.
rewrite mult_Z2R, bpow_add.
ring.
Qed.
......
......@@ -5,7 +5,7 @@ Section Float_prop.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Theorem F2R_ge_0_reg :
forall m e : Z,
......@@ -15,7 +15,7 @@ Proof.
intros m e H.
apply le_Z2R.
apply Rmult_le_reg_r with (bpow e).
apply epow_gt_0.
apply bpow_gt_0.
now rewrite Rmult_0_l.
Qed.
......@@ -28,7 +28,7 @@ intros m e H.
apply le_Z2R.
apply Ropp_le_cancel.
apply Rmult_le_reg_r with (bpow e).
apply epow_gt_0.
apply bpow_gt_0.
simpl (Z2R 0).
rewrite Ropp_0.
rewrite Rmult_0_l.
......@@ -45,7 +45,7 @@ Proof.
intros m e H.
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow e).
apply epow_gt_0.
apply bpow_gt_0.
now rewrite Rmult_0_l.
Qed.
......@@ -58,7 +58,7 @@ intros f Hm.
unfold F2R.
apply Rmult_lt_0_compat.
now apply (Z2R_lt 0).
apply epow_gt_0.
apply bpow_gt_0.
Qed.
Theorem F2R_le_reg :
......@@ -69,7 +69,7 @@ Proof.
intros e m1 m2 H.
apply le_Z2R.
apply Rmult_le_reg_r with (bpow e).
apply epow_gt_0.
apply bpow_gt_0.
exact H.
Qed.
......@@ -81,7 +81,7 @@ Proof.
intros m1 m2 e H.
unfold F2R. simpl.
apply Rmult_le_compat_r.
apply epow_ge_0.
apply bpow_ge_0.
now apply Z2R_le.
Qed.
......@@ -93,7 +93,7 @@ Proof.
intros e m1 m2 H.
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow e).
apply epow_gt_0.
apply bpow_gt_0.
exact H.
Qed.
......@@ -105,11 +105,11 @@ Proof.
intros e m1 m2 H.
unfold F2R. simpl.
apply Rmult_lt_compat_r.
apply epow_gt_0.
apply bpow_gt_0.
now apply Z2R_lt.
Qed.
Theorem epow_le_F2R :
Theorem bpow_le_F2R :
forall m e : Z,
(0 < m)%Z ->
(bpow e <= F2R (Float beta m e))%R.
......@@ -118,12 +118,12 @@ intros m e H.
rewrite <- (Rmult_1_l (bpow e)).
unfold F2R. simpl.
apply Rmult_le_compat_r.
apply epow_ge_0.
apply bpow_ge_0.
apply (Z2R_le 1).
now apply (Zlt_le_succ 0).
Qed.
Theorem F2R_p1_le_epow :
Theorem F2R_p1_le_bpow :
forall m e1 e2 : Z,
(0 < m)%Z ->
(F2R (Float beta m e1) < bpow e2)%R ->
......@@ -133,29 +133,29 @@ intros m e1 e2 Hm.
intros H.
assert (He : (e1 <= e2)%Z).
(* . *)
apply <- (epow_le beta).
apply <- (bpow_le beta).
apply Rle_trans with (F2R (Float beta m e1)).
unfold F2R. simpl.
rewrite <- (Rmult_1_l (bpow e1)) at 1.
apply Rmult_le_compat_r.
apply epow_ge_0.
apply bpow_ge_0.
apply (Z2R_le 1).
now apply (Zlt_le_succ 0).
now apply Rlt_le.
(* . *)
revert H.
replace e2 with (e2 - e1 + e1)%Z by ring.
rewrite epow_add.
rewrite bpow_add.
unfold F2R. simpl.
rewrite <- (Z2R_Zpower beta (e2 - e1)).
intros H.
apply Rmult_le_compat_r.
apply epow_ge_0.
apply bpow_ge_0.
apply Rmult_lt_reg_r in H.
apply Z2R_le.
apply Zlt_le_succ.
now apply lt_Z2R.
apply epow_gt_0.
apply bpow_gt_0.
now apply Zle_minus_le_0.
Qed.
......@@ -166,12 +166,12 @@ Proof.
intros m e.
unfold F2R.
rewrite Rabs_mult.
rewrite Rabs_Z2R.
rewrite <- abs_Z2R.
simpl.
apply f_equal.
apply Rabs_right.
apply Rle_ge.
apply epow_ge_0.
apply bpow_ge_0.
Qed.
Theorem opp_F2R :
......@@ -194,7 +194,7 @@ unfold F2R. simpl.
rewrite mult_Z2R, Z2R_Zpower, Rmult_assoc.
apply f_equal.
pattern e at 1 ; replace e with (e - e' + e')%Z by ring.
apply epow_add.
apply bpow_add.
now apply Zle_minus_le_0.
Qed.
......@@ -212,11 +212,11 @@ now elim (Zle_not_lt _ _ (Zabs_pos m)).
replace (e - e' + p)%Z with (e - (e' - p))%Z by ring.
apply F2R_change_exp.
cut (e' - 1 < e + p)%Z. omega.
apply <- epow_lt.
apply <- bpow_lt.
apply Rle_lt_trans with (1 := Hf).
rewrite abs_F2R, Zplus_comm, epow_add.
rewrite abs_F2R, Zplus_comm, bpow_add.
apply Rmult_lt_compat_r.
apply epow_gt_0.
apply bpow_gt_0.
rewrite <- Z2R_Zpower.
now apply Z2R_lt.
exact Hp.
......@@ -234,16 +234,16 @@ specialize (Hd (Z2R_neq _ _ H)).
apply ln_beta_unique.
rewrite abs_F2R.
unfold F2R. simpl.
rewrite Rabs_Z2R in Hd.
rewrite <- abs_Z2R in Hd.
split.
replace (d + e - 1)%Z with (d - 1 + e)%Z by ring.
rewrite epow_add.
rewrite bpow_add.
apply Rmult_le_compat_r.
apply epow_ge_0.
apply bpow_ge_0.
apply Hd.
rewrite epow_add.
rewrite bpow_add.
apply Rmult_lt_compat_r.
apply epow_gt_0.
apply bpow_gt_0.
apply Hd.
Qed.
......@@ -287,7 +287,7 @@ apply Rlt_gt.
unfold F2R. simpl.
apply Rmult_lt_0_compat.
now apply (Z2R_lt 0).
apply epow_gt_0.
apply bpow_gt_0.
now apply Zlt_le_weak.
clear H1.
rewrite abs_F2R, Zabs_eq.
......@@ -296,7 +296,7 @@ apply Rlt_le.
apply Rle_lt_trans with (2 := H12).
apply H2.
apply Rlt_le_trans with (1 := H21).
now apply F2R_p1_le_epow.
now apply F2R_p1_le_bpow.
now apply Zlt_le_weak.
apply sym_not_eq.
now apply Zlt_not_eq.
......
......@@ -7,7 +7,7 @@ Section RND_FIX.
Variable beta : radix.
Notation bpow := (epow beta).
Notation bpow := (bpow beta).
Variable emin : Z.
......
......@@ -10,7 +10,7 @@ Section RND_FLT.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Variable emin prec : Z.
Variable Hp : Zlt 0 prec.
......@@ -91,15 +91,15 @@ specialize (Hx4 Hx3).
apply lt_Z2R.
rewrite Z2R_Zpower.
apply Rmult_lt_reg_r with (bpow (ex - prec)).
apply epow_gt_0.
rewrite <- epow_add.
apply bpow_gt_0.
rewrite <- bpow_add.
replace (prec + (ex - prec))%Z with ex by ring.
apply Rle_lt_trans with (Z2R (Zabs xm) * bpow xe)%R.
rewrite Hx2.
apply Rmult_le_compat_l.
apply (Z2R_le 0).
apply Zabs_pos.
apply -> epow_le.
apply -> bpow_le.
apply Zle_max_l.
replace (Z2R (Zabs xm) * bpow xe)%R with (Rabs x).
exact (proj2 Hx4).
......@@ -151,7 +151,7 @@ simpl.
apply sym_eq.
apply Zmax_left.
cut (emin + prec <= ex)%Z. omega.
apply epow_lt_epow with beta.
apply bpow_lt_bpow with beta.
apply Rle_lt_trans with (1 := Hx1).
now apply Hx5.
Qed.
......@@ -177,11 +177,11 @@ eexists ; repeat split.
apply lt_Z2R.
rewrite Z2R_Zpower.
apply Rmult_lt_reg_r with (bpow xe).
apply epow_gt_0.
apply bpow_gt_0.
rewrite H1, abs_F2R in Hx.
apply Rlt_le_trans with (1 := Hx).
rewrite <- epow_add.
apply -> epow_le.
rewrite <- bpow_add.
apply -> bpow_le.
rewrite Zplus_comm, <- H2.
apply Zle_refl.
now apply Zlt_le_weak.
......
......@@ -9,7 +9,7 @@ Section RND_FLX.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Variable prec : Z.
Variable Hp : Zlt 0 prec.
......@@ -52,8 +52,8 @@ rewrite H1.
eexists ; repeat split.
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow (e - prec)).
apply epow_gt_0.
rewrite Z2R_Zpower, <- epow_add.
apply bpow_gt_0.
rewrite Z2R_Zpower, <- bpow_add.
ring_simplify (prec + (e - prec))%Z.
rewrite <- H2.
simpl.
......@@ -154,18 +154,17 @@ destruct (ln_beta beta (Z2R xm)) as (d,H4).
specialize (H4 (Z2R_neq _ _ H3)).
assert (H5: (0 <= prec - d)%Z).
cut (d - 1 < prec)%Z. omega.
apply <- (epow_lt beta).
apply <- (bpow_lt beta).
apply Rle_lt_trans with (Rabs (Z2R xm)).
apply H4.
rewrite <- Z2R_Zpower.
rewrite Rabs_Z2R.
rewrite <- Z2R_Zpower, <- abs_Z2R.
now apply Z2R_lt.
now apply Zlt_le_weak.
exists (Float beta (xm * Zpower (radix_val beta) (prec - d)) (xe + d - prec)).
split.
unfold F2R. simpl.
rewrite mult_Z2R, Z2R_Zpower.
rewrite Rmult_assoc, <- epow_add.
rewrite Rmult_assoc, <- bpow_add.
rewrite H1.
now ring_simplify (prec - d + (xe + d - prec))%Z.
exact H5.
......@@ -173,29 +172,29 @@ intros _. simpl.
split.
apply le_Z2R.
apply Rmult_le_reg_r with (bpow (d - prec)).
apply epow_gt_0.
rewrite <- Rabs_Z2R, mult_Z2R, Rabs_mult, 2!Z2R_Zpower.
rewrite <- epow_add.
rewrite Rabs_Z2R.
apply bpow_gt_0.
rewrite abs_Z2R, mult_Z2R, Rabs_mult, 2!Z2R_Zpower.
rewrite <- bpow_add.
rewrite <- abs_Z2R.
rewrite Rabs_pos_eq.
rewrite Rmult_assoc, <- epow_add.
rewrite Rmult_assoc, <- bpow_add.
ring_simplify (prec - 1 + (d - prec))%Z.
ring_simplify (prec - d + (d - prec))%Z.
now rewrite Rmult_1_r, <- Rabs_Z2R.
apply epow_ge_0.
now rewrite Rmult_1_r, abs_Z2R.
apply bpow_ge_0.
exact H5.
omega.
apply lt_Z2R.
rewrite <- Rabs_Z2R, mult_Z2R, Rabs_mult.
rewrite abs_Z2R, mult_Z2R, Rabs_mult.
rewrite 2!Z2R_Zpower.
rewrite Rabs_Z2R, Rabs_pos_eq.
rewrite <- abs_Z2R, Rabs_pos_eq.
apply Rmult_lt_reg_r with (bpow (d - prec)).
apply epow_gt_0.
rewrite Rmult_assoc, <- 2!epow_add.
apply bpow_gt_0.
rewrite Rmult_assoc, <- 2!bpow_add.
ring_simplify (prec + (d - prec))%Z.
ring_simplify (prec - d + (d - prec))%Z.
now rewrite Rmult_1_r, <- Rabs_Z2R.
apply epow_ge_0.
now rewrite Rmult_1_r, abs_Z2R.
apply bpow_ge_0.
now apply Zlt_le_weak.
exact H5.
(* . *)
......
......@@ -9,7 +9,7 @@ Section RND_FTZ.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Variable emin prec : Z.
Variable Hp : Zlt 0 prec.
......@@ -68,19 +68,19 @@ elim (Rlt_not_ge _ _ (proj2 Hx6)).
apply Rle_ge.
rewrite Hx1.
apply Rle_trans with (bpow (prec - 1) * bpow emin)%R.
rewrite <- epow_add.
apply -> epow_le.
rewrite <- bpow_add.
apply -> bpow_le.
omega.
rewrite abs_F2R.
unfold F2R. simpl.
apply Rmult_le_compat.
apply epow_ge_0.
apply epow_ge_0.
apply bpow_ge_0.
apply bpow_ge_0.
rewrite <- Z2R_Zpower.
now apply Z2R_le.
apply Zle_minus_le_0.
now apply (Zlt_le_succ 0).
now apply -> epow_le.
now apply -> bpow_le.
rewrite Hx1, (F2R_prec_normalize beta xm xe ex prec (proj2 Hx2)).
now eexists.
now rewrite <- Hx1.
......@@ -108,17 +108,17 @@ rewrite <- (Rmult_1_l (bpow ex)).
unfold F2R. simpl.
apply Rmult_le_compat.
now apply (Z2R_le 0 1).
apply epow_ge_0.
apply bpow_ge_0.
apply (Z2R_le 1).
apply (Zlt_le_succ 0).
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow xe).
apply epow_gt_0.
apply bpow_gt_0.
rewrite Rmult_0_l.
change (0 < F2R (Float beta (Zabs xm) xe))%R.
rewrite <- abs_F2R, <- Hx1.
now apply Rabs_pos_lt.
apply -> epow_le.
apply -> bpow_le.
omega.
exists (Float beta xm xe).
split.
......@@ -129,8 +129,8 @@ split.
apply le_Z2R.
rewrite Z2R_Zpower.
apply Rmult_le_reg_r with (bpow (ex - prec)).
apply epow_gt_0.
rewrite <- epow_add.
apply bpow_gt_0.
rewrite <- bpow_add.
replace (prec - 1 + (ex - prec))%Z with (ex - 1)%Z by ring.
rewrite <- Hx2.
change (bpow (ex - 1) <= F2R (Float beta (Zabs xm) xe))%R.
......@@ -141,8 +141,8 @@ now apply (Zlt_le_succ 0).
apply lt_Z2R.
rewrite Z2R_Zpower.
apply Rmult_lt_reg_r with (bpow (ex - prec)).
apply epow_gt_0.
rewrite <- epow_add.
apply bpow_gt_0.
rewrite <- bpow_add.
replace (prec + (ex - prec))%Z with ex by ring.
rewrite <- Hx2.
change (F2R (Float beta (Zabs xm) xe) < bpow ex)%R.
......@@ -192,27 +192,27 @@ eexists. split. split. split.
now rewrite <- H1 at 1.
rewrite (Zsucc_pred emin).
apply Zlt_le_succ.
apply <- (epow_lt beta).
apply <- (bpow_lt beta).
apply Rmult_lt_reg_l with (Z2R (Zabs xm)).
apply Rmult_lt_reg_r with (bpow xe).
apply epow_gt_0.
apply bpow_gt_0.
rewrite Rmult_0_l.
rewrite H1, abs_F2R in Hx.
apply Rlt_le_trans with (2 := Hx).
apply epow_gt_0.
apply bpow_gt_0.
rewrite H1, abs_F2R in Hx.
apply Rlt_le_trans with (2 := Hx).
replace (emin + prec - 1)%Z with (prec + (emin - 1))%Z by ring.
rewrite epow_add.
rewrite bpow_add.
apply Rmult_lt_compat_r.
apply epow_gt_0.
apply bpow_gt_0.
rewrite <- Z2R_Zpower.
apply Z2R_lt.
apply H2.
intros H.
rewrite <- abs_F2R, <- H1, H, Rabs_right in Hx.
apply Rle_not_lt with (1 := Hx).
apply epow_gt_0.
apply bpow_gt_0.
apply Rle_refl.
now apply Zlt_le_weak.
Qed.
......
This diff is collapsed.
......@@ -13,7 +13,7 @@ Section Flocq_rnd_NE.
Variable beta : radix.
Notation bpow e := (epow beta e).
Notation bpow e := (bpow beta e).
Section Flocq_rnd_gNE.
......@@ -60,7 +60,7 @@ rewrite Zopp_eq_mult_neg_1.
now apply Zeven_mult_Zeven_l.
Qed.
Lemma canonic_imp_Fnum :
Theorem canonic_imp_Fnum :
forall x, forall f : float beta,
x <> R0 ->
canonic x f ->
......@@ -76,9 +76,9 @@ destruct (Zle_or_lt (Fexp f) ex) as [He|He].
(* . *)
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow (Fexp f)).
apply epow_gt_0.
apply bpow_gt_0.
replace (Z2R (Zabs (Fnum f)) * bpow (Fexp f))%R with (Rabs x).
rewrite Z2R_Zpower, <- epow_add.
rewrite Z2R_Zpower, <- bpow_add.
now ring_simplify (ex - Fexp f + Fexp f)%Z.
omega.
rewrite H1.
......@@ -93,22 +93,22 @@ unfold F2R. simpl.
rewrite <- (Rmult_1_l (bpow ex)).
apply Rmult_le_compat.
now apply (Z2R_le 0 1).
apply epow_ge_0.
apply bpow_ge_0.
apply (Z2R_le 1).
apply (Zlt_le_succ 0).
apply lt_Z2R.
apply Rmult_lt_reg_r with (bpow xe).
apply epow_gt_0.
apply bpow_gt_0.
rewrite Rmult_0_l.
replace (Z2R (Zabs xm) * bpow xe)%R with (Rabs x).
now apply Rabs_pos_lt.
rewrite H1.
apply abs_F2R.
apply -> epow_le.
apply -> bpow_le.
now apply Zlt_le_weak.
Qed.
Lemma Rnd_gNE_pt_unicity_prop :
Theorem Rnd_gNE_pt_unicity_prop :
Rnd_NG_pt_unicity_prop format gNE_prop.
Proof.
intros x d u Hxd1 Hxd2 Hxu1 Hxu2 Hd Hu.
......@@ -328,7 +328,7 @@ apply Rmult_eq_reg_r with (bpow emin).
rewrite plus_Z2R.
exact H.
apply Rgt_not_eq.
apply epow_gt_0.
apply bpow_gt_0.
Qed.
Theorem Rnd_NE_pt_FIX :
......@@ -406,7 +406,7 @@ assert (Hu3: cu = Float beta (Zpower (radix_val beta) (prec - 1)) (ex - prec + 1
apply canonic_unicity with (1 := conj Hu1 Hu2).
split.
unfold F2R. simpl.
rewrite Z2R_Zpower, <- epow_add.
rewrite Z2R_Zpower, <- bpow_add.
rewrite <- Hu.
apply f_equal.
ring.
......@@ -420,9 +420,9 @@ rewrite Rabs_pos_eq.
split.
replace (ex + 1 - 1)%Z with ex by ring.
apply Rle_refl.
apply -> epow_lt.
apply -> bpow_lt.
apply Zlt_succ.
apply epow_ge_0.
apply bpow_ge_0.
assert (Hd3: cd = Float beta (Zpower (radix_val beta) prec - 1) (ex - prec)).
apply canonic_unicity with (1 := conj Hd1 Hd2).
generalize (ulp_pred_succ_pt beta FLXf (FLX_exp_correct prec Hp) x xd xu Hfx Hxd Hxu).
......@@ -432,7 +432,7 @@ unfold F2R. simpl.
rewrite minus_Z2R.
unfold Rminus.
rewrite Rmult_plus_distr_r.
rewrite Z2R_Zpower, <- epow_add.
rewrite Z2R_Zpower, <- bpow_add.
ring_simplify (prec + (ex - prec))%Z.
rewrite Hu, Hud.
unfold ulp.
......@@ -498,7 +498,7 @@ apply Rmult_eq_reg_r with (bpow (FLXf ex)).
rewrite plus_Z2R.
exact H.
apply Rgt_not_eq.
apply epow_gt_0.
apply bpow_gt_0.
rewrite Rabs_pos_eq.
split.
apply Rle_trans with (1 := proj1 Hex).
......@@ -540,7 +540,7 @@ apply refl_equal.
destruct (ln_beta beta x) as (ex, Hex).
simpl.
cut (ex - 1 < emin + prec)%Z. omega.
apply <- epow_lt.
apply <- bpow_lt.
eapply Rle_lt_trans with (2 := Hx).
now apply Hex.
Qed.
......@@ -564,7 +564,7 @@ rewrite H1.
apply generic_format_0.
rewrite Rabs_pos_eq.
apply Rle_lt_trans with (1 := Hx).
apply -> epow_lt.
apply -> bpow_lt.
apply Zlt_pred.
now apply Rlt_le.
apply canonic_fun_eq with (2 := Hd).
......@@ -585,7 +585,7 @@ apply Zmax_right.
destruct (ln_beta beta x) as (ex, Hex).
simpl.
cut (ex - 1 <= emin + prec - 1)%Z. omega.
apply <- epow_le.
apply <- bpow_le.
apply Rle_trans with (2 := Hx).
rewrite <- (Rabs_pos_eq _ (Rlt_le _ _ Hx0)).
apply Hex.
......@@ -601,16 +601,16 @@ apply Zmax_right.
simpl. omega.
rewrite Rabs_pos_eq.
split.
apply -> epow_le.
apply -> bpow_le.
omega.
apply -> epow_lt.
apply -> bpow_lt.
apply Zlt_succ.
apply epow_ge_0.
apply bpow_ge_0.
rewrite Rabs_pos_eq.
apply Rle_lt_trans with x.
apply Hxd.
apply Rle_lt_trans with (1 := Hx).
apply -> epow_lt.
apply -> bpow_lt.
apply Zlt_pred.
apply Hxd.
apply generic_format_0.
......@@ -627,7 +627,7 @@ apply Hxu.
exists (Float beta (Zpower (radix_val beta) (prec - 1)) emin).
admit.
exact Hx.
apply -> epow_lt.
apply -> bpow_lt.
apply Zlt_pred.
apply Rlt_le.
apply Rlt_le_trans with (1 := Hx0).
......
......@@ -277,7 +277,7 @@ apply Hr.
apply Hu.
Qed.
Lemma Only_DN_or_UP :
Theorem