Module infotheo.toy_examples.expected_value_variance_tuple
Require realType_ext.From mathcomp Require Import all_ssreflect ssralg ssrnum ring lra.
From mathcomp Require Import reals.
Require Import realType_ext fdist proba ssralg_ext.
Set Implicit Arguments.
Set SsrOldRewriteGoalsOrder.
Unset Strict Implicit.
Import Prenex Implicits.
Local Open Scope reals_ext_scope.
Local Open Scope tuple_ext_scope.
Local Open Scope ring_scope.
From mathcomp Require Import normedtype.
Import numFieldNormedType.Exports.
Section expected_value_variance_tuple.
Variable R : realType.
Definition
ps
:= [tuple (1/2:R); 1/3; 1/6].ps not a defined object.
Definition
p
: {ffun 'I_3 -> R} := [ffun i => tnth ps i].p not a defined object.
Lemma p_nonneg : [forall a : 'I_3, 0 <= p a].
Proof.
Lemma p_sum01 : [forall a, 0 <= p a] && (\sum_(a in 'I_3) p a == 1).
Proof.
Local Open Scope fdist_scope.
Local Open Scope proba_scope.
Definition
P
: {fdist 'I_3} := FDist.mk p_sum01.P not a defined object.
Definition
X
: {RV P -> R} := (fun i => i.+1%:R).X not a defined object.
Lemma expected : `E X = 5/3.
Proof.
Lemma variance : `V X = 5/9.
Proof.
End expected_value_variance_tuple.