GaussianAnalysisRocq library documentation
Main resultsGlossary
On this page

Uniform means on finite types

GaussianAnalysis.probability.finite_meanlibrary/probability/finite_mean.v313 lines32 lemmas and theorems, 2 definitionssource
Imports 0 library modules and 6 external

External: HB.structures, mathcomp.classical.all_ssreflect_compat, mathcomp.algebra.algebraic_hierarchy.ssralg, mathcomp.algebra.numeric_hierarchy.ssrnum, mathcomp.algebra.arithmetic_tactic, mathcomp.algebra.ring_tactic

Imported by 5

For a finite type T and f : T -> R, unif_mean f = #|T|^-1 \sum_x f x is the mean of f under the uniform law of T, and unif_var f = unif_mean (f - unif_mean f)^2 its variance; R is a realFieldType. A tuple of m independent uniform coordinates is a uniform element of m.-tuple T, so these means express the expectations of functions of independent uniform random elements of finite sets as finite averages, without measure theory.

This file is part of target T7 of phase 12: a Rocq formalization of the finite means of the credited argument of the proposition 'Polynomial concentration' of 'A limiting satisfiability threshold for every fixed clause size' (family 235 of the OpenAI math collection, revision 1581d4cbd, source/sections/concentration.tex), where the expectations over independent uniform data are finite averages; the means of the statement of T7, in its definitions file, unfold to these. It follows the finite means of the Lean development of the collection, in lean/OAI/Probability/RandomSAT:

Lean: uniformMean (FiniteMean.lean, line 17)

Lean: uniformVariance (FiniteMean.lean, line 107)

Lean: uniformVariance_fin_succ (Variance.lean, line 322)

unif_mean f#|T|^-1 * \sum_(x : T) f x, the mean of f : T -> R under the uniform law of the finite type T
unif_var funif_mean (fun x => (f x - unif_mean f) ^+ 2)

Main results

ResultsStatement
Means and variances under the uniform law of a finite type, as finite averages over a realFieldType: linearity, monotonicity, invariance under bijections, the mean of the indicator of a predicate as the proportion of the elements that satisfy it, Fubini for pairs, the mean over m.+1.-tuple T as the mean over the head of the mean over the tail, the mean of a product over independent coordinates as the product of the means, the law of T1 + T2 as a mixture with weights #|T1| and #|T2| (the cardinals of T1 and T2), Var f <= E (f - c)^2, Jensen (E f)^2 <= E f^2 and the law of total variance for a pair and for the head of a tuple (nonempty types where needed).

Declarations34 exported

lemma, theoremdefinitioninstancelocal
sectionunif_mean
Variable R : realFieldType.
definition unif_mean main result source, line 62
Type
forall [R : realFieldType] [T : finType], (T -> R) -> R
Definition
Definition unif_mean (T : finType) (f : T -> R) : R :=
  (#|T|%:R)^-1 * \sum_(x : T) f x.
Main result, as the README states it

Means and variances under the uniform law of a finite type, as finite averages over a realFieldType: linearity, monotonicity, invariance under bijections, the mean of the indicator of a predicate as the proportion of the elements that satisfy it, Fubini for pairs, the mean over m.+1.-tuple T as the mean over the head of the mean over the tail, the mean of a product over independent coordinates as the product of the means, the law of T1 + T2 as a mixture with weights #|T1| and #|T2| (the cardinals of T1 and T2), Var f <= E (f - c)^2, Jensen (E f)^2 <= E f^2 and the law of total variance for a pair and for the head of a tuple (nonempty types where needed).

Used by 46 declarations in 4 files
definition unif_var main result source, line 65
Type
forall [R : realFieldType] [T : finType], (T -> R) -> R
Definition
Definition unif_var (T : finType) (f : T -> R) : R :=
  unif_mean (fun x => (f x - unif_mean f) ^+ 2).
Main result

Stated in the README together with unif_mean.

Used by 12 declarations in 3 files
forall [R : realFieldType] [T : finType] (f : T -> R), #|T|%:R * unif_mean f = \sum_x f x
Statement as written in the source
Lemma unif_mean_sumE (T : finType) (f : T -> R) :
  #|T|%:R * unif_mean f = \sum_(x : T) f x.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] [f g : T -> R],
f =1 g -> unif_mean f = unif_mean g
Statement as written in the source
Lemma eq_unif_mean (T : finType) (f g : T -> R) :
  f =1 g -> unif_mean f = unif_mean g.
Used by 23 declarations in 4 files
forall [R : realFieldType] [T : finType] [f g : T -> R], f =1 g -> unif_var f = unif_var g
Statement as written in the source
Lemma eq_unif_var (T : finType) (f g : T -> R) :
  f =1 g -> unif_var f = unif_var g.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] (c : R), (0 < #|T|)%N -> unif_mean (fun=> c) = c
Statement as written in the source
Lemma unif_mean_cst (T : finType) (c : R) : (0 < #|T|)%N ->
  unif_mean (fun _ : T => c) = c.
Used by 18 declarations in 3 files
forall [R : realFieldType] [T : finType] (f g : T -> R),
unif_mean (fun x : T => f x + g x) = unif_mean f + unif_mean g
Statement as written in the source
Lemma unif_meanD (T : finType) (f g : T -> R) :
  unif_mean (fun x => f x + g x) = unif_mean f + unif_mean g.
Used by 8 declarations in 3 files
forall [R : realFieldType] [T : finType] (f : T -> R),
unif_mean (fun x : T => - f x) = - unif_mean f
Statement as written in the source
Lemma unif_meanN (T : finType) (f : T -> R) :
  unif_mean (fun x => - f x) = - unif_mean f.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] (f g : T -> R),
unif_mean (fun x : T => f x - g x) = unif_mean f - unif_mean g
Statement as written in the source
Lemma unif_meanB (T : finType) (f g : T -> R) :
  unif_mean (fun x => f x - g x) = unif_mean f - unif_mean g.
Used by 8 declarations in 3 files
forall [R : realFieldType] [T : finType] (c : R) (f : T -> R),
unif_mean (fun x : T => c * f x) = c * unif_mean f
Statement as written in the source
Lemma unif_meanZ (T : finType) (c : R) (f : T -> R) :
  unif_mean (fun x => c * f x) = c * unif_mean f.
Used by 8 declarations in 4 files
forall [R : realFieldType] [T : finType] (c : R) (f : T -> R),
unif_mean (fun x : T => f x * c) = unif_mean f * c
Statement as written in the source
Lemma unif_meanZr (T : finType) (c : R) (f : T -> R) :
  unif_mean (fun x => f x * c) = unif_mean f * c.
Used by 3 declarations in 3 files
forall [R : realFieldType] [T I : finType] (P : pred I) (F : I -> T -> R),
unif_mean (fun x : T => \sum_(i | P i) F i x) = \sum_(i | P i) unif_mean (F i)
Statement as written in the source
Lemma unif_mean_sum (T I : finType) (P : pred I) (F : I -> T -> R) :
  unif_mean (fun x => \sum_(i | P i) F i x) = \sum_(i | P i) unif_mean (F i).
Used by 3 declarations in 2 files
forall [R : realFieldType] [T : finType] [f g : T -> R],
(forall x : T, f x <= g x) -> unif_mean f <= unif_mean g
Statement as written in the source
Lemma ler_unif_mean (T : finType) (f g : T -> R) :
  (forall x, f x <= g x) -> unif_mean f <= unif_mean g.
Used by 12 declarations in 4 files
forall [R : realFieldType] [T : finType] [f : T -> R],
(forall x : T, 0 <= f x) -> 0 <= unif_mean f
Statement as written in the source
Lemma unif_mean_ge0 (T : finType) (f : T -> R) :
  (forall x, 0 <= f x) -> 0 <= unif_mean f.
Used by 8 declarations in 3 files
forall (R : realFieldType) [T : finType] (P : pred T),
unif_mean (fun x : T => (P x)%:R) = #|[set x | P x]|%:R / #|T|%:R

The mean of an indicator is the proportion of the elements where it holds.

Main result

Stated in the README together with unif_mean.

Statement as written in the source
Lemma unif_mean_indicator (T : finType) (P : pred T) :
  unif_mean (fun x => (P x)%:R) = #|[set x | P x]|%:R / #|T|%:R.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] [f : T -> R] [c : R],
(0 < #|T|)%N -> (forall x : T, f x <= c) -> unif_mean f <= c
Statement as written in the source
Lemma unif_mean_le (T : finType) (f : T -> R) (c : R) : (0 < #|T|)%N ->
  (forall x, f x <= c) -> unif_mean f <= c.
Used by 2 declarations in 1 file
forall [R : realFieldType] [T : finType] [f : T -> R] [c : R],
(0 < #|T|)%N -> (forall x : T, c <= f x) -> c <= unif_mean f
Statement as written in the source
Lemma unif_mean_ge (T : finType) (f : T -> R) (c : R) : (0 < #|T|)%N ->
  (forall x, c <= f x) -> c <= unif_mean f.
forall [R : realFieldType] [T1 T2 : finType] [h : T1 -> T2] (f : T2 -> R),
bijective h -> unif_mean (fun x : T1 => f (h x)) = unif_mean f

The mean is invariant under a bijection.

Statement as written in the source
Lemma unif_mean_bij (T1 T2 : finType) (h : T1 -> T2) (f : T2 -> R) :
  bijective h -> unif_mean (fun x => f (h x)) = unif_mean f.
Used by 5 declarations in 3 files
forall [R : realFieldType] [T1 T2 : finType] (f : T1 * T2 -> R),
unif_mean f = unif_mean (fun x : T1 => unif_mean (fun y : T2 => f (x, y)))

Fubini for the uniform law of a product.

Statement as written in the source
Lemma unif_mean_pair (T1 T2 : finType) (f : T1 * T2 -> R) :
  unif_mean f = unif_mean (fun x => unif_mean (fun y => f (x, y))).
Used by 4 declarations in 2 files
forall [R : realFieldType] [T1 T2 : finType] (f : T1 -> T2 -> R),
unif_mean (fun x : T1 => unif_mean [eta f x]) = unif_mean (fun y : T2 => unif_mean (f^~ y))
Statement as written in the source
Lemma unif_mean_comm (T1 T2 : finType) (f : T1 -> T2 -> R) :
  unif_mean (fun x => unif_mean (fun y => f x y)) =
  unif_mean (fun y => unif_mean (fun x => f x y)).
Used by 2 declarations in 2 files
forall (T : Type) (m : nat), bijective (fun p : T * m.-tuple T => [tuple of p.1 :: p.2])
Statement as written in the source
Lemma bij_tuple_cons (T : Type) m :
  bijective (fun p : T * m.-tuple T => [tuple of p.1 :: p.2]).
Used by 2 declarations in 1 file
forall [R : realFieldType] [T : finType] (f : 0.-tuple T -> R), unif_mean f = f [tuple]

The coordinates of a uniform tuple: the head and the tail are independent and uniform.

Statement as written in the source
Lemma unif_mean_tuple0 (T : finType) (f : 0.-tuple T -> R) :
  unif_mean f = f [tuple].
Used by 8 declarations in 3 files
forall [R : realFieldType] [T : finType] [m : nat] (f : (m.+1).-tuple T -> R),
unif_mean f =
unif_mean (fun x : T => unif_mean (fun t : m.-tuple T => f [tuple of x :: t]))
Main result

Stated in the README together with unif_mean.

Statement as written in the source
Lemma unif_mean_tuple_cons (T : finType) m (f : m.+1.-tuple T -> R) :
  unif_mean f =
  unif_mean (fun x => unif_mean (fun t : m.-tuple T => f [tuple of x :: t])).
Used by 6 declarations in 3 files
forall [R : realFieldType] [T : finType] (m : nat) (g : T -> R),
unif_mean (fun t : m.-tuple T => \prod_(x <- t) g x) = unif_mean g ^+ m

Independent coordinates: the mean of a product over the coordinates of a uniform tuple is the product of the means.

Main result

Stated in the README together with unif_mean.

Statement as written in the source
Lemma unif_mean_tuple_prod (T : finType) m (g : T -> R) :
  unif_mean (fun t : m.-tuple T => \prod_(x <- t) g x) = unif_mean g ^+ m.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T1 T2 : finType] (f : T1 + T2 -> R),
unif_mean f =
#|T1|%:R / (#|T1| + #|T2|)%:R * unif_mean (fun x : T1 => f (inl x)) +
#|T2|%:R / (#|T1| + #|T2|)%:R * unif_mean (fun y : T2 => f (inr y))

The uniform law of a sum type is a mixture of the uniform laws of its summands.

Main result

Stated in the README together with unif_mean.

Statement as written in the source
Lemma unif_mean_sum_type (T1 T2 : finType) (f : T1 + T2 -> R) :
  unif_mean f =
  #|T1|%:R / (#|T1| + #|T2|)%:R * unif_mean (fun x => f (inl x)) +
  #|T2|%:R / (#|T1| + #|T2|)%:R * unif_mean (fun y => f (inr y)).
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] (f : T -> R) (c : R),
(0 < #|T|)%N ->
unif_mean (fun x : T => (f x - c) ^+ 2) =
unif_mean (fun x : T => f x ^+ 2) - 2 * c * unif_mean f + c ^+ 2

The variance: E f^2 - (E f)^2, at most E (f - c)^2, and Jensen.

Statement as written in the source
Lemma unif_mean_sqr_dev (T : finType) (f : T -> R) (c : R) : (0 < #|T|)%N ->
  unif_mean (fun x => (f x - c) ^+ 2) =
  unif_mean (fun x => f x ^+ 2) - 2 * c * unif_mean f + c ^+ 2.
Used by 2 declarations in 1 file
forall [R : realFieldType] [T : finType] (f : T -> R),
(0 < #|T|)%N -> unif_var f = unif_mean (fun x : T => f x ^+ 2) - unif_mean f ^+ 2
Statement as written in the source
Lemma unif_varE (T : finType) (f : T -> R) : (0 < #|T|)%N ->
  unif_var f = unif_mean (fun x => f x ^+ 2) - unif_mean f ^+ 2.
Used by 3 declarations in 1 file
forall [R : realFieldType] [T : finType] (f : T -> R) (c : R),
(0 < #|T|)%N -> unif_var f <= unif_mean (fun x : T => (f x - c) ^+ 2)
Statement as written in the source
Lemma unif_var_le (T : finType) (f : T -> R) (c : R) : (0 < #|T|)%N ->
  unif_var f <= unif_mean (fun x => (f x - c) ^+ 2).
Used by 2 declarations in 2 files
forall [R : realFieldType] [T : finType] (f : T -> R),
unif_mean f ^+ 2 <= unif_mean (fun x : T => f x ^+ 2)
Statement as written in the source
Lemma unif_mean_sqr_le (T : finType) (f : T -> R) :
  unif_mean f ^+ 2 <= unif_mean (fun x => f x ^+ 2).
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] (f : T -> R), 0 <= unif_var f
Statement as written in the source
Lemma unif_var_ge0 (T : finType) (f : T -> R) : 0 <= unif_var f.
forall [R : realFieldType] [T : finType] (c : R) (f : T -> R),
(0 < #|T|)%N -> unif_var (fun x : T => c + f x) = unif_var f
Statement as written in the source
Lemma unif_var_addl (T : finType) (c : R) (f : T -> R) : (0 < #|T|)%N ->
  unif_var (fun x => c + f x) = unif_var f.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T1 T2 : finType] (f : T1 -> T2 -> R),
(0 < #|T1|)%N ->
(0 < #|T2|)%N ->
unif_var (fun p : T1 * T2 => f p.1 p.2) =
unif_mean (fun x : T1 => unif_var (f x)) + unif_var (fun x : T1 => unif_mean (f x))

The law of total variance, for a pair and for the head of a tuple.

Statement as written in the source
Lemma unif_var_pair (T1 T2 : finType) (f : T1 -> T2 -> R) :
  (0 < #|T1|)%N -> (0 < #|T2|)%N ->
  unif_var (fun p : T1 * T2 => f p.1 p.2) =
  unif_mean (fun x => unif_var (f x)) + unif_var (fun x => unif_mean (f x)).
Used by 1 declaration in 1 file
forall [R : realFieldType] [T1 T2 : finType] [h : T1 -> T2] (f : T2 -> R),
bijective h -> unif_var (fun x : T1 => f (h x)) = unif_var f
Statement as written in the source
Lemma unif_var_bij (T1 T2 : finType) (h : T1 -> T2) (f : T2 -> R) :
  bijective h -> unif_var (fun x => f (h x)) = unif_var f.
Used by 1 declaration in 1 file
forall [R : realFieldType] [T : finType] [m : nat] (f : (m.+1).-tuple T -> R),
(0 < #|T|)%N ->
unif_var f =
unif_mean (fun x : T => unif_var (fun t : m.-tuple T => f [tuple of x :: t])) +
unif_var (fun x : T => unif_mean (fun t : m.-tuple T => f [tuple of x :: t]))
Main result

Stated in the README together with unif_mean.

Statement as written in the source
Lemma unif_var_tuple_cons (T : finType) m (f : m.+1.-tuple T -> R) :
  (0 < #|T|)%N ->
  unif_var f =
  unif_mean (fun x => unif_var (fun t : m.-tuple T => f [tuple of x :: t])) +
  unif_var (fun x => unif_mean (fun t : m.-tuple T => f [tuple of x :: t])).
Used by 1 declaration in 1 file
Generated from commit 9046883 (tag phase12) of the ellipsoid fitting repository. Signatures are printed by Rocq 9.1.1; links in the source statements come from the compiled .glob files. The source links open the files on GitHub at this commit, in the now-public repository.