Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
statement stringlengths 1 832 | proof stringlengths 0 30.3k | type stringclasses 16
values | symbolic_name stringlengths 1 38 | library stringclasses 6
values | filename stringclasses 42
values | imports listlengths 4 14 | deps listlengths 0 64 | docstring stringclasses 217
values | source_url stringclasses 1
value | commit 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 RRle_abs.
intros; apply Rle_trans with (2:=Hy).
apply RRle_abs.
now apply Rle_ge.
rewrite Rabs_left; try assump... | Lemma | Rmin_Rmax_overflow | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Hx",
"Rmax_opp"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
radix2 | := Build_radix 2 (refl_equal true). | Definition | radix2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
bpow e | := (bpow radix2 e). | Notation | bpow | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
format | := (generic_format radix2 (FLT_exp emin prec)). | Notation | format | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"emin",
"generic_format",
"prec",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
round_flt | :=(round radix2 (FLT_exp emin prec) ZnearestE). | Notation | round_flt | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"ZnearestE",
"emin",
"prec",
"radix2",
"round"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
ulp_flt | :=(ulp radix2 (FLT_exp emin prec)). | Notation | ulp_flt | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"emin",
"prec",
"radix2",
"ulp"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
cexp | := (cexp radix2 (FLT_exp emin prec)). | Notation | cexp | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"emin",
"prec",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
pred_flt | := (pred radix2 (FLT_exp emin prec)). | Notation | pred_flt | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"emin",
"prec",
"pred",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
apply Z.le_trans with (1:=H3).
apply Zle_succ.
Qed. | Lemma | FLT_format_double | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FLT_format_generic",
"Fu",
"H1",
"H2",
"bpow_1",
"bpow_plus",
"format",
"generic_format_FLT",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
unfold Zminus; rewrite bpow_plus.
change (bpow (-(1))) with (/2).
unfold Rdiv; ring.
ea... | Lemma | FLT_format_half | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FLT_format_generic",
"Fu",
"H1",
"H2",
"IZR_Zpower",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_plus",
"emin",
"format",
"generic_format_FLT",
"lt_bpow",
"prec",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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; apply Rlt_not_le.
apply bpow_gt_0.
assert (cexp (z/2) = cexp z -1)%Z.
assert (prec+emin < ... | Lemma | FLT_round_half | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FLT_exp",
"bpow",
"bpow_gt_0",
"bpow_plus",
"cexp",
"emin",
"lt_bpow",
"mag",
"mag_unique",
"prec",
"radix2",
"round",
"round_flt",
"scaled_mantissa"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 u) as (e,He); simpl.
apply Rle_trans with (bpow (e-1)).
appl... | Lemma | FLT_ulp_le_id | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLX_exp",
"Hu",
"Prec_gt_0",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_le",
"cexp",
"cexp_FLT_FIX",
"cexp_FLT_FLX",
"emin",
"mag",
"prec",
"radix2",
"ulp",
"ulp_flt",
"ulp_neq_0"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 <- bpow_plus.
apply bpow_le.
case (Rle_or_lt (bpow (emin+pre... | Lemma | FLT_ulp_double | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FIX_exp",
"FLX_exp",
"Hu",
"Req_bool_spec",
"bpow",
"bpow_gt_0",
"bpow_le",
"bpow_plus",
"cexp",
"cexp_FLT_FIX",
"cexp_FLT_FLX",
"emin",
"mag_mult_bpow",
"prec",
"ulp_flt",
"ulp_ge_0",
"ulp_neq_0"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
apply round_N_eq_DN_pt with (f+ ulp_flt f)...
pattern f at 2; rewrite <- (round_DN_plus_eps_pos radix2 (FLT_exp emin prec) f) with (ep... | Lemma | round_plus_small_id_aux | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"H1",
"H2",
"IZR_Zpower",
"Prec_gt_0",
"Req_bool_spec",
"Rinv_involutive",
"Rinv_mult_distr",
"Zceil",
"Zfloor",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_le",
"bpow_lt",
"bpow_mag_gt",
"bpow_opp",
"bpow_plus",
"cexp",
"emin",
"eps",
"format",
"generic_format_FLT... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
contradict H1.
rewrite <- V, Rabs_R0.
apply Rlt_not_le, bpow_gt_0.
rewrite <- (Ropp_involutive f), <- (Ropp_involutive h).
repl... | Lemma | round_plus_small_id | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"H1",
"H2",
"bpow",
"bpow_gt_0",
"emin",
"format",
"generic_format_opp",
"prec",
"round_NE_opp",
"round_flt",
"round_plus_small_id_aux",
"ulp_flt",
"ulp_opp"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
avg_naive (x y : R) | :=round_flt(round_flt(x+y)/2). | Definition | avg_naive | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"round_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Fx: format x. | Hypothesis | Fx | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"format"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
Fy: format y. | Hypothesis | Fy | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"format"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
a | :=(x+y)/2. | Let | a | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
av | :=avg_naive x y. | Let | av | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_naive"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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...
apply abs_round_ge_generic...
apply gen... | Lemma | avg_naive_correct | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_format_half",
"FLT_format_plus_small",
"FLT_round_half",
"Prec_gt_0",
"abs_round_ge_generic",
"av",
"avg_naive",
"bpow",
"emin",
"generic_format_FLT_bpow",
"generic_format_round",
"prec",
"round_flt",
"round_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_symmetry | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_naive"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_symmetry_Ropp | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_naive",
"round_NE_opp",
"round_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_same_sign_1 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_naive_correct",
"generic_format_0",
"round_ge_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_same_sign_2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_naive_correct",
"generic_format_0",
"round_le_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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).
apply Rplus_le_compat.
apply Rmin_l.
apply Rmin_... | Lemma | avg_naive_between | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_naive_correct",
"round_ge_generic",
"round_le_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_zero | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"H1",
"av",
"avg_naive_correct",
"round_0"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 generic_format_FLT_bpow...
lia.
Qed. | Lemma | avg_naive_no_underflow | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"H1",
"H2",
"abs_round_ge_generic",
"av",
"avg_naive_correct",
"bpow",
"bpow_gt_0",
"emin",
"generic_format_FLT_bpow"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_naive_correct_weak1 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_naive_correct",
"error_le_half_ulp",
"ulp_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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. | Lemma | avg_naive_correct_weak2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_naive_correct_weak1",
"ulp",
"ulp_flt",
"ulp_ge_0"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
avg_sum_half (x y : R) | :=round_flt(round_flt(x/2) + round_flt(y/2)). | Definition | avg_sum_half | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"round_flt"
] | Hypothesis diff_sign: (0 <= x /\ y <= 0) \/ (x <= 0 /\ 0 <= y).
is useless for properties: only useful for preventing overflow | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f |
av2 | :=avg_sum_half x y. | Let | av2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_sum_half"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_half; try assumption.
2: apply Rle_trans with (2:=Hx).
2: apply bpow_le; lia.
ca... | Lemma | avg_sum_half_correct | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_exp",
"FLT_format_half",
"Hx",
"Prec_gt_0",
"abs_round_le_generic",
"av2",
"avg_sum_half",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_le",
"bpow_plus",
"cexp",
"emin",
"format",
"generic_format_FLT_bpow",
"lt_bpow",
"mag",
"prec",
"radix2",
"round_flt",
"round_generic",
... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
avg_half_sub (x y : R) | :=round_flt(x+round_flt(round_flt(y-x)/2)). | Definition | avg_half_sub | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"round_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
av | :=avg_half_sub x y. | Let | av | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_half_sub"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 (round_flt (v - u) / 2)) with
(-(u+round_flt (round_flt (v - u) / 2))) by ring.
apply r... | Lemma | avg_half_sub_symmetry_Ropp | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"avg_half_sub",
"round_NE_opp",
"round_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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)).
right; ring.
apply Rle_trans with (round_f... | Lemma | avg_half_sub_same_sign_1 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_format_double",
"av",
"generic_format_0",
"generic_format_opp",
"round_flt",
"round_ge_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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)).
2: right; ring.
apply Rle_trans with (roun... | Lemma | avg_half_sub_same_sign_2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_format_double",
"av",
"generic_format_0",
"generic_format_opp",
"round_flt",
"round_le_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_0.
unfold Rdiv; apply Rmult_le_pos.
apply round_ge_generic...
apply generic_format_0.
apply Rplus_le_... | Lemma | avg_half_sub_between_aux | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FLT_exp",
"FLT_format_plus_small",
"FLT_ulp_le_id",
"Fx",
"Fy",
"H1",
"H2",
"Prec_gt_0",
"Rcompare_Eq",
"Zfloor",
"Zfloor_imp",
"Znearest",
"ZnearestE",
"av",
"avg_half_sub",
"bpow",
"bpow_gt_0",
"bpow_le",
"bpow_plus",
"cexp",
"emin",
"format",
"generic_format_... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
unfold av; rewrite <- (Ropp_involutive x); rewrite <-... | Lemma | avg_half_sub_between | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_half_sub_between_aux",
"avg_half_sub_symmetry_Ropp",
"generic_format_opp"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 with (x:=(-(2*x)))...
replace (-(2*x)... | Lemma | avg_half_sub_zero | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"FLT_format_double",
"av",
"avg_half_sub",
"generic_format_opp",
"round_0",
"round_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_trans with (1:= RRle_abs _).
rewrite Rabs_Ropp.
apply Rle_lt_trans with (1:=Znearest_half (f... | Lemma | avg_half_sub_no_underflow_aux_aux | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"H1",
"H2",
"IZR",
"Rcompare_Eq",
"Zfloor",
"Zfloor_imp",
"Znearest",
"ZnearestE",
"Znearest_half"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
rewrite round_generic...
apply Rplus_lt_reg_l with (-(f/2)).
apply Rle_lt_trans with 0;[right; ring|... | Lemma | avg_half_sub_no_underflow_aux1 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FLT_format_generic",
"H1",
"H2",
"IZR",
"IZR_Zpower",
"Prec_gt_0",
"Rmult_lt_compat",
"avg_half_sub_no_underflow_aux_aux",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_lt",
"bpow_plus",
"cexp",
"cexp_FLT_FIX",
"emin",
"format",
"generic_format_FLT",
"prec",
"radix2",
"ro... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_0...
apply generic_format_round...
intros J.
assert (H1:x <= 0).
apply Rplus_le_reg_r with (round_flt (round_flt (y - x) / 2)).
rewrite J, Rplus_0_l.
apply round_ge_generic...
app... | Lemma | avg_half_sub_no_underflow_aux2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Fx",
"Fy",
"H1",
"H2",
"av",
"avg_half_sub",
"avg_half_sub_no_underflow_aux1",
"bpow",
"bpow_gt_0",
"emin",
"format",
"generic_format_0",
"generic_format_FLT_bpow",
"generic_format_opp",
"generic_format_round",
"round_flt",
"round_ge_generic",
"round_generic",
"round_le",
"rou... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_half_sub_no_underflow_aux2.
rewrite <- (Ropp_involutive x); rewrite <- (Ropp_involutive y).
rewrite avg_half_sub_symmetry_Ropp.
apply Ropp_neq_0_compat.
apply avg_half_sub... | Lemma | avg_half_sub_no_underflow_aux3 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Fx",
"Fy",
"H1",
"av",
"avg_half_sub",
"avg_half_sub_no_underflow_aux2",
"avg_half_sub_symmetry_Ropp",
"bpow",
"emin",
"format",
"generic_format_opp"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | avg_half_sub_no_underflow | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_half_sub_no_underflow_aux3",
"bpow",
"emin"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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:=(u+v)/2); fold b.
(* mostly forward proof *)
intros (H1,H2).
apply generic_format_FIX_FLT,FIX_format_generic in Fu.
apply generic_format_FIX_FLT,FIX_format_generic in Fv.
destruct Fu as [[nu eu] J1 J2].
destruct Fv... | Lemma | avg_half_sub_correct_aux | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"FIX_exp",
"FIX_format_generic",
"FLT_exp",
"Fnum_ge_0",
"Fnum_le_0",
"Fu",
"Fv",
"Fx",
"Fy",
"H1",
"H2",
"IZR",
"Prec_gt_0",
"Rcompare_Eq",
"Zfloor",
"Zfloor_imp",
"Znearest",
"ZnearestE",
"av",
"avg_half_sub",
"bpow",
"bpow_ge_0",
"bpow_gt_0",
"bpow_le",
"b... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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: forall z, Rabs (2*z) = 2* Rabs z).
intros z; rewrite Rabs_mult.
rewrite Rabs_pos_eq; try reflexivity.
apply Rlt_le, Rlt_0_2.
destruct uLev as [uLtv|uEqv].
(* when u < v *)
assert (B: u ... | Lemma | avg_half_sub_correct_aux2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"F2R",
"F2R_0",
"FIX_exp",
"FIX_format_generic",
"FLT_exp",
"FLT_format_half",
"FLT_format_plus_small",
"FLT_ulp_double",
"FLT_ulp_le_id",
"Fu",
"Fv",
"Fx",
"Fy",
"H1",
"Prec_gt_0",
"abs_round_ge_generic",
"av",
"avg_half_sub",
"avg_half_sub_correct_aux",
"bpow",
"bpow_ge_0",... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_symmetry_Ropp.
rewrite <- Rabs_Ropp.
replace (- (- avg_half_sub (- x) (- y) - (- - x + - - y) / 2)) ... | Lemma | avg_half_sub_correct | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"av",
"avg_half_sub",
"avg_half_sub_correct_aux2",
"avg_half_sub_symmetry_Ropp",
"generic_format_opp",
"ulp_flt",
"ulp_opp"
] | tight example x=1/2 and y=2^p-1: error is 5/4 ulp | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f |
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... | Definition | average | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool",
"avg_half_sub",
"avg_naive",
"emin",
"prec"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
av | :=average x y. | Let | av | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"average"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
intros H1 H2; contradict H1; auto with real.
apply avg_na... | Lemma | average_symmetry | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"H1",
"H2",
"Rle_bool_spec",
"average",
"avg_naive_symmetry"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 Hu as [Hu|Hu].
(* 0 < u *)
rewrite Rle_bool_false.
2: apply Ropp_lt_cancel.
2: now rewri... | Lemma | average_symmetry_Ropp | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Fu",
"Fv",
"Hu",
"Rle_bool_false",
"Rle_bool_spec",
"Rle_bool_true",
"average",
"avg_half_sub",
"avg_half_sub_symmetry_Ropp",
"avg_naive",
"avg_naive_symmetry_Ropp",
"format",
"generic_format_opp",
"generic_format_round",
"round_0",
"round_NE_opp",
"round_flt",
"round_generic"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 avg_naive_same_sign_1...
apply avg_naive_s... | Lemma | average_same_sign_1 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_same_sign_1",
"avg_naive_same_sign_1"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 avg_naive_same_sign_2...
apply avg_naive_s... | Lemma | average_same_sign_2 | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_same_sign_2",
"avg_naive_same_sign_2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_correct_weak2...
apply avg_naive_correct_weak2...
cas... | Lemma | average_correct | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_correct",
"avg_naive_correct_weak2",
"ulp_flt"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_naive_between...
apply avg_naive_between...
case ... | Lemma | average_between | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_between",
"avg_naive_between"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_zero...
case (Rle_bool_spec (Ra... | Lemma | average_zero | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_zero",
"avg_naive_zero"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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.
apply avg_naive_no_underflow...
apply avg_naive_no_unde... | Lemma | average_no_underflow | examples | examples/Average.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Plus_error"
] | [
"Rle_bool_spec",
"av",
"average",
"avg_half_sub_no_underflow",
"avg_naive_no_underflow",
"bpow",
"emin"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_r, Rmult_1_r.
exact H.
now apply Rabs_no_R0.
- apply Rmult_le_reg_r with (Rabs xe).
now apply R... | Lemma | rel_helper | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"Rabs_Rinv"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | Rdiv_compat_r | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
pow2 | := (bpow radix2). | Notation | pow2 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"bpow",
"radix2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
rnd | := (round radix2 (FLT_exp (-1074) 53) ZnearestE). | Notation | rnd | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"FLT_exp",
"ZnearestE",
"radix2",
"round"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
add x y | := rnd (x + y). | Definition | add | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"rnd"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
sub x y | := rnd (x - y). | Definition | sub | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"rnd"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
mul x y | := rnd (x * y). | Definition | mul | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"rnd"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
div x y | := rnd (x / y). | Definition | div | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"rnd"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
nearbyint x | := round radix2 (FIX_exp 0) ZnearestE x. | Definition | nearbyint | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"FIX_exp",
"ZnearestE",
"radix2",
"round"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Log2h | := 3048493539143 * pow2 (-42). | Definition | Log2h | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Log2l | := 544487923021427 * pow2 (-93). | Definition | Log2l | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
InvLog2 | := 3248660424278399 * pow2 (-51). | Definition | InvLog2 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
p0 | := 1 * pow2 (-2). | Definition | p0 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
p1 | := 4002712888408905 * pow2 (-59). | Definition | p1 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
p2 | := 1218985200072455 * pow2 (-66). | Definition | p2 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
q0 | := 1 * pow2 (-1). | Definition | q0 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
q1 | := 8006155947364787 * pow2 (-57). | Definition | q1 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
q2 | := 4573527866750985 * pow2 (-63). | Definition | q2 | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"pow2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | cw_exp | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"InvLog2",
"Log2h",
"Log2l",
"Zfloor",
"add",
"div",
"mul",
"nearbyint",
"p0",
"p1",
"p2",
"pow2",
"q0",
"q1",
"q2",
"sub",
"t2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 ;
interval with (i_bisect t, i_taylor t, i_degree 9, i_prec 70).
Qed. | Lemma | method_error | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"p0",
"p1",
"p2",
"pow2",
"q0",
"q1",
"q2",
"t2"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_instances.
intros x Fx Bx k tf te.
assert (Rabs x <= 5/16 \/ 5/16 <= Rabs x <= 746) as [Bx'|Bx'] by gappa.
- assert (k = 0).
clear -Bx'.
refine (let H := _ in Rle_antisym _ _ (proj2 H) (proj1 H)).
unfold k, mul, nearbyint, InvLog2, Log2h ; gappa.
unfold tf, te, mul, sub.
r... | Lemma | argument_reduction | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"FLT_exp",
"Fx",
"InvLog2",
"Log2h",
"Log2l",
"generic_format",
"mul",
"nearbyint",
"pow2",
"radix2",
"round_0",
"round_generic",
"sub"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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)).
set (t2 := mul t t).
intros [Bt Et].
clearbody t.
generalize (method_error t Bt).
intros Ef.
rewrite bpow_plus, Rmult_assoc.
assert (exp x = pow2 (Zflo... | Theorem | exp_correct | examples | examples/Cody_Waite.v | [
"Coq",
"Reals",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic",
"Interval",
"Tactic"
] | [
"FLT_exp",
"Fx",
"IZR",
"InvLog2",
"Log2h",
"Log2l",
"Rdiv_compat_r",
"Zfloor",
"Zfloor_IZR",
"add",
"argument_reduction",
"bpow_exp",
"bpow_gt_0",
"bpow_plus",
"cw_exp",
"div",
"generic_format",
"method_error",
"mul",
"nearbyint",
"p0",
"p1",
"p2",
"pow2",
"q0",
"q... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Hprec : (0 < prec)%Z. | Hypothesis | Hprec | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"prec"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
fexp_prec :
forall e, (e - prec <= fexp e)%Z. | Hypothesis | fexp_prec | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"fexp",
"prec"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
rnd_choice :
forall x m l,
inbetween_int m (Rabs x) l ->
rnd x = cond_Zopp (Rlt_bool x 0) (choice (Rlt_bool x 0) m l). | Hypothesis | rnd_choice | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Rlt_bool",
"cond_Zopp",
"inbetween_int",
"rnd"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
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 | Rsgn_F2R | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"F2R",
"F2R_ge_0",
"F2R_lt_0",
"Rlt_bool",
"Rlt_bool_false",
"Rlt_bool_true",
"Zlt_bool_spec"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | plus | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Fplus",
"cond_Zopp",
"fexp",
"float",
"loc_Exact",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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'].
apply (f_equal (fun s => F2R (Float beta (cond_Zopp s (choice s _ _)) _))).
apply Rsgn_F2R.... | Theorem | plus_correct | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"F2R",
"F2R_Zabs",
"F2R_plus",
"Fplus",
"Rsgn_F2R",
"cond_Zopp",
"fexp",
"float",
"loc_Exact",
"plus",
"rnd",
"rnd_choice",
"round",
"round_trunc_sign_any_correct",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | mult | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Fmult",
"cond_Zopp",
"fexp",
"float",
"loc_Exact",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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'].
apply (f_equal (fun s => F2R (Float beta (cond_Zopp s (choice s _ _)) _))).
apply Rsgn_F2R.... | Theorem | mult_correct | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"F2R",
"F2R_Zabs",
"F2R_mult",
"Fmult",
"Rsgn_F2R",
"cond_Zopp",
"fexp",
"float",
"loc_Exact",
"mult",
"rnd",
"rnd_choice",
"round",
"round_trunc_sign_any_correct",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | sqrt | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Fsqrt",
"fexp",
"float",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 rnd_choice _ m' e' l).
destruct truncate as [[m'' e''] l'].
now rewrite Rlt_bool_false by apply ... | Theorem | sqrt_correct | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"F2R",
"F2R_0",
"F2R_gt_0",
"F2R_le_0",
"Fsqrt",
"Fsqrt_correct",
"Rlt_bool_false",
"Zlt_bool_spec",
"fexp",
"float",
"rnd",
"rnd_choice",
"round",
"round_0",
"round_trunc_sign_any_correct'",
"sqrt",
"sqrt_ge_0",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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_lt_0_contravar.
apply Ropp_gt_lt_0_contravar.
now apply Rinv_lt_0_compat.
apply Rlt_bool_true.
apply Ropp_... | Lemma | Rsgn_div | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Hx",
"Rlt_bool",
"Rlt_bool_false",
"Rlt_bool_spec",
"Rlt_bool_true"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
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 | div | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"Fabs",
"Fdiv",
"cond_Zopp",
"fexp",
"float",
"truncate"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
div_correct :
forall x y : float beta,
F2R y <> 0%R ->
round beta fexp rnd (F2R x / F2R y) = F2R (div x y). | Proof.
intros x y Hy.
unfold div.
case Zeq_bool_spec ; intros Hm.
destruct x as [mx ex].
simpl in Hm.
rewrite Hm, 2!F2R_0.
unfold Rdiv.
rewrite Rmult_0_l.
now apply round_0.
assert (0 < F2R (Fabs x))%R as Hx.
destruct x as [mx ex].
now apply F2R_gt_0, Z.abs_pos.
assert (0 < F2R (Fabs y))%R as Hy'.
des... | Theorem | div_correct | examples | examples/Compute.v | [
"Coq",
"ZArith",
"Reals",
"Flocq",
"Core",
"Bracket",
"Round",
"Operations",
"Div",
"Sqrt"
] | [
"F2R",
"F2R_0",
"F2R_abs",
"F2R_gt_0",
"Fabs",
"Fdiv",
"Fdiv_correct",
"Hx",
"Rabs_Rinv",
"Rsgn_F2R",
"Rsgn_div",
"Zeq_bool_spec",
"cexp_abs",
"cond_Zopp",
"div",
"eq_0_F2R",
"fexp",
"float",
"rnd",
"rnd_choice",
"round",
"round_0",
"round_trunc_sign_any_correct'",
"tru... | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Rdiv_le_l :
forall a b c,
0 < a -> b <= c / a -> a * b <= c. | Proof.
intros a b c Ha Hb.
apply Rmult_le_reg_r with (/a).
now apply Rinv_0_lt_compat.
replace (a * b * /a) with b.
exact Hb.
field.
now apply Rgt_not_eq.
Qed. | Lemma | Rdiv_le_l | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
FIX_format_IZR :
forall beta x, FIX_format beta 0 (IZR x). | Proof.
intros beta x.
exists (Float beta x 0).
apply sym_eq, Rmult_1_r.
apply eq_refl.
Qed. | Lemma | FIX_format_IZR | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [
"FIX_format",
"IZR"
] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Rmult_le_lt_reg_l :
forall a b c d, 0 < a ->
a * b <= a * c < a * d ->
b <= c < d. | Proof.
intros a b c d Ha H.
split.
now apply Rmult_le_reg_l with (1 := Ha).
now apply Rmult_lt_reg_l with (1 := Ha).
Qed. | Lemma | Rmult_le_lt_reg_l | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
Rplus_le_lt_reg_r :
forall a b c d,
b + a <= c + a < d + a ->
b <= c < d. | Proof.
intros a b c d H.
split.
now apply Rplus_le_reg_r with a.
now apply Rplus_lt_reg_r with a.
Qed. | Lemma | Rplus_le_lt_reg_r | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | |
IZR : Z >-> R. | Coercion | IZR | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f | ||
IZR_le_le :
forall a b c,
(a <= b <= c)%Z ->
a <= b <= c. | Proof.
intros a b c.
now split ; apply IZR_le.
Qed. | Lemma | IZR_le_le | examples | examples/Division_u16.v | [
"Coq",
"ZArith",
"Reals",
"Psatz",
"Flocq",
"Core",
"Gappa",
"Gappa_tactic"
] | [] | https://gitlab.inria.fr/flocq/flocq | 7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f |
Structured dataset from Flocq — Floating-point formalization.
7aab8f55bceec0cfafc3b3bc0e77e0dbb5a70c5f| Column | Type | Description |
|---|---|---|
| statement | string | Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof |
| proof | string | Verbatim proof/body, empty if the declaration has none |
| type | string | Declaration keyword |
| symbolic_name | string | Declaration identifier |
| library | string | Sub-library |
| filename | string | Repository-relative source path |
| imports | list[string] | File-level Require/Import modules |
| deps | list[string] | Intra-corpus identifiers referenced |
| docstring | string | Preceding documentation comment, empty if absent |
| source_url | string | Upstream repository |
| commit | string | Upstream commit extracted |
| Type | Count |
|---|---|
| Theorem | 1,618 |
| Lemma | 623 |
| Definition | 397 |
| Hypothesis | 339 |
| Let | 107 |
| Notation | 68 |
| Instance | 26 |
| Inductive | 21 |
| Hypotheses | 19 |
| Fixpoint | 12 |
| Coercion | 7 |
| Class | 7 |
| Ltac | 5 |
| Record | 5 |
| Axiom | 2 |
| Scheme | 1 |
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.
avg_naive_symmetry | examples/Average.vEach declaration is split into a statement (signature/claim) and a proof (body) that are disjoint
and together form the complete declaration, for proof modeling, autoformalization, retrieval, and
dependency analysis via deps.
@misc{coq_flocq_dataset,
title = {Coq-Flocq},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://gitlab.inria.fr/flocq/flocq, commit 7aab8f55bcee},
url = {https://huggingface.co/datasets/phanerozoic/Coq-Flocq}
}