Port of Composer\DependencyResolver\Solver (CDCL) and of the skeleton of Problem (the offending rules; messages come with R5).
Composer\DependencyResolver\Solver
Problem
Composer\DependencyResolver\Problem