consolidate is_number and free_symbols into base classes