/-- The union bound: if the bad sets have total size less than `|Ω|`, some point avoids them all.
Hint: `card_biUnion_le` bounds `(S.biUnion B).card` by the sum, and
`exists_mem_notMem_of_card_lt_card` finds a point of `univ` outside the union. -/
theorem exists_avoiding {Ω ι : Type*} [Fintype Ω] [DecidableEq Ω] (S : Finset ι)
(B : ι → Finset Ω) (h : ∑ i ∈ S, (B i).card < Fintype.card Ω) :
∃ ω : Ω, ∀ i ∈ S, ω ∉ B i := by
sorryShow the compiled solution
/-- **The union bound (first-moment method, counting form).** Let `Ω` be a finite sample space and
`B i` (for `i ∈ S`) a family of "bad" events. If `∑ |B i| < |Ω|` — equivalently, if the bad events
have total probability `< 1` under the uniform distribution — then some outcome `ω` avoids every
bad event. Proof: `|⋃ B i| ≤ ∑ |B i| < |Ω|`, so the union is not everything. -/
theorem exists_avoiding {Ω ι : Type*} [Fintype Ω] [DecidableEq Ω] (S : Finset ι)
(B : ι → Finset Ω) (h : ∑ i ∈ S, (B i).card < Fintype.card Ω) :
∃ ω : Ω, ∀ i ∈ S, ω ∉ B i := by
have hcard : (S.biUnion B).card < (univ : Finset Ω).card :=
lt_of_le_of_lt card_biUnion_le (by simpa using h)
obtain ⟨ω, -, hω⟩ := exists_mem_notMem_of_card_lt_card hcard
exact ⟨ω, fun i hi hωi => hω (mem_biUnion.mpr ⟨i, hi, hωi⟩)⟩Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor