fact
stringlengths
9
8.91k
type
stringclasses
20 values
library
stringclasses
7 values
imports
listlengths
1
12
filename
stringclasses
87 values
symbolic_name
stringlengths
1
38
docstring
stringclasses
1 value
bound_evar_ineq_by_interval : bound_evar_ineq eps_max. Proof. rewrite /bound_evar_ineq/bound_intermediate. apply/RleP; rewrite -!coqRE.coqRE; interval. Qed. (**md ## lemma 1.4, page 5 (part 2) *) (**md ## eqn A.6--A.9, page 63 *)
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
bound_evar_ineq_by_interval
bound_empirical_variance_S : \sum_(i in S) C i * P i * tau i <= (1 - eps)/denom * `V (WP.-RV X). Proof. by apply/bound_evar_ineq_S/bound_evar_ineq_by_interval; first lra. Qed. (**md ## eqn A.10--A.11, page 63 *)
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
bound_empirical_variance_S
bound_empirical_variance_cplt_S : 2/denom * `V (WP.-RV X) <= \sum_(i in cplt_S) C i * P i * tau i. Proof. have ? := pr_S_gt0 eps_max01 low_eps. have /RleP pr1_cplt_S := Pr_le1 P cplt_S. have -> : \sum_(i in cplt_S) C i * P i * tau i = `V (WP.-RV X) * (\sum_(i in U) C i * P i) - (\sum_(i in S) C i * P i * tau i). rewrit...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
bound_empirical_variance_cplt_S
update_removed_weight (E : {set U}) : let C' := update_ffun X C0 PC0 in 0 < tau_max -> \sum_(i in E) (1 - C' i) * P i = (\sum_(i in E) (1 - C i) * P i) + 1 / tau_max * (\sum_(i in E) C i * P i * tau i). Proof. move => C' tau_max_gt0. have <- : \sum_(i in E) (C i - C' i) * P i= 1 / tau_max * (\sum_(i in E) C i * P i * t...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
update_removed_weight
R := Rdefinitions.R. Variables (U : finType) (P : {fdist U}) (X : {RV P -> R^o}) (C : {ffun U -> R}) (S : {set U}). Hypothesis C0 : forall u, 0 <= C u. Local Notation cplt_S := (~: S). Local Notation eps := (Pr P cplt_S). Hypotheses (PC0 : Weighted.total P C != 0) (C01 : is01 C).
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
R
WP := Weighted.d C0 PC0. (* Let var_hat := evar X PC0. *) (* Let var := `V_[X | S]. *)
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
WP
tau := sq_dev X PC0.
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
tau
tau_max := sq_dev_max X PC0 C0. Hypotheses (low_eps : eps <= eps_max) (var16 : 16 * `V_[X | S] < `V (WP.-RV X)).
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
tau_max
sq_dev_max_neq0 : 0 < `V (WP.-RV X) -> sq_dev_max X PC0 C0 != 0. Proof. rewrite /sq_dev_max => var_hat_gt0. have PCge0 := ltW (weighted_total_gt0 C0 PC0). move: var_hat_gt0. rewrite /Var. move=> /fsumr_gt0[i _]. rewrite Weighted.dE -mulr_regl mulrC => /[dup]/wpmulr_lgt0 sq_dev_gt0. have /wpmulr_rgt0 /[apply] := sq_RV_g...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
sq_dev_max_neq0
invariant_update : let C' := update_ffun X C0 PC0 in invariant P C S eps -> invariant P C' S eps. Proof. simpl=> inv. have var_ge0 : 0 <= `V_[X | S] by exact: cvariance_ge0. have tau_max_gt0 : 0 < sq_dev_max X PC0 C0. by rewrite lt_neqAle eq_sym sq_dev_max_neq0 ?sq_dev_max_ge0 //; move: var16; lra. suff H2 : \sum_(i in...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
invariant_update
is01_update : is01 (update_ffun X C0 PC0). Proof. move=> u; apply/andP; split; first by have := update_pos_ffun X C0 PC0. rewrite /update_ffun ffunE; case: ifPn; first lra. rewrite negb_or => /andP[sq_dev_neq0 Cu_neq0]. apply: mulr_ile1 => //. - rewrite subr_ge0 ler_pdivrMr// ?mul1r//; last first. by rewrite lt_neqAle ...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
is01_update
R := Rdefinitions.R. (* TODO: define a proper environment *) Variables (A : finType) (P : {fdist A}) (S : {set A}). Local Notation cplt_S := (~: S). Local Notation eps := (Pr P cplt_S).
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
R
ffun1 : {ffun A -> R} := [ffun=> 1].
Definition
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
ffun1
ffun1_subproof : forall a, 0 <= ffun1 a. Proof. by move=> u; rewrite ffunE. Qed. (*Definition Cpos_ffun1 := @mkNNFinfun A ffun1 ffun1_subproof.*)
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
ffun1_subproof
PC1_neq0 : Weighted.total P ffun1 != 0. Proof. rewrite/Weighted.total. under eq_bigr => i _ do rewrite /ffun1_subproof/=/ffun1 ffunE mul1r. rewrite FDist.f1. apply: oner_neq0. Qed.
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
PC1_neq0
C1_is01 : is01 ffun1. Proof. by move => i; rewrite ffunE; lra. Qed.
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
C1_is01
base_case : invariant P ffun1 S eps. Proof. rewrite /invariant/=. under eq_bigr do rewrite ffunE subrr mul0r. rewrite big1; last by []. under eq_bigr do rewrite ffunE subrr mul0r. rewrite big1; last by []. by rewrite mulr0. Qed.
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
base_case
R := Rdefinitions.R. Variables (U : finType) (P : {fdist U}) (X : {RV P -> R^o}). Local Obligation Tactic := idtac.
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
R
filter1D_arg_decreasing (C : {ffun U -> R}) (C0 : forall u, 0 <= C u) (v : R) : 0 <= v -> is01 C -> forall PC0 : Weighted.total P C != 0, let WP := wgt C0 PC0 in forall K : Rleb (`V (WP.-RV X)) (16 * v) <> true, (#|0.-support (update_ffun X C0 PC0)| < #|0.-support C|)%coq_nat. Proof. rewrite/Weighted.total=> v_ge0 C01 ...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
filter1D_arg_decreasing
filter1D v (v_ge0 : 0 <= v) := filter1D_rec v_ge0 (@ffun1_subproof U) (@C1_is01 U) (PC1_neq0 P).
Definition
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
filter1D
R := Rdefinitions.R. Variables (U : finType) (P : {fdist U}) (X : {RV P -> R^o}) (S : {set U}). Local Notation cplt_S := (~: S). Local Notation eps := (Pr P cplt_S). Hypothesis low_eps : eps <= eps_max. (* Let mu := `E_[X | S]. *) (* Let v := `V_[X | S]. *)
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
R
v_ge0 := cvariance_ge0 X S.
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
v_ge0
eps0 : 0 <= eps. Proof. exact/Pr_ge0. Qed. Functional Scheme filter1D_rec_ind := Induction for filter1D_rec Sort Prop.
Let
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
eps0
filter1D_correct : let v := `V_[X | S] in if @filter1D U P X v v_ge0 is Some mu_hat then `| `E_[X | S] - mu_hat | <= Num.sqrt (v * (2 * eps) / (2 - eps)) + Num.sqrt (16 * v * (2 * eps) / (1 - eps)) else false. Proof. (*have sixteenE: 16%coqR = 16 by rewrite /16%coqR -INR_IPR /= coqRE.*) rewrite /filter1D. have tr x y :...
Lemma
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
filter1D_correct
filter1D_converges : @filter1D U P X `V_[X | S] v_ge0 != None. Proof. by move: filter1D_correct => /=; case: (filter1D X v_ge0). Qed.
Corollary
robust
[ "From mathcomp Require Rstruct.", "From mathcomp Require Import all_ssreflect ssralg ssrnum matrix.", "From mathcomp Require Import lra ring.", "From mathcomp Require boolp.", "From mathcomp Require Import Rstruct reals mathcomp_extra.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_l...
robust/weightedmean.v
filter1D_converges
zero : 'I_4 := ord0.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
zero
one : 'I_4 := @Ordinal 4 1 isT.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
one
two : 'I_4 := @Ordinal 4 2 isT.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
two
three : 'I_4 := @Ordinal 4 3 isT.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
three
f := [ffun x : 'I_4 * 'I_4 => [eta (fun=>(0:R)) with (zero, zero) |-> (1/8), (zero, one) |-> (1/16), (zero, two) |-> (1/16), (zero, three) |-> (1/4), (one, zero) |-> (1/16), (one, one) |-> (1/8), (one, two) |-> (1/16), (one, three) |-> 0, (two, zero) |-> (1/32), (two, one) |-> (1/32), (two, two) |-> (1/16), (two, three...
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
f
f0 x : 0 <= f x. Proof. rewrite ffunE; move: x. case => -[ [? [[|[|[|[|[]//]]]]] | [? [[|[|[|[|[]//]]]]] | [? [[|[|[|[|[]//]]]]] | [? [[|[|[|[|[]//]]]]] | []//]]]]]; rewrite /f /=; try lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
f0
f1 : \sum_(x in {: 'I_4 * 'I_4}) f x = 1. Proof. rewrite (eq_bigr (fun x => f (x.1, x.2))); last by case. rewrite -(pair_bigA _ (fun x1 x2 => f (x1, x2))) /=. by rewrite !big_ord_recl !big_ord0 /f /= !ffunE /=; field. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
f1
d : {fdist 'I_4 * 'I_4} := locked (FDist.make f0 f1).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
d
dE x : d x = f x. Proof. by rewrite /d; unlock. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
dE
conditional_entropyE : centropy d = 11/8. Proof. rewrite /centropy /=. rewrite !big_ord_recl big_ord0 !fdist_sndE /=. rewrite !big_ord_recl !big_ord0. repeat (rewrite dE /f /= ffunE /=). rewrite !(add0r,addr0). rewrite /centropy1 /=. rewrite !big_ord_recl big_ord0. rewrite /jcPr /Pr. repeat (rewrite big_setX /= !big_se...
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum fingroup finalg matrix.", "From mathcomp Require Import ring lra.", "From mathcomp Require Import reals.", "Require Import ssr_ext ssralg_ext bigop_ext realType_ext realType_ln fdist.", "Require Import proba jfdist_cond entropy." ]
toy_examples/conditional_entropy.v
conditional_entropyE
pmf : {ffun 'I_3 -> R} := [ffun i => [fun x => 0 with inord 0 |-> 1/2, inord 1 |-> 1/3, inord 2 |-> 1/6] i].
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
pmf
I3_spec : 'I_3 -> bool -> bool -> bool -> Prop := | I2_0 : I3_spec (inord 0) true false false | I2_1 : I3_spec (inord 1) false true false | I2_2 : I3_spec (inord 2) false false true.
CoInductive
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
I3_spec
I3_neq := rewrite (_ : _ == _ = false); last by apply/negbTE/negP => /eqP/(congr1 (@nat_of_ord 3)); rewrite !inordK.
Ltac
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
I3_neq
I3P i : I3_spec i (i == inord 0) (i == inord 1) (i == inord 2). Proof. have : i \in map inord (iota 0 3). apply/mapP. exists (nat_of_ord i). by rewrite mem_iota leq0n add0n ltn_ord. by rewrite inord_val. rewrite inE => /orP[/eqP ->|]. rewrite eqxx. do 2 I3_neq. exact: I2_0. rewrite inE => /orP[/eqP ->|]. rewrite eqxx. ...
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
I3P
pmf_ge0 : [forall a : 'I_3, 0 <= pmf a]. Proof. apply/forallP. case/I3P. - rewrite /f ffunE /= eqxx; lra. - rewrite /f ffunE /= ifF; last by I3_neq. rewrite eqxx; lra. - rewrite /f ffunE /= ifF; last by I3_neq. rewrite ifF; last by I3_neq. rewrite eqxx; lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
pmf_ge0
I3_eq := rewrite (_ : _ == _ = true); last by apply/eqP/val_inj => /=; rewrite inordK.
Ltac
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
I3_eq
pmf01 : [forall a, 0 <= pmf a] && (\sum_(a in 'I_3) pmf a == 1). Proof. apply/andP; split; first exact: pmf_ge0. apply/eqP. do 3 rewrite big_ord_recl. rewrite big_ord0 addr0 /=. rewrite /f !ffunE /= ifT; last by I3_eq. rewrite ifF; last by I3_neq. rewrite ifT; last by I3_eq. rewrite ifF; last by I3_neq. rewrite ifF; la...
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
pmf01
d : {fdist 'I_3} := FDist.mk pmf01.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
d
X : {RV d -> R} := (fun i => i.+1%:R).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
X
expected : `E X = 5/3. Proof. rewrite /Ex. do 3 rewrite big_ord_recl. rewrite big_ord0 addr0. rewrite /X/= !scaler1. rewrite /f !ffunE /= ifT; last by I3_eq. rewrite (_ : (bump 0 0).+1%:R = 2) //. rewrite /= ifF; last by I3_neq. rewrite ifT; last by I3_eq. rewrite (_ : (bump 0 (bump 0 0)).+1%:R = 3)//. rewrite /f /= if...
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
expected
variance : `V X = 5/9. Proof. rewrite VarE. rewrite expected. rewrite /Ex /X. do 3 rewrite big_ord_recl. rewrite big_ord0 addr0 -!ssralg_ext.mulr_regl /=. rewrite !RV_fctE/=. rewrite {1}/pmf !ffunE /=. rewrite expr1n. rewrite ifT; last by I3_eq. rewrite (_ : (bump 0 0).+1%:R = 2) //. rewrite /f /=. rewrite ifF; last by...
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance.v
variance
ord1 {n} := lift ord0 (@ord0 n).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
ord1
ord2 {n} := lift ord0 (@ord1 n).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
ord2
ord0E n : 0%nat = @ord0 n. Proof. done. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
ord0E
ord1E n : 1%nat = @ord1 n. Proof. done. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
ord1E
ord2E n : 2%nat = @ord2 n. Proof. done. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
ord2E
pmf : {ffun 'I_3 -> R} := finfun [fun x => 0 with ord0 |-> 1/2, ord1 |-> 1/3, ord2 |-> 1/6].
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
pmf
pmf_ge0 : [forall a : 'I_3, 0 <= pmf a]. Proof. apply/forallP => a. rewrite /pmf ffunE /=. by do! case: ifP => _; lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
pmf_ge0
pmf01 : [forall a, 0 <= pmf a] && (\sum_(a in 'I_3) pmf a == 1). Proof. apply/andP; split; first exact: pmf_ge0. by apply/eqP; rewrite 3!big_ord_recl big_ord0 /= /pmf !ffunE /=; lra. Qed. Local Open Scope fdist_scope. Local Open Scope proba_scope.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
pmf01
P : {fdist 'I_3} := FDist.mk pmf01.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
P
X : {RV P -> R} := (fun i => i.+1%:R).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
X
expected : `E X = 5/3. Proof. rewrite /Ex. rewrite 3!big_ord_recl big_ord0 /=. rewrite /pmf /X !ffunE /= /bump /= -!mulr_regl. by field. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
expected
variance : `V X = 5/9. Proof. rewrite VarE expected /Ex /X !RV_fctE/=. rewrite 3!big_ord_recl big_ord0 /=. rewrite !ffunE /bump /= -!mulr_regl. by field. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum lra ring.", "From mathcomp Require Import reals.", "Require Import realType_ext ssralg_ext fdist proba.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_ordn.v
variance
ps := [tuple (1/2:R); 1/3; 1/6].
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
ps
p : {ffun 'I_3 -> R} := [ffun i => tnth ps i].
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
p
p_nonneg : [forall a : 'I_3, 0 <= p a]. Proof. apply/forallP => a. rewrite /p ffunE. apply/all_tnthP: a => /=. rewrite !andb_idr => * //; lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
p_nonneg
p_sum01 : [forall a, 0 <= p a] && (\sum_(a in 'I_3) p a == 1). Proof. apply/andP; split; first exact/p_nonneg. apply/eqP. by rewrite 3!big_ord_recl big_ord0 /= /p !ffunE !(tnth_nth 0) /=; field. Qed. Local Open Scope fdist_scope. Local Open Scope proba_scope.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
p_sum01
P : {fdist 'I_3} := FDist.mk p_sum01.
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
P
X : {RV P -> R} := (fun i => i.+1%:R).
Definition
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
X
expected : `E X = 5/3. Proof. rewrite /Ex. rewrite 3!big_ord_recl big_ord0 /=. rewrite /X !ffunE !(tnth_nth 0) -!mulr_regl /=. rewrite (_ : (bump 0 0).+1%:R = 2)//. rewrite (_ : (bump 0 _).+1%:R = 3)//. lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
expected
variance : `V X = 5/9. Proof. rewrite VarE expected /Ex /X !RV_fctE/=. rewrite 3!big_ord_recl big_ord0 /=. rewrite !ffunE !(tnth_nth 0) -!mulr_regl /=. rewrite (_ : (bump 0 0).+1%:R = 2)//. rewrite (_ : (bump 0 _).+1%:R = 3)//. lra. Qed.
Lemma
toy_examples
[ "From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.", "From mathcomp Require Import reals.", "Require Import realType_ext fdist proba ssralg_ext.", "From mathcomp Require Import normedtype." ]
toy_examples/expected_value_variance_tuple.v
variance