Higher-Order Implementation of Program Transformations using Algebraic Specification