Reopening Pandora's Box: Complexity Results of Shift-Addition/Subtraction Sequences
Nicolai Fiege, Théo Cantaloube, Martin Lange, Christine Solnon
cs.CC
Dec 1, 2026 · v1
TL;DR
Nearly all NP-hardness reductions and correctness proofs for shift-add constant multiplication problems are formalized in Lean 4, largely written with Claude assistance.
Abstract
Multiplication by constants is a fundamental operation in digital hardware design, with applications in many different areas. Costly generic multipliers are commonly replaced by tailored sequences of shift and add/subtract operations, giving rise to the Single Constant, Multiple Constant and Constant Matrix Multiplication (SCM, MCM, CMM) problems, and their pipelined variants (PSCM, PMCM, PCMM) in which operation outputs are registered and leave the same pipeline stage. Exact synthesis approaches based on SAT, ILP or CP are routinely observed to scale exponentially, and the problems have long been treated as intractable. The exact complexity classification of the shift-add straight-line program formulation has remained open, though, and the results usually cited as evidence of NP-hardness concern different computational models or do not transfer by polynomial-time reduction. Here we close this gap for five problems: we show that CMM, MCM, PMCM, PCMM, and MCM with fixed topology are all NP-complete. NP-hardness of CMM and PCMM hold for targets over binary vectors with only three non-zero entries already, the remaining three hold for targets with three non-zero digits in Canonical Signed Digit representation. We also show that these restrictions are tight, because the fragment over two non-zeros is decidable in polynomial time. Hardness therefore does not stem from complexity of the individual targets but rather from the combinatorial structure of the target set and the interaction between the targets.
Problem
The exact computational complexity of shift-add straight-line program formulations of constant multiplication problems (CMM, MCM, and pipelined variants) has remained open. Results commonly cited as evidence of NP-hardness concern different computational models or do not transfer by polynomial-time reduction.
Approach
The authors give polynomial-time reductions from Vertex Cover to CMM, PCMM, PMCM, MCM, and MCM with fixed topology. The PMCM and MCM-FT reductions use extended Sidon sets to build targets with three non-zero CSD digits. Membership in NP is established via heuristics that bound the budget K. Nearly all proofs are formalized in Lean 4, with increasing use of Claude for writing proofs. Only arguments about polynomial-time computability are left unformalized.
Results
CMM, MCM, PMCM, PCMM, and MCM with fixed topology are shown to be NP-complete, already for targets with three non-zero entries or three non-zero CSD digits. Fragments with two non-zeros are decidable in polynomial time, so these restrictions are tight.