Work with Goals and Goal Constructors
mainA Goal is a function that takes a substitution and returns a stream (generator) of substitutions.
Users typically do not write goals directly; instead, they use Goal Constructors (like membero or eq) to build them. When you call a goal constructor, it returns a goal that, when executed with a substitution, yields all possible ways to satisfy that logical constraint.
# Creating a goal using a constructor
g = membero(x, (1, 2, 3))
# Executing the goal with an empty substitution
for s in g({}):
print(s) # Yields {~x: 1}, {~x: 2}, {~x: 3}