I got it working!
This is a part of a program designed to figure out laws that make up an arbitrary world by designing and refining hypotheses about it.
The first function, ‘find-new-domain-instance, is where the program asks a question about the world—for example, in (find-new-domain-instance awesome 2), it’s taking the hypothesis stored in the variable ‘awesome—i.e., the hypothesis that everything is awesome—and asking about other objects it has seen in other predicates.
The second function, ‘find-restrictions, is a way of refining hypotheses. It knows that not everything in the world is an octopus—Tiberius, for example, is not an octopus—so it’s trying to find ways of figuring out what defines an octopus. Is it that everything that loves Fluffy is an octopus? Or that everything that loves Xerxes? Or is Tiberius the only non-octopus in the world?
This is what I do on Friday/Saturday nights.