Logic programming and substitutions