[Resolution] Add smart backtracking

I'd like to know if there are any performance shortcuts that are obvious here, @floere.

I'd also really appreciate testing this out on some `Podfile`s with resolvable conflicts to make sure the speed increase is real, @kylef @alloy. (I discovered this optimization working with bundler code)

\c @indirect