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.