Skip to main content

Group Theory Application: Boolean Function Counting

· 5 min read

Abstract algebra is often challenging to understand initially because of its abstract nature. This article introduces an application of group theory: counting boolean functions.

Burnside's Lemma

When analyzing the action of a group on a set, Burnside's lemma is a very important theorem:

Burnside's Lemma

Let a finite group GG act on a finite set XX, then the number of orbits of XX under the action of GG is

N=1GgGχ(g)N = \frac{1}{|G|} \sum_{g \in G} \chi(g)

where χ(g)\chi(g) is the number of fixed points of gg on XX.

There are many references for the proof of this lemma 12, which will not be repeated here.

Boolean Function Counting Problem

Problem Background

Boolean functions are an important class of functions that satisfy the mapping form F2nF2\mathbb{F}_2^n \to \mathbb{F}_2. Usually, we use 0 and 1 to represent the two elements in F2\mathbb{F}_2, and the elements in F2n\mathbb{F}_2^n can be represented by a binary string of length nn. Some common 2-element boolean functions and their truth tables are as follows:

  1. Logical AND: f(x,y)=xyf(x, y) = x \land y
    xyf(x, y)
    000
    010
    100
    111
  2. Logical OR: f(x,y)=xyf(x, y) = x \lor y
    xyf(x, y)
    000
    011
    101
    111
  3. Logical XOR: f(x,y)=xyf(x, y) = x \oplus y
    xyf(x, y)
    000
    011
    101
    110

Boolean functions can also be represented by switch circuits, as shown in the following figure:

The boolean function represented by switch circuits

It can be seen that two switches in these three switch circuits can be exchanged. Some Boolean functions are equivalent under the permutation of the independent variables. Therefore, the counting problem of Boolean functions is raised: For an nn-variable Boolean function, how many essentially different Boolean functions are there?

Observing 2-variable Boolean Functions

Let's first take a look at the truth tables of all 2-variable Boolean functions:

f(x,y)f(x, y)(0,0)(0,1)(1,0)(1,1)
f1f_{1}0000
f2f_{2}0001
f3f_{3}0010
f4f_{4}0011
f5f_{5}0100
f6f_{6}0101
f7f_{7}0110
f8f_{8}0111
f9f_{9}1000
f10f_{10}1001
f11f_{11}1010
f12f_{12}1011
f13f_{13}1100
f14f_{14}1101
f15f_{15}1110
f16f_{16}1111

Consider the permutation of two elements, that is, the permutation group S2={(1),(12)}S_2 = \{ (1), (12) \}. Boolean functions that satisfy fi(x,y)=fj(y,x)f_i (x, y) = f_j (y, x) are essentially the same. It can be seen that the pairs of Boolean functions that meet this condition in the above table are:

  • f3f_3 and f5f_5
  • f4f_4 and f6f_6
  • f11f_{11} and f13f_{13}
  • f12f_{12} and f14f_{14}

Therefore, the number of essentially different 2-variable Boolean functions is 164=1216 - 4 = 12.

So how to analyze it using Burnside's lemma? Count the elements in S2S_2 by permutation type, and list the number of fixed points on F={f1,,f16}F = \{ f_1, \cdots, f_{16} \} that it acts on:

Permutation TypeCountχ(g)\chi(g)
121^2122×2=162^{2 \times 2} = 16
212^1123=82^3 = 8

For the 121^2 type of permutation, the number of fixed points is the number of choices for each independent variable (2×2=42 \times 2 = 4 in total) multiplied by the number of choices for the result. Therefore, there are 24=162^4 = 16 fixed points in total. For the 212^1 type of permutation, the number of fixed points is the number of choices for the two independent variables that are bound together (00, 01, and 10, 11, for a total of 33) multiplied by the number of choices for the result. Therefore, there are 23=82^3 = 8 fixed points in total.

Therefore, by Burnside's lemma, the number of essentially different 2-variable Boolean functions is:

N=12(1×16+1×8)=12N = \frac{1}{2} (1 \times 16 + 1 \times 8) = 12

3-variable Boolean Functions

For 3-variable Boolean functions, we directly count the elements of S3 by permutation type:

Permutation TypeCountχ(g)\chi(g)
131^31223=2562^{2^3} = 256
11211^1 2^1322×3=642^{2 \times 3} = 64
313^1224=162^4 = 16

Compared with 2-variable Boolean functions, the permutation type 313^1 appears in the table of 3-variable Boolean functions. Considering the combinations of 3 independent variables bound together and essentially different under cyclic shifts, there are 4: 000, 001, 011, 111. Therefore, there are 24=162^4 = 16 fixed points.

Therefore, by Burnside's lemma, the number of essentially different 3-variable Boolean functions is:

N=13!(1×256+3×64+2×16)=80N = \frac{1}{3!} (1 \times 256 + 3 \times 64 + 2 \times 16) = 80

More General Cases

For n-variable Boolean functions, our task is to classify the elements of SnS_n by permutation type and find the number of fixed points for each cycle. The number of fixed points is then split into the number of combinations corresponding to each cycle. For example, a 414^1 permutation corresponds to 6 combinations: 0000, 0001, 0011, 0101, 0111, 1111. Therefore, a 41...4^1... permutation corresponds to 26×2^{6 \times \cdots} fixed points.

Note: Perhaps finding these combinations corresponds to a similar application problem, but I haven't thought of one yet.

Footnotes

  1. https://en.wikipedia.org/wiki/Burnside%27s_lemma

  2. 胡冠章 应用近世代数[M]. 第 3 版. 版. 北京: 清华大学出版社, 2006.