Algebraic expressions and substitution