Make Term an internal base class

Term is now a base class. Subclasses are Bool, Array<Domain, Range> etc.
This simplifies SMT expressions (e.g. "Int x" instead of "Term<Int> x").
The underlying simplifications also give more flexibility when adding new
sorts such as (say) tuples.