np hard
2005 France NP-complete
14

Package Dependency Resolution as 3-SAT

Roberto Di Cosmo et al., 2005 — installing a set of compatible packages is NP-complete. Every modern package manager is a SAT solver in disguise.

Roberto Di Cosmo, at the University of Paris Diderot, with collaborators on the EU-funded EDOS project, formally proved that the package installation problem in real-world Linux distributions is NP-complete. Given a repository of packages with version constraints, dependencies, and conflicts, decide whether a given set of user-selected packages can be installed simultaneously. Di Cosmo encoded the problem as 3-SAT for both the Debian (.deb) and Red Hat (.rpm) constraint languages, with reductions tight enough that real package managers were observed to time out on adversarial inputs. The result reshaped the architecture of every major package manager. OpenSUSE's libsolv (used by zypper, dnf, microdnf), Fedora's dnf, the original libapt — all run a SAT solver internally. Apt uses a heuristic scoring approach, which is why it occasionally proposes removing your desktop environment. npm and Cargo make pragmatic compromises that avoid SAT but accept incompatible-version trees.

Mancinelli, F., Boender, J., Di Cosmo, R., Vouillon, J., Durak, B., Leroy, X., Treinen, R. (2006). Managing the Complexity of Large Free and Open Source Package-Based Software Distributions. Proceedings of the 21st IEEE/ACM International Conference on Automated Software Engineering, 199–208. Source →