Deviating a bit from book to be more type-disciplined. Added more tests.

Reading the paper, Meta-Circular Abstract Interpretation in Prolog:
http://www.cs.bgu.ac.il/~mcodish/Papers/Pages/meta_circ.html