THEORY AND PRACTICE OF LOGIC PROGRAMMING