Various performance updates to AST rewriting

o Memoize copy constructors for Products
o Use an Iterator for folding over Product children
o Use Object equality (this requires that Rewriters work with AnyRef
  items rather than Any)
o Use tail recursive folds
Add rewriter to solve arithmetic expressions using literals
Add rewriter for naming pattern elements
Add rewriter for normalizing match predicates