Fix `Basic.rewrite()` behavior

Fixes the behavior of `Basic.rewrite` to call the opropriate rule function.  Furthermore, added handling for `deep` keyword to `Basic.rewrite()`, which defaults to `True`.  This change allows the removal of `Function.rewrite()` and `physics.quantum.QExpr.rewrite()` methods, however, the default behavior is changed from `deep=False` to `deep=True`.