Formalization Blueprint for “An Introduction to Algebraic Combinatorics” by Darij Grinberg

4.3 Boolean Möbius inversion

4.3.1 Alternating sums over supersets

Lemma 4.68 Alternating sum over supersets

Let \(P \subseteq Q\) be two finite sets.

(a) We have

\begin{equation} \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert I\right\vert }=\left( -1\right) ^{\left\vert P\right\vert }\left[ P=Q\right] . \label{eq.lem.pie.two-sets-altsum.a} \end{equation}
7

(b) We have

\begin{equation} \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }=\left[ P=Q\right] . \label{eq.lem.pie.two-sets-altsum.b} \end{equation}
8

Proof

(a) We must prove the equality (7). If \(P=Q\), then the only subset \(I\) of \(Q\) satisfying \(P\subseteq I\) is \(Q\) itself, so the sum equals \((-1)^{|Q|} = (-1)^{|P|} \cdot [P = Q]\) (since \([Q = Q] = 1\)).

For the rest of this proof, we assume \(P\neq Q\). Thus, \(\left[ P=Q\right] =0\).

Now, \(P\) is a proper subset of \(Q\), so there exists some \(q\in Q\) such that \(q\notin P\). Fix such a \(q\).

Let

\[ \mathcal{A}:=\left\{ I\subseteq Q\ \mid \ P\subseteq I\right\} , \]

and let \(\operatorname {sign} I := (-1)^{|I|}\) for each \(I\in \mathcal{A}\). Then

\begin{equation} \sum _{I\in \mathcal{A}}\operatorname {sign} I=\sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert I\right\vert }. \label{pf.lem.pie.two-sets-altsum.a.3} \end{equation}
9

We define a map \(f:\mathcal{A}\rightarrow \mathcal{A}\) by

\[ f\left( I\right) :=I\bigtriangleup \left\{ q\right\} = \begin{cases} I\setminus \left\{ q\right\} , & \text{if }q\in I;\\ I\cup \left\{ q\right\} , & \text{if }q\notin I \end{cases} \ \ \ \ \ \ \ \ \ \ \text{for each }I\in \mathcal{A}. \]

This map \(f\) is well-defined and it is an involution (the symmetric difference with \(\{ q\} \) undoes itself). This involution has no fixed points (since \(f(I) = I \bigtriangleup \{ q\} \neq I\)). Furthermore, for each \(I \in \mathcal{A}\), the set \(f(I) = I \bigtriangleup \{ q\} \) differs from \(I\) in exactly one element (namely \(q\)), so \(|f(I)| = |I| \pm 1\). Therefore

\[ (-1)^{|f(I)|} = -(-1)^{|I|}, \]

i.e., \(\operatorname {sign}(f(I)) = -\operatorname {sign} I\). Since \(f\) is a sign-reversing fixed-point-free involution on \(\mathcal{A}\), the elements of \(\mathcal{A}\) pair up into pairs with opposite signs, giving

\[ \sum _{I\in \mathcal{A}}\operatorname {sign} I = 0. \]

Comparing with (9), we obtain

\[ \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert I\right\vert }=0=\left( -1\right) ^{\left\vert P\right\vert }\left[ P=Q\right] \]

(since \((-1)^{|P|} \cdot 0 = 0\)). This proves (7).

(b) If \(I\) is any subset of \(Q\), then \(\left\vert Q\setminus I\right\vert =\left\vert Q\right\vert -\left\vert I\right\vert \equiv \left\vert Q\right\vert +\left\vert I\right\vert \pmod{2}\), so

\[ \left( -1\right) ^{\left\vert Q\setminus I\right\vert }=\left( -1\right) ^{\left\vert Q\right\vert +\left\vert I\right\vert }=\left( -1\right) ^{\left\vert Q\right\vert }\left( -1\right) ^{\left\vert I\right\vert } \]

(since \(\left\vert Q\setminus I\right\vert \equiv \left\vert Q\right\vert +\left\vert I\right\vert \pmod{2}\)). Hence

\begin{align*} \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert } & =\sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\right\vert }\left( -1\right) ^{\left\vert I\right\vert } =\left(-1\right) ^{\left\vert Q\right\vert }\underbrace{\sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert I\right\vert }}_{\substack{[=, \left , (, , -, 1, \right , ), , ^, {, \left , \vert , P, \right , \vert , }, \left , [, , P, =, Q, \right , ], , \\ , \text , {, (, b, y, , p, a, r, t, , \textbf , {, (, a, ), }, ), }]}}\\ & =\left( -1\right) ^{\left\vert Q\right\vert }\left( -1\right) ^{\left\vert P\right\vert }\left[ P=Q\right] . \end{align*}

It remains to check that

\begin{equation} \left( -1\right) ^{\left\vert Q\right\vert }\left( -1\right) ^{\left\vert P\right\vert }\left[ P=Q\right] =\left[ P=Q\right]. \label{pf.lem.pie.two-sets-altsum.b.1} \end{equation}
12

If \(P\neq Q\), then \([P = Q] = 0\) and both sides are \(0\). If \(P = Q\), then \((-1)^{|Q|}(-1)^{|P|} = (-1)^{2|Q|} = 1\), so both sides equal \(1\). Thus

\[ \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }=\left[ P=Q\right] . \]

This proves (8).

4.3.2 The Boolean Möbius inversion formula

Lemma 4.69

Let \(Q\) be a finite set, \(A\) an additive abelian group, and \(f\) a function that assigns to each pair \((J, P)\) of subsets of \(Q\) an element of \(A\). Then

\[ \sum _{J \subseteq Q} \sum _{P \subseteq J} f(J, P) = \sum _{P \subseteq Q} \sum _{\substack{[J, , \subseteq , Q, ;, \\ , P, , \subseteq , J]}} f(J, P). \]
theorem BooleanMobius.sum_powerset_powerset_swap {α : Type u_1} [DecidableEq α] {Q : Finset α} {A : Type u_2} [AddCommGroup A] (f : Finset αFinset αA) :
JQ.powerset, PJ.powerset, f J P = PQ.powerset, JQ.powerset with P J, f J P
Proof

Both sides sum the same function \(f\) over all pairs \((J, P)\) of subsets of \(Q\) satisfying \(P \subseteq J \subseteq Q\); only the order of summation differs.

Theorem 4.70 Boolean Möbius inversion

Let \(S\) be a finite set. Let \(A\) be any additive abelian group.

For each subset \(I\) of \(S\), let \(a_{I}\) and \(b_{I}\) be two elements of \(A\).

Assume that

\begin{equation} b_{I}=\sum _{J\subseteq I}a_{J}\ \ \ \ \ \ \ \ \ \ \text{for all }I\subseteq S. \label{eq.thm.pie.moeb.ass} \end{equation}
13

Then, we also have

\begin{equation} a_{I}=\sum _{J\subseteq I}\left( -1\right) ^{\left\vert I\setminus J\right\vert }b_{J}\ \ \ \ \ \ \ \ \ \ \text{for all }I\subseteq S. \label{eq.thm.pie.moeb.claim} \end{equation}
14

theorem BooleanMobius.booleanMobiusInversion {α : Type u_1} [DecidableEq α] {S : Finset α} {A : Type u_2} [AddCommGroup A] (a b : Finset αA) (hab : IS, b I = JI.powerset, a J) (I : Finset α) :
I Sa I = JI.powerset, (-1) ^ (I \ J).card b J
Proof

Fix a subset \(Q\) of \(S\). We shall prove that

\[ a_{Q}=\sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }b_{I}. \]

We begin by rewriting the right hand side. By (13), we have \(b_I = \sum _{J \subseteq I} a_J\) for each \(I\), so

\begin{align} \sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }b_{I} & =\sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }\underbrace{\sum _{J\subseteq I}a_{J}}_{=\sum _{P\subseteq I}a_{P}}=\sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }\sum _{P\subseteq I}a_{P}\nonumber \\ & =\sum _{I\subseteq Q}\ \ \sum _{P\subseteq I}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }a_{P}. \label{pf.thm.pie.moeb.1} \end{align}

The two summation signs “\(\sum _{I\subseteq Q}\ \ \sum _{P\subseteq I}\)” on the right hand side of this equality result in a sum over all pairs \(\left( I,P\right) \) of subsets of \(Q\) satisfying \(P\subseteq I\subseteq Q\). The same result can be obtained by the two summation signs “\(\sum _{P\subseteq Q}\ \ \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\)” (by Lemma 4.69). Hence, (15) rewrites as follows:

\begin{align} \sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }b_{I} & =\sum _{P\subseteq Q}\ \ \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }a_{P}\nonumber \\ & =\sum _{P\subseteq Q}\left( \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }\right) a_{P}. \label{pf.thm.pie.moeb.2} \end{align}

We want to prove that this equals \(a_{Q}\). To this end, we show that the coefficient \(\sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }\) in front of \(a_{P}\) is \(0\) whenever \(P\neq Q\), and is \(1\) whenever \(P=Q\). That is, every subset \(P\) of \(Q\) satisfies

\begin{equation} \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }=\left[ P=Q\right] . \label{pf.thm.pie.moeb.4} \end{equation}
17

This is precisely Lemma 4.68 (b).

Now, (16) becomes (using (17))

\begin{align*} \sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }b_{I} & =\sum _{P\subseteq Q}\underbrace{\left( \sum _{\substack{[I, \subseteq , Q, ;, \\ , P, \subseteq , I]}}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }\right) }_{=\left[ P=Q\right] }a_{P}=\sum _{P\subseteq Q}\left[ P=Q\right] a_{P}\\ & =\underbrace{\left[ Q=Q\right] }_{\substack{[=, 1, \\ , \text , {, (, s, i, n, c, e, , }, Q, =, Q, \text , {, ), }]}}a_{Q}+\sum _{\substack{[P, \subseteq , Q, ;, \\ , P, \neq , Q]}}\underbrace{\left[ P=Q\right] }_{\substack{[=, 0, \\ , \text , {, (, s, i, n, c, e, , }, P, \neq , Q, \text , {, ), }]}}a_{P}\\ & =a_{Q}+\underbrace{\sum _{\substack{[P, \subseteq , Q, ;, \\ , P, \neq , Q]}}0 \cdot a_{P}}_{=0}=a_{Q}. \end{align*}

In other words, \(a_{Q}=\sum _{I\subseteq Q}\left( -1\right) ^{\left\vert Q\setminus I\right\vert }b_{I}\).

Since \(Q\) was an arbitrary subset of \(S\), we have shown that

\[ a_{I}=\sum _{J\subseteq I}\left( -1\right) ^{\left\vert I\setminus J\right\vert }b_{J}\ \ \ \ \ \ \ \ \ \ \text{for all }I\subseteq S. \]

This proves Theorem 4.70.

Lemma 4.71

Alternative formulation of Boolean Möbius inversion (Theorem 4.70) using the \(\mathbb {Z}\)-module scalar multiplication: under the same hypotheses, for all \(I\subseteq S\),

\[ a_{I}=\sum _{J\subseteq I}\left(-1\right)^{\left\vert I\setminus J\right\vert }\cdot b_{J}, \]

where the multiplication \((-1)^{|I\setminus J|}\cdot b_J\) denotes the \(\mathbb {Z}\)-module scalar action.

theorem BooleanMobius.booleanMobiusInversion' {α : Type u_1} [DecidableEq α] {S : Finset α} {A : Type u_2} [AddCommGroup A] [Module A] (a b : Finset αA) (hab : IS, b I = JI.powerset, a J) (I : Finset α) :
I Sa I = JI.powerset, (-1) ^ (I \ J).card b J
Proof

Immediate from Theorem 4.70, since the integer scalar multiplication \(n\cdot a\) in any additive abelian group coincides with \(n\) times \(a\) when the group carries a \(\mathbb {Z}\)-module structure.