MiniKanren fresh
fresh (x...) g ...
Binds fresh variables to x ...
and succeeds if the goals g ...
succeed.
Q: When is a variable fresh? A: When it has no association.
Examples:
Both q, x are fresh variables at first
(run* (q)
(fresh (x)
(== #t x)
(== #t q)))
Law of fresh
If x
is fresh, (v x)
succeeds and associates x
with v
.
(v w)
is the same as (w v)
. (association of fresh variables is commutative)
Reification of a fresh variable.
Where x is fresh:
x == (_.0)
Created with (reify-name 0)