I'm having trouble automating calculation of intersection cardinalities of particular sets.
Here are some definitions.
Number of available elements is $n$, size of a particular set $S \in \mathcal{S}$ must be $k$ $\bigg(\left|\mathcal{S}\right| = \binom{n}{k}\bigg)$, a cover set $C_{S}$ contains all sets $V \in \mathcal{S}$ where $\left|S \cap V\right| \geq r$ $\longrightarrow \left|C_{S}\right| = \sum_{i=r}^{k} \binom{k}{i} \binom{n-k}{k-i}$.
I'm interested in calculating size of the union between cover sets. Let's say that $n = 20$, $k = 5$ and $r = 3$.
If I take a particular set $S_1 = \{1,2,3,4,5\}$, then $\left|C_{S_1}\right| = 1126$.
Another particular set $S_2 = \{1,2,3,4,6\}$ and $\left|C_{S_2}\right| = \left|C_{S_1}\right| = 1126$. Although $\left|C_{S_1} \cup C_{S_2}\right| = \left|C_{S_1}\right| + \left|C_{S_2}\right| - \left|C_{S_1} \cap C_{S_2}\right|$ by the inclusion-exclusion principle.
For the given example the intersection cardinality can be calculated: $$\left|C_{S_1} \cap C_{S_2}\right| = \binom{4}{3} \binom{14}{2} + \left(\binom{4}{2} + 2 \cdot \binom{4}{3} + \binom{4}{4}\right) \binom{14}{1} + \left(\binom{4}{3} + 2 \cdot \binom{4}{4}\right) \binom{14}{0} \text{ .} $$
Since $S_1$ and $S_2$ match in 4 numbers I calculate all possible configurations for their intersection to get cardinality (the numbers were checked by code).
I'm wondering how to calculate these intersections automatically (can't inference the general formula) when intersection is between two or more cover sets, and when they match in less than $k-1$ numbers (here $S_1$ and $S_2$ matched in 4 and I'm quite confident I'd be able to inference the formula for $k-1$ special case).
I guess that calculation would directly use the inclusion-exclusion principle but calculating the cardinalities of intersections seems a bit tricky. It's convenient that the result can be reused once the size of the intersection between two cover sets is calculated that match in some $p$ numbers (it's not necessary to know exactly what those matching numbers are). The same could be done for more sets - I could just enumerate the sets by code and get the needed cardinalities but given the combinatorial explosion for other triplets of $(n,k,r)$ this won't be tractable for long.
Generating functions?
Let $j=|S_1\cap S_2|$. You want to count the number of $k$-sets $V$ that cover both $S_1$ and $S_2$. You can choose $i_m$ elements from $S_m$ with $r\le i_m\le k$. Some number $l\ge0$ with $i_1+i_2-k\le l\le\min(i_1,i_2)$ must be chosen from the $j$ common elements, the remaining $i_m-l$ elements in $S_m$ must be chosen from the remaining $k-j$ elements in $S_m$, and then the remaining $k-i_1-i_2+l$ elements in $V$ must be chosen from the $n-2k+j$ elements that aren't in either $S_m$, for a total of
$$ |C_{S_1}\cap C_{S_2}|=\sum_{i_1=r}^k\sum_{i_2=r}^k\sum_{l=\max(0,i_1+i_2-k)}^{\min(i_1,i_2)}\binom jl\binom{k-j} {i_1-l}\binom{k-j}{i_2-l}\binom{n-2k+j}{k-i_1-i_2+l}\;.$$