Documentation

CslibFrontier.Foundations.Probability.TwoStage

Two-stage sampling in finite products #

Draw a uniformly from a finite type α and then b uniformly from β. Suppose a ρ₁ fraction of the a are good, and for each good a a ρ₂ fraction of the b satisfy q a b. Then a ρ₁ ρ₂ fraction of the pairs satisfy q. The event on the second coordinate may depend on the first, unlike in Cslib.Probability.dens_filter_fst_and_snd, where the two events are independent.

The count form Cslib.Probability.mul_le_card_filter_product works over finsets s ×ˢ t, so that the first stage may range over a subset such as powersetCard; the density form over a whole product type is derived from it. Conversely, Cslib.Probability.dens_prod_le_add_of_good gives the complementary union-tail upper bound δ + p when ¬ good a has density at most δ and each good a has conditional failure density at most p.

Main results #

theorem Cslib.Probability.mul_le_card_filter_product {α : Type u_1} {β : Type u_2} (s : Finset α) (t : Finset β) (good : α → Prop) [DecidablePred good] (q : α → β → Prop) [(a : α) → DecidablePred (q a)] {ρ₁ ρ₂ : ℝ} (hρ₂ : 0 ≤ ρ₂) (h₁ : ρ₁ ≤ ↑{a ∈ s | good a}.card) (h₂ : ∀ a ∈ s, good a → ρ₂ ≤ ↑{b ∈ t | q a b}.card) :
ρ₁ * ρ₂ ≤ ↑{ab ∈ s ×ˢ t | q ab.1 ab.2}.card

Two-stage counting. If at least ρ₁ elements of s are good, and each good a has at least ρ₂ partners b ∈ t with q a b, then at least ρ₁ ρ₂ pairs of s ×ˢ t satisfy q.

theorem Cslib.Probability.mul_le_dens_filter_prod {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (good : α → Prop) [DecidablePred good] (q : α → β → Prop) [(a : α) → DecidablePred (q a)] {ρ₁ ρ₂ : ℝ} (hρ₂ : 0 ≤ ρ₂) (h₁ : ρ₁ ≤ ↑{a : α | good a}.dens) (h₂ : ∀ (a : α), good a → ρ₂ ≤ ↑{b : β | q a b}.dens) :
ρ₁ * ρ₂ ≤ ↑{ab : α × β | q ab.1 ab.2}.dens

Two-stage sampling. If a ρ₁ fraction of the a are good, and for each good a a ρ₂ fraction of the b satisfy q a b, then a ρ₁ ρ₂ fraction of the pairs satisfy q.

theorem Cslib.Probability.dens_prod_le_add_of_good {α : Type u_1} {β : Type u_2} [Fintype α] [Nonempty α] [Fintype β] (good : α → Prop) [DecidablePred good] (bad : α × β → Prop) [DecidablePred bad] {δ p : ℝ} (hbad : ↑{a : α | ¬good a}.dens ≤ δ) (hp0 : 0 ≤ p) (hgood : ∀ (a : α), good a → ↑{b : β | bad (a, b)}.dens ≤ p) :
↑{ab : α × β | bad ab}.dens ≤ δ + p

Two-stage union-tail bound. Over a product space α × β ([Nonempty α]), when the first coordinate violates good with density at most δ and every a satisfying good a has conditional fiber failure density dens {b : β | bad (a, b)} ≤ p (0 ≤ p), the joint event bad has density at most δ + p.