Add a base class for BooleanTrue and BooleanFalse

Change a few places in the code to use isinstance(x, (bool, BooleanAtom))
instead of x in [True, False].

Note BooleanAtom does not use the metaclass Singleton, as if it did there
would be a useless S.BooleanAtom.