Get exists/defined predicates right this time

The previous commit was entirely buggy. That's what you get for
programming and reading email all at the same time.
Tests for new predicates