proposition: Lemma PN_sum1 : (\sum_(i < Nmax.+1) [ffun x : 'I__ => `Pr[ X = x%:R] ] i = 1)%mcR.
proof: Proof. rewrite -(FDist.f1 P). rewrite [in RHS](partition_big (inordf (size \o f)) (fun i => i \in 'I_Nmax.+1)) //=. apply: eq_bigr => i _; rewrite ffunE. rewrite /pr_eq; unlock. apply: eq_bigl => i0. rewrite /= inE. apply/eqP/eqP=> [|<-]; last first. by rewrite inordfE /X /= FDist.f1 INRE. rewrite FDist.f1 /X /= -INRE => /INR_eq H. by apply/val_inj => /=; rewrite -H inordfE. Qed.
imports: mathcomp(all_ssreflect ssralg ssrnum matrix) Reals mathcomp(Rstruct) ssrR Reals_ext realType_ext logb ssr_ext ssralg_ext bigop_ext fdist proba entropy divergence log_sum source_code