Simplify QE by substituting definitions of variables