Improvements to inequality solving

fixes #8206 (please feel free to any others that are related that also work with these changes)
fixes #8518
I'm not sure why. Is importing it ever harder than importing S? The only reason I used it here is because someone had already defined oo = S.Infinity in a routine so instead of doing that I just imported it at the top. I can change it back to use S.