Linear Decomposition of the Majority Boolean Function using the Ones on Smaller Variables

Anupam Chattopadhyay, Debjyoti Bhattacharjee, Subhamoy MaitraarXiv 2025 · DOI

Abstract

The Majority Boolean function ($M_n$) is a fundamental component in circuit complexity and emerging logic technologies. This paper presents the first linear-complexity ($O(n)$) method to decompose an $n$-input Majority function into smaller $k$-input Majority gates for any arbitrary $k$. We introduce two primary methods: a practical counter graph approach utilizing compressor trees and a theoretical approach based on restricted set partition functions. Our construction achieves the closest known performance to optimal theoretical lower bounds and is validated through formal verification.

Introduction

A Majority function $M_n$ outputs true if and only if more than half of its $n$ inputs are true. These functions are essential in the $TC^0$ complexity class and are increasingly relevant for hardware technologies like spin-wave logic and superconducting circuits, which implement Majority gates natively. The primary challenge lies in decomposition: representing a large $M_n$ using a limited set of smaller $M_k$ gates. While $O(n)$ solutions existed for $k=3$, a general linear construction for arbitrary $k$ remained an open problem until now.

Methodology

Counter Graph Approach

The primary contribution of this work is a decomposition method that treats the Majority problem as a Hamming weight (HW) calculation. By using "compressor trees" or counter graphs, the circuit counts the number of input bits set to 1. These counters are constructed using $M_k$ gates and organized into a Directed Acyclic Graph (DAG).

Overall structure of the counter graph decomposition for a Majority function.

As shown in the figure above, the inputs are processed through layers of counters to determine the final majority bit. Each individual counter within this structure can be efficiently implemented using the target $M_k$ gates.

Implementation of a 3:2 counter using $M_5$ gates.

The figure above illustrates how a 3:2 counter is realized using $M_5$ gates, demonstrating the modularity of the approach.

Partition Function Approach

The authors also propose a novel theoretical approach linking logic synthesis to elementary number theory. This method uses "Restricted Set Partition Functions" to calculate the ways a threshold can be met by summing Hamming weights of input subgroups. Although mathematically elegant, this method is currently less efficient than the counter graph approach, with a complexity of $O(\frac{n}{k^2} e^{\sqrt{n}})$.

Implementation and Results

The algorithms were implemented in a new Structured Logic Synthesis (SLS) dialect within the CIRCT (Circuit IR Compilers and Tools) framework. Evaluation on synthetic benchmarks, such as decomposing $M_{1001}$ into gates of sizes $k \in {5, 9, 17, 51, 101}$, confirmed the linear scaling.

Key results include:

  • Linear Complexity: Achieved $O(n)$ decomposition for arbitrary $k$, providing the first such construction.
  • Efficiency: Decomposing $M_{1001}$ into $M_5$ gates required approximately 11,146 gates, with the count decreasing as the size of the available gate ($k$) increases.
  • Performance: The decomposition process is extremely fast, with benchmark processing times ranging from 0.046s to 0.554s on an Apple M1 Ultra.
  • Verification: All resulting circuits were formally verified for correctness using the Z3 SMT solver.

Conclusion

This research provides a scalable, linear-time solution for Majority gate decomposition. By reframing logic as arithmetic and leveraging tools from number theory, the authors have narrowed the gap between theoretical bounds and practical synthesis. Future work will focus on extending these techniques to general Threshold functions and incorporating further logic optimization strategies like output-based pruning.

Summary updated

BibTeX
@misc{chattopadhyay2025linear,
  author = {Anupam Chattopadhyay and Debjyoti Bhattacharjee and Subhamoy Maitra},
  title = {{Linear Decomposition of the Majority Boolean Function using the Ones on Smaller Variables}},
  year = {2025},
  eprint = {2504.03262},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.03262},
}
Figure