TITLE: An application of the Inclusion Principle to Chemistry? (Proof Verification)
QUESTION [12 upvotes]: Background
I’m taking chemistry and one thing they have us do is draw Lewis structures for molecules. Guessing if there are going to be double or triple bonds is kind of annoying. I’d like to be able to come up with a formula to predict the total number of bonds a molecule will form. I count a double bond as $2$ bonds, and a triple bond as $3$.

What I’d like to prove
Count a single bond as $1$ bond, a double as $2$ bonds, and a triple as $3$. 
Scrolling through YouTube one video seems to suggest that when octets (or a duet for hydrogen) are formed, the number of bonds a molecule will form is,
$$B=\frac{N-H}{2}$$
Where $N$ is the sum of the electrons needed on each atom. Ex: In $H_2O$, we have $N=2+2+8=12$.
And $H$ is the number of electrons we have to distribute. In our case $1+1+6=8$ hence, $B=\frac{12-8}{2}=2$ and water forms $2$ bonds as expected (two single bonds). 
I’d like to be sure this holds in general for the conditions mentioned to be sure I’m not using some nonsense. I think I came up with a proof:

My proof
Suppose we have $n$ atoms $X_1,X_2,\dotsc,X_n$ part of a molecule. Think of each atom $X_i$ as a set consisting of it’s electrons (in the molecule form). $X_1 \cup X_2 \cup \dotsb \cup X_n$ is what you get when you combine these elements/electrons and overlapping may occur. $X_1 \cup \dotsb \cup X_n$ is the molecule, which has a cardinality of $H$ electrons by definition. 
By inclusion exclusion,
$$
    H
  = \left| \bigcup_{k=1}^{n} X_k \right|
  =   \sum_{k=1}^{n} |X_k|
    - \sum_{1 \leq i < j \leq n} |X_i \cap X_j|
    + \dotsb
    + (-1)^{n-1} \left| \bigcap_{k=1}^{n} X_k \right|
$$
On the right most part of the equation above, everything vanishes except $|\sum_{k=1}^{n} |X_k|-\sum_{1 \leq i < j \leq n} |X_i \cap X_j|$ since each electron can only share $2$ atoms at most. 
Finally, $\sum_{k=1}^{n} |X_k|=N$ since the cardinality of each atom is exactly how many electrons it needs, if we give it what it needs. And $\sum_{1 \leq i < j \leq n} |X_i \cap X_j|$ is the some of the bonding electrons (no double counting), between each element. That is $\sum_{1 \leq i < j \leq n} |X_i \cap X_j|=2B$.
So, $H=N-2B$ and $\frac{N-H}{2}=B$. 
Question
Is the above proof correct.

REPLY [2 votes]: It is nice that you can do rigorous math with electron counting rules but I should advise you that they are only heuristic rules used to rationalize the structure of molecules, reactivity etc. Well, they are quite accurate but to know the distribution of electrons in the molecule one has to perform a measurement or apply a quantum mechanical model, both depict a more complicated pattern. Moreover, you would not know how to assign electrons because you would not know where is the boundary between one atom and others, not to mention what is the bonding region.
Nevertheless, many people has worked in that direction because it is important to rationalize the properties of molecules in terms of their constituents. Some researchers have come to the conclusion that the best way is to partition the real space where the molecule "lives" and then count electrons integrating the electronic distribution $|\Psi|^2$ in these regions. So, instead of applying the inclusion principle in the model you brought to the table I suggest you to find out that the probability of finding exactly an integer number of electrons $\nu$ in a region of the Euclidean space $\Omega$ (an atom for instance) is given by the formula 
$$ p(\nu) = \frac{1}{v!} \sum_{i=0,N-\nu} \frac{(-1)^i}{i!} \int_\Omega \Gamma^{(\nu+i)} $$
where $N$ is the total number of electrons in the molecule, that is broken in two regions ($\mathbb{R}^3 = \Omega + \Omega^c$), and 
$$\Gamma^{(m)} = \frac{N!}{(N-m)!} \int |\Psi|^2 \, d\pmb r_{m+1} \cdots d\pmb r_{N} $$ 
is a reduced density matrix of order $m$, whose integration 
$$ \int_\Omega \Gamma^{(m)} $$ 
means the average number of electrons in $\Omega$ when $m=1$, average number of electron pairs when $m=2$, and so on up to $N$.
You will find the equation and the details here. I am pretty sure that it follows applying the inclusion principle. I did it once but not totally rigorous.
If you like this topic you will enjoy another article that describes the same probabilities with a more mathematical treatment.