First cut Datalog engine inferring facts.

This is the general architecture. Will be going though and fixing where needed
next.