I think what you actually want is just `not F.free_symbols`.