Theory and practice of logic programming