Filter out impossible states during preprocessing.

Fixes #27.