Made val_t::parent be a counted_t.
Took another look at the Term * lifetiming in rewrites.hpp (after the recent merge from next).