Merged Literal and Atom classes

Previously, there were 2 classes for representing datalog statements
like p(x) (the so-called atomic datalog formulas).  This led to
subtle problems, e.g. with assertions and type-checking.
The code was also a bit confusing.

This fix collapses the Atom class and the Literal class so
that those problems are now more apparent.

It also adds type-checking functions that include just
the right granularity.  Those type-checking functions are
applied within asserts at top-level class interfaces,
which helps document which code handles which fragments
of the language.

Change-Id: I1a1efafa071ec43e6a82f2c29f9574305a7e84eb