Theory and Practice of Logic Programming