Commit d98b548b authored by Guillaume Melquiond's avatar Guillaume Melquiond

Add variants for valid_exp_large and generic_format_bpow_inv.

parent cb9b17e5
...@@ -51,15 +51,26 @@ Theorem valid_exp_large : ...@@ -51,15 +51,26 @@ Theorem valid_exp_large :
(fexp l < l)%Z. (fexp l < l)%Z.
Proof. Proof.
intros k l Hk H. intros k l Hk H.
replace l with (k + Z_of_nat (Zabs_nat (l - k)))%Z. apply Znot_ge_lt.
induction (Zabs_nat (l - k)). intros Hl.
now rewrite Zplus_0_r. apply Zge_le in Hl.
rewrite inj_S, <- Zplus_succ_r_reverse. assert (H' := proj2 (proj2 (valid_exp l) Hl) k).
apply Zle_lt_succ. omega.
now apply valid_exp_. Qed.
rewrite inj_Zabs_nat, Zabs_eq.
ring. Theorem valid_exp_large' :
now apply Zle_minus_le_0. forall k l,
(fexp k < k)%Z -> (l <= k)%Z ->
(fexp l < k)%Z.
Proof.
intros k l Hk H.
apply Znot_ge_lt.
intros H'.
apply Zge_le in H'.
assert (Hl := Zle_trans _ _ _ H H').
apply valid_exp in Hl.
assert (H1 := proj2 Hl k H').
omega.
Qed. Qed.
Definition canonic_exp x := Definition canonic_exp x :=
...@@ -456,38 +467,37 @@ specialize (Hp ex). ...@@ -456,38 +467,37 @@ specialize (Hp ex).
omega. omega.
Qed. Qed.
Theorem generic_format_bpow_inv : Theorem generic_format_bpow_inv' :
forall e, forall e,
generic_format (bpow e) -> generic_format (bpow e) ->
(fexp e <= e)%Z. (fexp (e + 1) <= e)%Z.
Proof. Proof.
intros e He. intros e He.
apply Znot_gt_le; intros He2. apply Znot_gt_le.
assert (e+1 <= fexp (e+1))%Z. contradict He.
replace (fexp (e+1)) with (fexp e). unfold generic_format, scaled_mantissa, canonic_exp, F2R. simpl.
omega. rewrite ln_beta_bpow, <- bpow_plus.
destruct (valid_exp e) as (Y1,Y2). apply Rgt_not_eq.
apply sym_eq; apply Y2; omega.
absurd (bpow e=0)%R.
apply sym_not_eq; apply Rlt_not_eq.
apply bpow_gt_0.
rewrite He.
replace (Ztrunc (scaled_mantissa (bpow e))) with 0%Z.
apply F2R_0.
apply sym_eq.
rewrite Ztrunc_floor. rewrite Ztrunc_floor.
unfold scaled_mantissa, canonic_exp. 2: apply bpow_ge_0.
apply mantissa_DN_small_pos; trivial. rewrite Zfloor_imp with (n := Z0).
rewrite ln_beta_bpow. rewrite Rmult_0_l.
apply bpow_gt_0.
split. split.
apply Req_le. apply bpow_ge_0.
apply f_equal. apply (bpow_lt _ _ 0).
ring. clear -He ; omega.
apply bpow_lt. Qed.
Theorem generic_format_bpow_inv :
forall e,
generic_format (bpow e) ->
(fexp e <= e)%Z.
Proof.
intros e He.
apply generic_format_bpow_inv' in He.
assert (H := valid_exp_large' (e + 1) e).
omega. omega.
now rewrite ln_beta_bpow.
unfold scaled_mantissa.
apply Rmult_le_pos; apply bpow_ge_0.
Qed. Qed.
Section Fcore_generic_round_pos. Section Fcore_generic_round_pos.
......
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