Replace expr == with recursive function. Add goodies for traversing expressions.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>