Dataset Viewer
Auto-converted to Parquet Duplicate
fact
stringlengths
12
30.2k
type
stringclasses
14 values
library
stringclasses
2 values
imports
listlengths
1
5
filename
stringclasses
43 values
symbolic_name
stringlengths
1
38
docstring
stringclasses
1 value
Rmin_Rmax_overflow : forall x y z M, Rabs x <= M -> Rabs y <= M -> Rmin x y <= z <= Rmax x y -> Rabs z <= M. Proof. intros x y z M Hx Hy H. case (Rle_or_lt 0 z); intros Hz. rewrite Rabs_right. apply Rle_trans with (1:=proj2 H). generalize (proj2 H). apply Rmax_case_strong. intros; apply Rle_trans with (2:=Hx). apply RR...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
Rmin_Rmax_overflow
radix2 := Build_radix 2 (refl_equal true).
Definition
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
radix2
bpow e := (bpow radix2 e). Variable emin prec : Z. Context { prec_gt_0_ : Prec_gt_0 prec }.
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
bpow
format := (generic_format radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
format
round_flt :=(round radix2 (FLT_exp emin prec) ZnearestE).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
round_flt
ulp_flt :=(ulp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
ulp_flt
cexp := (cexp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
cexp
pred_flt := (pred radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
pred_flt
FLT_format_double : forall u, format u -> format (2*u). Proof with auto with typeclass_instances. intros u Fu. apply generic_format_FLT. apply FLT_format_generic in Fu... destruct Fu as [uf H1 H2 H3]. exists (Float radix2 (Fnum uf) (Fexp uf+1)). rewrite H1; unfold F2R; simpl. rewrite bpow_plus, bpow_1. simpl;ring. easy...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
FLT_format_double
FLT_format_half : forall u, format u -> bpow (prec+emin) <= Rabs u -> format (u/2). Proof with auto with typeclass_instances. intros u Fu H. apply FLT_format_generic in Fu... destruct Fu as [[n e] H1 H2 H3]. simpl in H1, H2, H3. apply generic_format_FLT. exists (Float radix2 n (e-1)). rewrite H1; unfold F2R; simpl. unf...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
FLT_format_half
FLT_round_half : forall z, bpow (prec+emin) <= Rabs z -> round_flt (z/2)= round_flt z /2. Proof with auto with typeclass_instances. intros z Hz. apply Rmult_eq_reg_l with 2. 2: apply sym_not_eq; auto with real. apply trans_eq with (round_flt z). 2: field. assert (z <> 0)%R. intros K; contradict Hz. rewrite K, Rabs_R0; ...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
FLT_round_half
FLT_ulp_le_id : forall u, bpow emin <= u -> ulp_flt u <= u. Proof with auto with typeclass_instances. intros u H. rewrite ulp_neq_0. 2: apply Rgt_not_eq, Rlt_le_trans with (2:=H), bpow_gt_0. case (Rle_or_lt (bpow (emin+prec-1)) u); intros Hu. unfold ulp; rewrite cexp_FLT_FLX. unfold cexp, FLX_exp. destruct (mag radix2 ...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
FLT_ulp_le_id
FLT_ulp_double : forall u, ulp_flt (2*u) <= 2*ulp_flt(u). Proof. intros u. case (Req_bool_spec u 0); intros Hu'. rewrite Hu', Rmult_0_r. rewrite <- (Rmult_1_l (ulp_flt 0)) at 1. apply Rmult_le_compat_r. apply ulp_ge_0. left; apply Rlt_plus_1. rewrite 2!ulp_neq_0; trivial. 2: lra. change 2 with (bpow 1) at 2. rewrite <-...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
FLT_ulp_double
round_plus_small_id_aux : forall f h, format f -> (bpow (prec+emin) <= f) -> 0 < f -> Rabs h <= /4* ulp_flt f -> round_flt (f+h) = f. Proof with auto with typeclass_instances. intros f h Ff H1 H2 Hh. case (Rle_or_lt 0 h); intros H3;[destruct H3|idtac]. (* 0 < h *) rewrite Rabs_right in Hh. 2: now apply Rle_ge, Rlt_le. ...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
round_plus_small_id_aux
round_plus_small_id : forall f h, format f -> (bpow (prec+emin) <= Rabs f) -> Rabs h <= /4* ulp_flt f -> round_flt (f+h) = f. intros f h Ff H1 H2. case (Rle_or_lt 0 f); intros V. case V; clear V; intros V. apply round_plus_small_id_aux; try assumption. rewrite Rabs_right in H1; try assumption. apply Rle_ge; now left. c...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
round_plus_small_id
avg_naive (x y : R) :=round_flt(round_flt(x+y)/2). Variables x y:R. Hypothesis Fx: format x. Hypothesis Fy: format y.
Definition
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive
a :=(x+y)/2.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
a
av :=avg_naive x y.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
av
avg_naive_correct : av = round_flt a. Proof with auto with typeclass_instances. case (Rle_or_lt (bpow (prec + emin)) (Rabs (x+y))). (* normal case: division by 2 is exact *) intros H. unfold av,a,avg_naive. rewrite round_generic... now apply sym_eq, FLT_round_half. apply FLT_format_half. apply generic_format_round... a...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_correct
avg_naive_symmetry : forall u v, avg_naive u v = avg_naive v u. Proof. intros u v; unfold avg_naive. rewrite Rplus_comm; reflexivity. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_symmetry
avg_naive_symmetry_Ropp : forall u v, avg_naive (-u) (-v) = - avg_naive u v. Proof. intros u v; unfold avg_naive. replace (-u+-v) with (-(u+v)) by ring. rewrite round_NE_opp. replace (- round_flt (u + v) / 2) with (- (round_flt (u + v) / 2)) by (unfold Rdiv; ring). now rewrite round_NE_opp. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_symmetry_Ropp
avg_naive_same_sign_1 : 0 <= a -> 0 <= av. Proof with auto with typeclass_instances. intros H. rewrite avg_naive_correct. apply round_ge_generic... apply generic_format_0. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_same_sign_1
avg_naive_same_sign_2 : a <= 0-> av <= 0. Proof with auto with typeclass_instances. intros H. rewrite avg_naive_correct. apply round_le_generic... apply generic_format_0. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_same_sign_2
avg_naive_between : Rmin x y <= av <= Rmax x y. Proof with auto with typeclass_instances. rewrite avg_naive_correct. split. apply round_ge_generic... now apply P_Rmin. apply Rmult_le_reg_l with (1 := Rlt_0_2). replace (2 * Rmin x y) with (Rmin x y + Rmin x y) by ring. replace (2 * a) with (x + y) by (unfold a; field). ...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_between
avg_naive_zero : a = 0 -> av = 0. Proof with auto with typeclass_instances. intros H1; rewrite avg_naive_correct, H1. rewrite round_0... Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_zero
avg_naive_no_underflow : (bpow emin) <= Rabs a -> av <> 0. Proof with auto with typeclass_instances. intros H. (* *) cut (bpow emin <= Rabs av). intros H1 H2. rewrite H2 in H1; rewrite Rabs_R0 in H1. contradict H1. apply Rlt_not_le. apply bpow_gt_0. (* *) rewrite avg_naive_correct. apply abs_round_ge_generic... apply g...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_no_underflow
avg_naive_correct_weak1 : Rabs (av -a) <= /2*ulp_flt a. Proof with auto with typeclass_instances. rewrite avg_naive_correct. apply error_le_half_ulp... Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_correct_weak1
avg_naive_correct_weak2 : Rabs (av -a) <= 3/2*ulp_flt a. Proof with auto with typeclass_instances. apply Rle_trans with (1:=avg_naive_correct_weak1). apply Rmult_le_compat_r. unfold ulp; apply ulp_ge_0. lra. Qed. (* Hypothesis diff_sign: (0 <= x /\ y <= 0) \/ (x <= 0 /\ 0 <= y). is useless for properties: only useful f...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_naive_correct_weak2
avg_sum_half (x y : R) :=round_flt(round_flt(x/2) + round_flt(y/2)).
Definition
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_sum_half
av2 :=avg_sum_half x y.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
av2
avg_sum_half_correct : bpow (emin +prec+prec+1) <= Rabs x -> av2 = round_flt a. Proof with auto with typeclass_instances. intros Hx. assert (G:(0 < prec)%Z). unfold Prec_gt_0 in prec_gt_0_; assumption. unfold av2, avg_sum_half. replace (round_flt (x/2)) with (x/2). 2: apply sym_eq, round_generic... 2: apply FLT_format_...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_sum_half_correct
bpow e := (bpow radix2 e). Variable emin prec : Z. Context { prec_gt_0_ : Prec_gt_0 prec }.
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
bpow
format := (generic_format radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
format
round_flt :=(round radix2 (FLT_exp emin prec) ZnearestE).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
round_flt
ulp_flt :=(ulp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
ulp_flt
cexp := (cexp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
cexp
avg_half_sub (x y : R) :=round_flt(x+round_flt(round_flt(y-x)/2)). Variables x y:R. Hypothesis Fx: format x. Hypothesis Fy: format y.
Definition
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub
a :=(x+y)/2.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
a
av :=avg_half_sub x y.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
av
avg_half_sub_symmetry_Ropp : forall u v, avg_half_sub (-u) (-v) = - avg_half_sub u v. intros u v; unfold avg_half_sub. replace (-v--u) with (-(v-u)) by ring. rewrite round_NE_opp. replace (- round_flt (v-u) / 2) with (- (round_flt (v-u) / 2)) by (unfold Rdiv; ring). rewrite round_NE_opp. replace (- u + - round_flt (rou...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_symmetry_Ropp
avg_half_sub_same_sign_1 : 0 <= a -> 0 <= av. Proof with auto with typeclass_instances. intros H. apply round_ge_generic... apply generic_format_0. apply Rplus_le_reg_l with (-x). ring_simplify. apply round_ge_generic... now apply generic_format_opp. apply Rmult_le_reg_l with (1 := Rlt_0_2). apply Rle_trans with (-(2*x...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_same_sign_1
avg_half_sub_same_sign_2 : a <= 0-> av <= 0. Proof with auto with typeclass_instances. intros H. apply round_le_generic... apply generic_format_0. apply Rplus_le_reg_l with (-x). ring_simplify. apply round_le_generic... now apply generic_format_opp. apply Rmult_le_reg_l with (1 := Rlt_0_2). apply Rle_trans with (-(2*x)...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_same_sign_2
avg_half_sub_between_aux : forall u v, format u -> format v -> u <= v -> u <= avg_half_sub u v <= v. Proof with auto with typeclass_instances. clear Fx Fy a av x y. intros x y Fx Fy M. split. (* . *) apply round_ge_generic... apply Rplus_le_reg_l with (-x). ring_simplify. apply round_ge_generic... apply generic_format_...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_between_aux
avg_half_sub_between : Rmin x y <= av <= Rmax x y. Proof with auto with typeclass_instances. case (Rle_or_lt x y); intros M. (* x <= y *) rewrite Rmin_left; try exact M. rewrite Rmax_right; try exact M. now apply avg_half_sub_between_aux. (* y < x *) rewrite Rmin_right; try now left. rewrite Rmax_left; try now left. un...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_between
avg_half_sub_zero : a = 0 -> av = 0. Proof with auto with typeclass_instances. intros H. assert (y=-x). apply Rplus_eq_reg_l with x. apply Rmult_eq_reg_r with (/2). apply trans_eq with a. reflexivity. rewrite H; ring. lra. unfold av, avg_half_sub. rewrite H0. replace (-x-x) with (-(2*x)) by ring. rewrite round_generic ...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_zero
avg_half_sub_no_underflow_aux_aux : forall z:Z, (0 < z)%Z -> (ZnearestE (IZR z / 2) < z)%Z. Proof. intros z H1. case (Zle_lt_or_eq 1 z); [lia|intros H2|intros H2]. apply lt_IZR. apply Rplus_lt_reg_r with (- ((IZR z)/2)). apply Rle_lt_trans with (-(((IZR z) /2) - IZR (ZnearestE (IZR z / 2)))). right; ring. apply Rle_lt_...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_no_underflow_aux_aux
avg_half_sub_no_underflow_aux1 : forall f, format f -> 0 < f -> f <= round_flt (f/2) -> False. Proof with auto with typeclass_instances. intros f Ff Hf1 Hf2. apply FLT_format_generic in Ff... destruct Ff as [g H1 H2 H3]. case (Zle_lt_or_eq emin (Fexp g)); try exact H3; intros H4. contradict Hf2. apply Rlt_not_le. rewri...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_no_underflow_aux1
avg_half_sub_no_underflow_aux2 : forall u v, format u -> format v -> (0 <= u /\ 0 <= v) \/ (u <= 0 /\ v <= 0) -> u <= v -> (bpow emin) <= Rabs ((u+v)/2) -> avg_half_sub u v <> 0. Proof with auto with typeclass_instances. clear Fx Fy a av x y; intros x y Fx Fy same_sign xLey H; unfold avg_half_sub. apply round_plus_neq_...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_no_underflow_aux2
avg_half_sub_no_underflow_aux3 : forall u v, format u -> format v -> (0 <= u /\ 0 <= v) \/ (u <= 0 /\ v <= 0) -> (bpow emin) <= Rabs ((u+v)/2) -> avg_half_sub u v <> 0. Proof with auto with typeclass_instances. clear Fx Fy a av x y; intros x y Fx Fy. intros same_sign H. case (Rle_or_lt x y); intros H1. now apply avg_ha...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_no_underflow_aux3
avg_half_sub_no_underflow : (0 <= x /\ 0 <= y) \/ (x <= 0 /\ y <= 0) -> (bpow emin) <= Rabs a -> av <> 0. Proof with auto with typeclass_instances. intros; now apply avg_half_sub_no_underflow_aux3. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_no_underflow
avg_half_sub_correct_aux : forall u v, format u -> format v -> u <= v -> (0 <= u /\ 0 <= v) \/ (u <= 0 /\ v <= 0) -> 0 < Rabs ((u+v)/2) < bpow emin -> Rabs (avg_half_sub u v -((u+v)/2)) <= 3/2 * ulp_flt ((u+v)/2). Proof with auto with typeclass_instances. clear Fx Fy x y a av. intros u v Fu Fv uLev same_sign. pose (b:=...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_correct_aux
avg_half_sub_correct_aux2 : forall u v, format u -> format v -> u <= v -> (0 <= u /\ 0 <= v) \/ (u <= 0 /\ v <= 0) -> Rabs (avg_half_sub u v -((u+v)/2)) <= 3/2 * ulp_flt ((u+v)/2). Proof with auto with typeclass_instances. clear Fx Fy a av x y. intros u v Fu Fv uLev same_sign. pose (b:=(u+v)/2); fold b. assert (T: fora...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_correct_aux2
avg_half_sub_correct : (0 <= x /\ 0 <= y) \/ (x <= 0 /\ y <= 0) -> Rabs (av-a) <= 3/2 * ulp_flt a. Proof with auto with typeclass_instances. intros same_sign; case (Rle_or_lt x y); intros H. now apply avg_half_sub_correct_aux2. unfold av, a. rewrite <- (Ropp_involutive x), <- (Ropp_involutive y). rewrite avg_half_sub_s...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
avg_half_sub_correct
bpow e := (bpow radix2 e). Variable emin prec : Z. Context { prec_gt_0_ : Prec_gt_0 prec }.
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
bpow
format := (generic_format radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
format
round_flt :=(round radix2 (FLT_exp emin prec) ZnearestE).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
round_flt
ulp_flt :=(ulp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
ulp_flt
cexp := (cexp radix2 (FLT_exp emin prec)).
Notation
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
cexp
average (x y : R) := let samesign := match (Rle_bool 0 x), (Rle_bool 0 y) with true , true => true | false , false => true | _,_ => false end in if samesign then match (Rle_bool (Rabs x) (Rabs y)) with true => avg_half_sub emin prec x y | false => avg_half_sub emin prec y x end else avg_naive emin prec x y. Variables x...
Definition
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average
a :=(x+y)/2.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
a
av :=average x y.
Let
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
av
average_symmetry : forall u v, average u v = average v u. Proof. intros u v; unfold average. case (Rle_bool_spec 0 u); case (Rle_bool_spec 0 v); intros. rewrite 2!Rabs_right; try apply Rle_ge; try assumption. case (Rle_bool_spec u v); case (Rle_bool_spec v u); trivial. intros; replace u with v; trivial; auto with real....
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_symmetry
average_symmetry_Ropp : forall u v, format u -> format v -> average (-u) (-v) = - average u v. Proof with auto with typeclass_instances. (* first: nonnegative u *) assert (forall u v, 0 <= u -> format u -> format v -> average (-u) (-v) = - average u v). intros u v Hu Fu Fv; unfold average. rewrite 2!Rabs_Ropp. destruct...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_symmetry_Ropp
average_same_sign_1 : 0 <= a -> 0 <= av. Proof with auto with typeclass_instances. intros H; unfold av, average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_same_sign_1... apply avg_half_sub_same_sign_1... now rewrite Rplus_comm. apply a...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_same_sign_1
average_same_sign_2 : a <= 0-> av <= 0. Proof with auto with typeclass_instances. intros H; unfold av, average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_same_sign_2... apply avg_half_sub_same_sign_2... now rewrite Rplus_comm. apply av...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_same_sign_2
average_correct : Rabs (av -a) <= 3/2 * ulp_flt a. Proof with auto with typeclass_instances. unfold av,a,average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_correct... rewrite Rplus_comm. apply avg_half_sub_correct... apply avg_naive_co...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_correct
average_between : Rmin x y <= av <= Rmax x y. Proof with auto with typeclass_instances. unfold av,a,average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_between... rewrite Rmin_comm, Rmax_comm. apply avg_half_sub_between... apply avg_nai...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_between
average_zero : a = 0 -> av = 0. Proof with auto with typeclass_instances. unfold av,a,average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_zero... apply avg_half_sub_zero... now rewrite Rplus_comm. apply avg_naive_zero... apply avg_naive...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_zero
average_no_underflow : (bpow emin) <= Rabs a -> av <> 0. Proof with auto with typeclass_instances. unfold av,a,average. case (Rle_bool_spec 0 x); case (Rle_bool_spec 0 y); intros. case (Rle_bool_spec (Rabs x) (Rabs y)); intros. apply avg_half_sub_no_underflow... apply avg_half_sub_no_underflow... now rewrite Rplus_comm...
Lemma
examples
[ "From Coq Require Import ZArith Reals Psatz.", "From Flocq Require Import Core Plus_error." ]
examples/Average.v
average_no_underflow
rel_helper : forall xa xe b : R, xe <> 0 -> (Rabs ((xa - xe) / xe) <= b <-> Rabs (xa - xe) <= b * Rabs xe). Proof. intros xa xe b Zx. unfold Rdiv. rewrite Rabs_mult, Rabs_Rinv by exact Zx. split ; intros H. - apply Rmult_le_reg_r with (/ Rabs xe). apply Rinv_0_lt_compat. now apply Rabs_pos_lt. rewrite Rmult_assoc, Rinv...
Lemma
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
rel_helper
Rdiv_compat_r : forall a b c : R, a <> 0 -> c <> 0 -> (a*b) / (a*c) = b/c. Proof. intros a b c Ha Hc. field. apply conj. apply Hc. apply Ha. Qed.
Lemma
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
Rdiv_compat_r
pow2 := (bpow radix2).
Notation
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
pow2
rnd := (round radix2 (FLT_exp (-1074) 53) ZnearestE).
Notation
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
rnd
add x y := rnd (x + y).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
add
sub x y := rnd (x - y).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
sub
mul x y := rnd (x * y).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
mul
div x y := rnd (x / y).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
div
nearbyint x := round radix2 (FIX_exp 0) ZnearestE x.
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
nearbyint
Log2h := 3048493539143 * pow2 (-42).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
Log2h
Log2l := 544487923021427 * pow2 (-93).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
Log2l
InvLog2 := 3248660424278399 * pow2 (-51).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
InvLog2
p0 := 1 * pow2 (-2).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
p0
p1 := 4002712888408905 * pow2 (-59).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
p1
p2 := 1218985200072455 * pow2 (-66).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
p2
q0 := 1 * pow2 (-1).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
q0
q1 := 8006155947364787 * pow2 (-57).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
q1
q2 := 4573527866750985 * pow2 (-63).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
q2
cw_exp (x : R) := let k := nearbyint (mul x InvLog2) in let t := sub (sub x (mul k Log2h)) (mul k Log2l) in let t2 := mul t t in let p := add p0 (mul t2 (add p1 (mul t2 p2))) in let q := add q0 (mul t2 (add q1 (mul t2 q2))) in pow2 (Zfloor k + 1) * (add (div (mul t p) (sub q (mul t p))) (1/2)).
Definition
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
cw_exp
method_error : forall t : R, let t2 := t * t in let p := p0 + t2 * (p1 + t2 * p2) in let q := q0 + t2 * (q1 + t2 * q2) in let f := 2 * ((t * p) / (q - t * p) + 1/2) in Rabs t <= 355 / 1024 -> Rabs ((f - exp t) / exp t) <= 23 * pow2 (-62). Proof. intros t t2 p q f Ht. unfold f, q, p, t2, p0, p1, p2, q0, q1, q2 ; interva...
Lemma
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
method_error
argument_reduction : forall x : R, generic_format radix2 (FLT_exp (-1074) 53) x -> -746 <= x <= 710 -> let k := nearbyint (mul x InvLog2) in let tf := sub (sub x (mul k Log2h)) (mul k Log2l) in let te := x - k * ln 2 in Rabs tf <= 355 / 1024 /\ Rabs (tf - te) <= 65537 * pow2 (-71). Proof with auto with typeclass_instan...
Lemma
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
argument_reduction
exp_correct : forall x : R, generic_format radix2 (FLT_exp (-1074) 53) x -> -746 <= x <= 710 -> Rabs ((cw_exp x - exp x) / exp x) <= 1 * pow2 (-51). Proof. intros x Fx Bx. generalize (argument_reduction x Fx Bx). unfold cw_exp. set (k := nearbyint (mul x InvLog2)). set (t := sub (sub x (mul k Log2h)) (mul k Log2l)). se...
Theorem
examples
[ "From Coq Require Import Reals.", "From Flocq Require Import Core.", "From Gappa Require Import Gappa_tactic.", "From Interval Require Import Tactic." ]
examples/Cody_Waite.v
exp_correct
Rsgn_F2R : forall m e, Rlt_bool (F2R (Float beta m e)) 0 = Zlt_bool m 0. Proof. intros m e. case Zlt_bool_spec ; intros H. apply Rlt_bool_true. now apply F2R_lt_0. apply Rlt_bool_false. now apply F2R_ge_0. Qed.
Lemma
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
Rsgn_F2R
plus (x y : float beta) := let (m, e) := Fplus x y in let s := Zlt_bool m 0 in let '(m', e', l) := truncate beta fexp (Z.abs m, e, loc_Exact) in Float beta (cond_Zopp s (choice s m' l)) e'.
Definition
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
plus
plus_correct : forall x y : float beta, round beta fexp rnd (F2R x + F2R y) = F2R (plus x y). Proof. intros x y. unfold plus. rewrite <- F2R_plus. destruct (Fplus x y) as [m e]. rewrite (round_trunc_sign_any_correct beta fexp rnd choice rnd_choice _ (Z.abs m) e loc_Exact). 3: now right. destruct truncate as [[m' e'] l'...
Theorem
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
plus_correct
mult (x y : float beta) := let (m, e) := Fmult x y in let s := Zlt_bool m 0 in let '(m', e', l) := truncate beta fexp (Z.abs m, e, loc_Exact) in Float beta (cond_Zopp s (choice s m' l)) e'.
Definition
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
mult
mult_correct : forall x y : float beta, round beta fexp rnd (F2R x * F2R y) = F2R (mult x y). Proof. intros x y. unfold mult. rewrite <- F2R_mult. destruct (Fmult x y) as [m e]. rewrite (round_trunc_sign_any_correct beta fexp rnd choice rnd_choice _ (Z.abs m) e loc_Exact). 3: now right. destruct truncate as [[m' e'] l'...
Theorem
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
mult_correct
sqrt (x : float beta) := if Zlt_bool 0 (Fnum x) then let '(m', e', l) := truncate beta fexp (Fsqrt fexp x) in Float beta (choice false m' l) e' else Float beta 0 0.
Definition
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
sqrt
sqrt_correct : forall x : float beta, round beta fexp rnd (R_sqrt.sqrt (F2R x)) = F2R (sqrt x). Proof. intros x. unfold sqrt. case Zlt_bool_spec ; intros Hm. generalize (Fsqrt_correct fexp x (F2R_gt_0 _ _ Hm)). destruct Fsqrt as [[m' e'] l]. intros [Hs1 Hs2]. rewrite (round_trunc_sign_any_correct' beta fexp rnd choice ...
Theorem
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
sqrt_correct
Rsgn_div : forall x y : R, x <> 0%R -> y <> 0%R -> Rlt_bool (x / y) 0 = xorb (Rlt_bool x 0) (Rlt_bool y 0). Proof. intros x y Hx0 Hy0. unfold Rdiv. case (Rlt_bool_spec x) ; intros Hx ; case (Rlt_bool_spec y) ; intros Hy. apply Rlt_bool_false. rewrite <- Rmult_opp_opp. apply Rlt_le, Rmult_lt_0_compat. now apply Ropp_gt_...
Lemma
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
Rsgn_div
div (x y : float beta) := if Zeq_bool (Fnum x) 0 then Float beta 0 0 else let '(m, e, l) := truncate beta fexp (Fdiv fexp (Fabs x) (Fabs y)) in let s := xorb (Zlt_bool (Fnum x) 0) (Zlt_bool (Fnum y) 0) in Float beta (cond_Zopp s (choice s m l)) e.
Definition
examples
[ "From Coq Require Import ZArith Reals.", "From Flocq Require Import Core Bracket Round Operations Div Sqrt." ]
examples/Compute.v
div
End of preview. Expand in Data Studio

Coq-Flocq

Structured dataset from Flocq — Floating-point formalization.

3,207 declarations extracted from Coq source files.

Applications

  • Training language models on formal proofs
  • Fine-tuning theorem provers
  • Retrieval-augmented generation for proof assistants
  • Learning proof embeddings and representations

Source

Schema

Column Type Description
fact string Declaration body
type string Lemma, Definition, Theorem, etc.
library string Source module
imports list Required imports
filename string Source file path
symbolic_name string Identifier
Downloads last month
15

Collection including phanerozoic/Coq-Flocq