A Method for Specializing Logic Programs