I was wondering if there is a generalization which from it the following theorems will be resulted. It seems that it should be related to the rank of the abelian group underlying the vector space, but I'm unable to formulated anything of this sort. Any enlightenment? Maybe generalizations from category theory?...
The dimension theorem of vector spaces: $$ U,W\subset V \rightarrow \dim(U+W) = \dim(U) + \dim(W) - \dim(U\cap W) $$
The cardinality of groups subsets product: $$ H,N\subset G \rightarrow |HN| = \frac{|H||N|}{H\cap N} $$
Which become even more similar if we denote the group product by + and apply log: $$ \log|H+N| = \log|H| + \log|N| - \log|H\cap N| $$
I understand that basically both are related through the property of joint sets, but they should be related more than that (and the extended Inclusion-Exclusion formula for probability etc.) $$ |A\cup B| = |A| + |B| - |A\cap B| $$
First, let's look at what exactly these facts follow from. The second isomorphism theorem for modules and groups imply $$\frac{U+W}{W}\cong \frac{U}{U\cap W}\quad\text{and}\quad \frac{HN}{N}\cong\frac{H}{H\cap N}$$ respectively. Now, applying the fact that dimension and order of groups satisfy: $$\dim(V/W)+\dim(W) = \dim(V)\quad\text{and}\quad |G/K|\cdot|K| = |G|$$ gives you the above equalities. So really you are looking for abstractions of the second isomorphism theorem, and order/dimension.
Universal algebra gives a general framework for discussing the isomorphism theorems. Here are some quick definitions:
You can find all of this on this page. We then have the following generalization of the second isomorphism theorem:
Now, to get some kind of inclusion-exclusion like you have above, you would need an isomorphism invariant number $|\cdot|$ to associate to the algebra, which is also additive (like vector spaces) or multiplicative (like groups). This would give you the equality $|B/\Phi_B| = |[B]^{\Phi}|$, which generalizes the above two.