Stat
Statistical foundations: convergence modes, limit theorems, concentration inequalities, and minimax lower-bound tools.
GaussianCovariance 7 core · 13 supporting This module defines the Gaussian covariance discrepancy on finite positive-definite matrices and derives its compact-model attainment, strict separation, perturbation stability, and finite-model-selection interfaces. ★ finiteCovarianceModel_populationGap
Gaussian covariance discrepancy and finite model selection
This module defines the Gaussian covariance discrepancy on finite positive-definite matrices and derives its compact-model attainment, strict separation, perturbation stability, and finite-model-selection interfaces. The model assumptions are stated separately from the matrix inequality, so the results can be reused for any finite family of covariance models.
For a finite coordinate type, the positive covariance matrices are real square matrices equipped with a proof of positive definiteness.
For a candidate covariance matrix and target second-moment matrix, the Gaussian covariance discrepancy is log determinant plus inverse-weighted trace.
Definition (Lean source)
For positive-definite candidate and target covariances, the normalized Gaussian covariance discrepancy subtracts the criterion's value at the target.
Definition (Lean source)
For a covariance model and target matrix, discrepancy attainment means that one model member has no larger Gaussian discrepancy than every other member.
Definition (Lean source)
For a covariance model and target matrix, a compact discrepancy sublevel is a nonempty compact cut of the model below some criterion value.
Definition (Lean source)
For a covariance model and target matrix, the population loss is the infimum Gaussian discrepancy over positive-definite model covariances.
Definition (Lean source)
Given a finite family of covariance models whose members are compact and nonempty, and a positive-definite true covariance contained in at least one model, the population losses have the positive gap required by finite penalized model selection.
Formal statement
Proof (Lean source)
13 supporting declarations (lemmas, instances)
-
continuous_gaussianCovarianceDiscrepancytheorem — The Gaussian covariance discrepancy varies continuously with its positive-definite candidate and target matrix.hypothesesconclusionContinuous (fun p : PositiveCovariance V × Matrix V V ℝ => gaussianCovarianceDiscrepancy (p.1 : Matrix V V ℝ) p.2)Proof (Lean source)
theorem continuous_gaussianCovarianceDiscrepancy [Fintype V] [DecidableEq V] : Continuous (fun p : PositiveCovariance V × Matrix V V ℝ => gaussianCovarianceDiscrepancy (p.1 : Matrix V V ℝ) p.2) := by rw [continuous_iff_continuousAt] intro p unfold gaussianCovarianceDiscrepancy apply ContinuousAt.add · apply ContinuousAt.log · fun_prop · exact ne_of_gt p.1.property.det_pos · apply (continuous_id.matrix_trace.continuousAt.comp) apply ContinuousAt.mul · have hinv : ContinuousAt (fun x : ℝ => Ring.inverse x) (p.1.1.det) := by simpa [Ring.inverse_eq_inv] using continuousAt_inv₀ (ne_of_gt p.1.property.det_pos) simpa [Function.comp_def] using (continuousAt_matrix_inv _ hinv).comp (x := p) ((continuous_subtype_val.comp continuous_fst).continuousAt) · fun_prop -
continuous_normalizedCovarianceDiscrepancytheorem — The normalized Gaussian covariance discrepancy varies continuously with both positive-definite covariances.hypothesesconclusionContinuous (fun p : PositiveCovariance V × PositiveCovariance V => normalizedCovarianceDiscrepancy p.1 p.2)Proof (Lean source)
theorem continuous_normalizedCovarianceDiscrepancy [Fintype V] [DecidableEq V] : Continuous (fun p : PositiveCovariance V × PositiveCovariance V => normalizedCovarianceDiscrepancy p.1 p.2) := by unfold normalizedCovarianceDiscrepancy apply Continuous.sub · have h : Continuous (fun p : PositiveCovariance V × PositiveCovariance V => (p.1, (p.2 : Matrix V V ℝ))) := by fun_prop exact continuous_gaussianCovarianceDiscrepancy.comp h · have h : Continuous (fun p : PositiveCovariance V × PositiveCovariance V => (p.2, (p.2 : Matrix V V ℝ))) := by fun_prop exact continuous_gaussianCovarianceDiscrepancy.comp h -
normalizedCovarianceDiscrepancy_nonnegtheorem — For positive-definite candidate and target covariances, the normalized Gaussian covariance discrepancy is nonnegative.Proof (Lean source)
theorem normalizedCovarianceDiscrepancy_nonneg [Fintype V] [DecidableEq V] (K T : PositiveCovariance V) : 0 ≤ normalizedCovarianceDiscrepancy K T := by let S := CFC.sqrt ((K : Matrix V V ℝ)⁻¹) let A := S * (T : Matrix V V ℝ) * S obtain ⟨hA, hgap, -⟩ := normalizedCovarianceDiscrepancy_whiten K T rw [hgap] exact posDef_logdet_trace_gap_nonneg A hA -
normalizedCovarianceDiscrepancy_eq_zero_ifftheorem — For positive-definite candidate and target covariances, the normalized Gaussian covariance discrepancy is zero exactly when the two covariances agree.Proof (Lean source)
theorem normalizedCovarianceDiscrepancy_eq_zero_iff [Fintype V] [DecidableEq V] (K T : PositiveCovariance V) : normalizedCovarianceDiscrepancy K T = 0 ↔ K = T := by let S := CFC.sqrt ((K : Matrix V V ℝ)⁻¹) let A := S * (T : Matrix V V ℝ) * S obtain ⟨hA, hgap, hAone⟩ := normalizedCovarianceDiscrepancy_whiten K T rw [hgap, posDef_logdet_trace_gap_eq_zero_iff A hA, hAone] -
gaussianCovarianceDiscrepancy_le_truth_ifftheorem — For positive-definite candidate and target covariances, the candidate has no larger Gaussian discrepancy than the truth exactly when it is the truth.hypothesesK T :conclusiongaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T≤ gaussianCovarianceDiscrepancy (T : Matrix V V ℝ) T ↔ K = TProof (Lean source)
theorem gaussianCovarianceDiscrepancy_le_truth_iff [Fintype V] [DecidableEq V] (K T : PositiveCovariance V) : gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T ≤ gaussianCovarianceDiscrepancy (T : Matrix V V ℝ) T ↔ K = T := by constructor · intro hle apply (normalizedCovarianceDiscrepancy_eq_zero_iff K T).mp have hnonneg := normalizedCovarianceDiscrepancy_nonneg K T unfold normalizedCovarianceDiscrepancy at hnonneg ⊢ linarith · rintro rfl exact le_rfl -
discrepancyAttainedOn_of_isCompacttheorem — Given a compact covariance model, a nonempty model, and a target matrix, the Gaussian discrepancy minimum is attained.Proof (Lean source)
theorem discrepancyAttainedOn_of_isCompact [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} (hM : IsCompact M) (hne : M.Nonempty) (T : Matrix V V ℝ) : IsDiscrepancyAttainedOn M T := by have hcont : Continuous (fun K : PositiveCovariance V => gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T) := continuous_gaussianCovarianceDiscrepancy.comp (continuous_id.prodMk continuous_const) obtain ⟨K, hKM, _, hKmin⟩ := hM.exists_sInf_image_eq_and_le hne hcont.continuousOn exact ⟨K, hKM, hKmin⟩ -
discrepancyAttainedOn_of_compactSubleveltheorem — Given a covariance model with a nonempty compact discrepancy sublevel, the global Gaussian discrepancy minimum is attained.hypotheseshM :conclusionProof (Lean source)
theorem discrepancyAttainedOn_of_compactSublevel [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} {T : Matrix V V ℝ} (hM : HasCompactDiscrepancySublevel M T) : IsDiscrepancyAttainedOn M T := by rcases hM with ⟨c, hne, hcompact⟩ let S : Set (PositiveCovariance V) := M ∩ {K | gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T ≤ c} have hatt := discrepancyAttainedOn_of_isCompact (M := S) hcompact hne T rcases hatt with ⟨K, hKS, hKmin⟩ refine ⟨K, hKS.1, ?_⟩ intro L hLM by_cases hLc : gaussianCovarianceDiscrepancy (L : Matrix V V ℝ) T ≤ c · exact hKmin L ⟨hLM, hLc⟩ · exact hKS.2.trans (le_of_lt (lt_of_not_ge hLc)) -
exists_positive_gap_of_attainedtheorem — Given an attained covariance-model discrepancy that omits the positive-definite truth, every model covariance has a common strictly positive normalized gap.hypotheseshatt :hT :T ∉ MProof (Lean source)
theorem exists_positive_gap_of_attained [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} {T : PositiveCovariance V} (hatt : IsDiscrepancyAttainedOn M T) (hT : T ∉ M) : ∃ gap : ℝ, 0 < gap ∧ ∀ K ∈ M, gap ≤ normalizedCovarianceDiscrepancy K T := by rcases hatt with ⟨K, hKM, hKmin⟩ refine ⟨normalizedCovarianceDiscrepancy K T, ?_, ?_⟩ · have hKT : K ≠ T := fun h => hT (h ▸ hKM) have hzero : normalizedCovarianceDiscrepancy K T ≠ 0 := fun h => hKT ((normalizedCovarianceDiscrepancy_eq_zero_iff K T).mp h) exact lt_of_le_of_ne (normalizedCovarianceDiscrepancy_nonneg K T) hzero.symm · intro L hLM unfold normalizedCovarianceDiscrepancy linarith [hKmin L hLM] -
exists_positive_gap_of_isCompacttheorem — Given a compact covariance model, a nonempty model, and a truth outside the model, the model is separated from the truth by a strictly positive population gap.hypotheseshM :hne :M.NonemptyT :hT :T ∉ MProof (Lean source)
theorem exists_positive_gap_of_isCompact [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} (hM : IsCompact M) (hne : M.Nonempty) {T : PositiveCovariance V} (hT : T ∉ M) : ∃ gap : ℝ, 0 < gap ∧ ∀ K ∈ M, gap ≤ normalizedCovarianceDiscrepancy K T := by exact exists_positive_gap_of_attained (discrepancyAttainedOn_of_isCompact hM hne T) hT -
exists_stable_positive_gaptheorem — Given a compact covariance model, a nonempty model, and a truth outside the model, the strict positive population gap persists for nearby positive-definite truths.hypotheseshM :hne :M.NonemptyT :hT :T ∉ Mconclusion∃ gap : ℝ,conclusion 10 < gapconclusion 2∃ U ∈ nhds T, ∀ T' ∈ U, ∀ K ∈ M, gap ≤ normalizedCovarianceDiscrepancy K T'Proof (Lean source)
theorem exists_stable_positive_gap [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} (hM : IsCompact M) (hne : M.Nonempty) {T : PositiveCovariance V} (hT : T ∉ M) : ∃ gap : ℝ, 0 < gap ∧ ∃ U ∈ nhds T, ∀ T' ∈ U, ∀ K ∈ M, gap ≤ normalizedCovarianceDiscrepancy K T' := by let m : PositiveCovariance V → ℝ := fun T' => sInf ((fun K : PositiveCovariance V => normalizedCovarianceDiscrepancy K T') '' M) have hjoint : Continuous (fun p : PositiveCovariance V × PositiveCovariance V => normalizedCovarianceDiscrepancy p.2 p.1) := continuous_normalizedCovarianceDiscrepancy.comp continuous_swap have hm : Continuous m := hM.continuous_sInf hjoint obtain ⟨delta, hdelta, hdelta_le⟩ := exists_positive_gap_of_isCompact hM hne hT have hcontT : Continuous (fun K : PositiveCovariance V => normalizedCovarianceDiscrepancy K T) := continuous_normalizedCovarianceDiscrepancy.comp (continuous_id.prodMk (continuous_const : Continuous fun _ : PositiveCovariance V => T)) obtain ⟨K0, hK0M, hm_eq, _⟩ := hM.exists_sInf_image_eq_and_le hne hcontT.continuousOn have hhalf : 0 < delta / 2 := half_pos hdelta have hhalf_m : delta / 2 < m T := by dsimp [m] rw [hm_eq] exact lt_of_lt_of_le (half_lt_self hdelta) (hdelta_le K0 hK0M) refine ⟨delta / 2, hhalf, {T' | delta / 2 < m T'}, ?_, ?_⟩ · exact (isOpen_lt continuous_const hm).mem_nhds hhalf_m · intro T' hT' K hKM exact hT'.le.trans (csInf_le (hM.image_of_continuousOn ((continuous_normalizedCovarianceDiscrepancy.comp (continuous_id.prodMk continuous_const)).continuousOn)).bddBelow (mem_image_of_mem _ hKM)) -
continuous_covarianceModelLosstheorem — Given a compact covariance model that is nonempty, the population loss is continuous in the target second-moment matrix.hypotheseshM :hne :M.NonemptyconclusionProof (Lean source)
theorem continuous_covarianceModelLoss [Fintype V] [DecidableEq V] {M : Set (PositiveCovariance V)} (hM : IsCompact M) (hne : M.Nonempty) : Continuous (covarianceModelLoss M) := by unfold covarianceModelLoss have hjoint : Continuous (fun p : Matrix V V ℝ × PositiveCovariance V => gaussianCovarianceDiscrepancy (p.2 : Matrix V V ℝ) p.1) := continuous_gaussianCovarianceDiscrepancy.comp continuous_swap exact hM.continuous_sInf hjoint -
populationMinimizers_covarianceModelLoss_ifftheorem — Given covariance models that are compact and nonempty, a positive-definite truth contained in some model, and a model index, the population minimizers are exactly the indices whose models contain the truth.hypothesesV :sharedType u_2I :sharedType u_3Fintype VFintype INonempty Imodels :I → Set (PositiveCovariance V)hcompact :∀ i, IsCompact (models i)hne :∀ i, (models i).NonemptyT :hcontains :∃ i, T ∈ models ii :Iconclusioni ∈ populationMinimizers (fun j => covarianceModelLoss (models j) T)↔ T ∈ models iProof (Lean source)
theorem populationMinimizers_covarianceModelLoss_iff [Fintype V] [DecidableEq V] [Fintype I] [Nonempty I] (models : I → Set (PositiveCovariance V)) (hcompact : ∀ i, IsCompact (models i)) (hne : ∀ i, (models i).Nonempty) (T : PositiveCovariance V) (hcontains : ∃ i, T ∈ models i) (i : I) : i ∈ populationMinimizers (fun j => covarianceModelLoss (models j) T) ↔ T ∈ models i := by rcases hcontains with ⟨j0, hj0⟩ rw [populationMinimizers] constructor · intro hi apply (covarianceModelLoss_eq_truth_iff (hcompact i) (hne i) T).mp apply le_antisymm · calc covarianceModelLoss (models i) T ≤ covarianceModelLoss (models j0) T := hi j0 _ = gaussianCovarianceDiscrepancy (T : Matrix V V ℝ) T := (covarianceModelLoss_eq_truth_iff (hcompact j0) (hne j0) T).2 hj0 · exact covarianceModelLoss_ge_truth (hcompact i) (hne i) T · intro hi j rw [(covarianceModelLoss_eq_truth_iff (hcompact i) (hne i) T).2 hi] exact covarianceModelLoss_ge_truth (hcompact j) (hne j) T -
tendstoInProb_covarianceModelLosstheorem — Given covariance models that are compact and nonempty, an empirical covariance sequence, a target matrix, a sampling measure, and entrywise convergence in probability, the model losses converge coordinatewise in probability.hypothesesV :sharedType u_2I :sharedType u_3Fintype VFintype Imodels :I → Set (PositiveCovariance V)hcompact :∀ i, IsCompact (models i)hne :∀ i, (models i).NonemptySn :ℕ → Ω → Matrix V V ℝT :Matrix V V ℝP :Measure ΩhSn :∀ a b, Tendsto_inProb (fun n ω => Sn n ω a b) (fun _ => T a b) Pi :conclusionTendsto_inProb (fun n ω => covarianceModelLoss (models i) (Sn n ω)) (fun _ => covarianceModelLoss (models i) T) PProof (Lean source)
theorem tendstoInProb_covarianceModelLoss [MeasurableSpace Ω] [Fintype V] [DecidableEq V] [Fintype I] (models : I → Set (PositiveCovariance V)) (hcompact : ∀ i, IsCompact (models i)) (hne : ∀ i, (models i).Nonempty) (Sn : ℕ → Ω → Matrix V V ℝ) (T : Matrix V V ℝ) (P : Measure Ω) (hSn : ∀ a b, Tendsto_inProb (fun n ω => Sn n ω a b) (fun _ => T a b) P) : ∀ i, Tendsto_inProb (fun n ω => covarianceModelLoss (models i) (Sn n ω)) (fun _ => covarianceModelLoss (models i) T) P := by classical intro i let uncurryMatrix : ((V × V) → ℝ) → Matrix V V ℝ := fun x a b => x (a, b) let Yn : ℕ → Ω → ((V × V) → ℝ) := fun n ω ab => Sn n ω ab.1 ab.2 let c : (V × V) → ℝ := fun ab => T ab.1 ab.2 let g : ((V × V) → ℝ) → ℝ := fun x => covarianceModelLoss (models i) (uncurryMatrix x) have huncurry : Continuous uncurryMatrix := by fun_prop have hg : ContinuousAt g c := ((continuous_covarianceModelLoss (hcompact i) (hne i)).comp huncurry).continuousAt have hcoord : ∀ ab, Tendsto_inProb (fun n ω => Yn n ω ab) (fun _ => c ab) P := by rintro ⟨a, b⟩ exact hSn a b simpa [Yn, c, g, uncurryMatrix] using pi_comp_continuousAt hg hcoord