Cache produced smt terms.

This is necessary for proof production.
FIXME: I would rather like to have this in an extra hash table that is
given as parameter to toSMTTerm.  This way we would save a pointer for each
CCAppTerm.