Inclusion-exclusion for exact block occupancy (source code)

= Inclusion-exclusion for exact block occupancy
{title2=$\sum_{r\geq1}(-1)^{r-1}\binom Nr\binom mq^r\binom{(N-r)m}{K-rq}$}

Suppose $N$ disjoint blocks each have $m$ elements. The number of $K$-element subsets having exactly $q>0$ elements in at least one block is the displayed sum, with $1\leq r\leq\min(N,\lfloor K/q\rfloor)$ and invalid <binomial coefficients> interpreted as zero. For a specified set of $r$ blocks, choose $q$ elements in each and all remaining elements outside those blocks; <inclusion-exclusion> then counts the union of the exact-occupancy events. Excluding the rest of each specified block is essential.

// Target: algebra.bigb