Finite probability tables and cell averages
Lax793645.FiniteProbability · concepts/Lax793645/FiniteProbability.lean · lax-793645
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
All expectations are finite weighted sums. A partition is represented by a map to a finite set of cells. Cell averages are zero on cells of zero reference mass. Actual successful queries are subprobability masses; their densities are taken relative to the reference law. Restricting a query retains its original mass.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.Data.Real.Basic |
| 2 | import Mathlib.Data.Fintype.BigOperators |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Finite probability tables and cell averages |
| 7 | type: definition |
| 8 | --- |
| 9 | All expectations are finite weighted sums. A partition is represented by a map |
| 10 | to a finite set of cells. Cell averages are zero on cells of zero reference mass. |
| 11 | Actual successful queries are subprobability masses; their densities are taken |
| 12 | relative to the reference law. Restricting a query retains its original mass. |
| 13 | -/ |
| 14 | |
| 15 | namespace Lax793645.FiniteProbability |
| 16 | noncomputable section |
| 17 | open scoped BigOperators |
| 18 | |
| 19 | abbrev Weight (A : Type*) := A → ℝ |
| 20 | def indicator (P : Prop) : ℝ := @ite ℝ P (Classical.propDecidable _) 1 0 |
| 21 | def expectation {A : Type*} [Fintype A] (μ f : Weight A) : ℝ := ∑ x, μ x * f x |
| 22 | def mass {A : Type*} [Fintype A] (μ : Weight A) (P : A → Prop) : ℝ := |
| 23 | expectation μ (fun x => indicator (P x)) |
| 24 | def Probability {A : Type*} [Fintype A] (μ : Weight A) : Prop := |
| 25 | (∀ x, 0 ≤ μ x) ∧ ∑ x, μ x = 1 |
| 26 | def Subprobability {A : Type*} [Fintype A] (μ : Weight A) : Prop := |
| 27 | (∀ x, 0 ≤ μ x) ∧ ∑ x, μ x ≤ 1 |
| 28 | def product {A B : Type*} (μ : Weight A) (ν : Weight B) : Weight (A × B) := |
| 29 | fun x => μ x.1 * ν x.2 |
| 30 | def pushforward {A B : Type*} [Fintype A] (μ : Weight A) (p : A → B) : Weight B := |
| 31 | fun c => mass μ (fun x => p x = c) |
| 32 | def inner {A : Type*} [Fintype A] (μ f g : Weight A) : ℝ := |
| 33 | expectation μ (fun x => f x * g x) |
| 34 | def project {A B : Type*} [Fintype A] (μ : Weight A) (p : A → B) |
| 35 | (f : Weight A) : Weight A := |
| 36 | fun x => pushforward (fun y => μ y * f y) p (p x) / pushforward μ p (p x) |
| 37 | def density {A : Type*} (μ x : Weight A) : Weight A := fun a => x a / μ a |
| 38 | def dominatedSupport {A : Type*} (x μ : Weight A) : Prop := |
| 39 | ∀ a, x a ≠ 0 → μ a ≠ 0 |
| 40 | def bounded {A : Type*} (f : Weight A) : Prop := (∀ x, 0 ≤ f x) ∧ (∀ x, f x ≤ 1) |
| 41 | def l1 {A : Type*} [Fintype A] (x y : Weight A) : ℝ := ∑ a, |x a - y a| |
| 42 | def clip {A : Type*} (R : ℝ) (μ x : Weight A) : Weight A := |
| 43 | fun a => min (max (density μ x a) 0) R |
| 44 | def projectionError {A B : Type*} [Fintype A] |
| 45 | (μ f g : Weight A) (p : A → B) : ℝ := |
| 46 | inner μ f g - inner μ (project μ p f) (project μ p g) |
| 47 | def tail {A : Type*} [Fintype A] (R : ℝ) (μ x : Weight A) : ℝ := |
| 48 | mass x (fun a => R ≤ density μ x a) |
| 49 | def cellError {A B : Type*} [Fintype A] [Fintype B] |
| 50 | (μ : Weight A) (p : A → B) (f x : Weight A) : ℝ := |
| 51 | l1 (pushforward (fun a => μ a * f a) p) (pushforward x p) |
| 52 | def HasNet {A : Type*} [Fintype A] (P : Weight A → Prop) (r : ℕ) (ε : ℝ) : Prop := |
| 53 | ∃ t : ℕ, t ≤ r ∧ ∃ f : Fin t → Weight A, ∀ x, P x → ∃ i, l1 x (f i) ≤ ε |
| 54 | |
| 55 | end |
| 56 | end Lax793645.FiniteProbability |
| 57 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments