initial stab at common subexpression elimination. still some hacks, and no search over rewrites yet.