proposition: Lemma entropy_max (P : {fdist A}) : `H P <= log #|A|%:R.
proof: Proof. have [n An1] : exists n, #|A| = n.+1. by exists #|A|.-1; rewrite prednK //; exact: (fdist_card_neq0 P). have /div_ge0 H := dom_by_uniform P An1. rewrite -subR_ge0; apply/(leR_trans H)/Req_le. transitivity (\sum_(a|a \in A) P a * log (P a) + \sum_(a|a \in A) P a * - log (fdist_uniform An1 a)). rewrite -big_split /=; apply eq_bigr => a _; rewrite -mulRDr. case/boolP : (P a == 0) => [/eqP ->|H0]; first by rewrite !mul0R. congr (_ * _); rewrite logDiv ?addR_opp //. by apply/RltP; rewrite -fdist_gt0. rewrite fdist_uniformE. rewrite -RinvE; last by rewrite An1 -INRE INR_eq0'. apply/invR_gt0; rewrite An1 -INRE. exact/ltR0n. under [in X in _ + X]eq_bigr do rewrite fdist_uniformE. rewrite -[in X in _ + X = _]big_distrl /= FDist.f1 mul1R. rewrite addRC /entropy /log. rewrite -RinvE; last by rewrite An1 -INRE INR_eq0'. by rewrite LogV ?oppRK ?subR_opp // An1 ?INRE// -INRE; exact/ltR0n. Qed.
imports: mathcomp(all_ssreflect all_algebra fingroup perm matrix) Reals mathcomp(Rstruct) ssrR Reals_ext realType_ext ssr_ext ssralg_ext bigop_ext logb ln_facts fdist jfdist_cond proba binary_entropy_function divergence