NAME
Logic::Relational::Substitution - Represents an immutable variable substitution mapping.
SYNOPSIS
use Logic::Relational::Substitution;
my $subst = Logic::Relational::Substitution->new;
my $new_subst = $subst->bind($var_id => $val);
DESCRIPTION
Logic::Relational::Substitution stores logical variable bindings. It is immutable (copy-on-write) to make depth-first backtracking search simple and robust without needing manual rollbacks of variables.
METHODS
new
Constructor. Optionally takes a hash reference of initial bindings.
bind
Takes a variable ID and a value, returning a new Logic::Relational::Substitution object containing the new binding.
walk
Dereferences a term through the substitution. If the term is a variable and is bound, recursively dereferences until it hits an unbound variable or a non-variable term.
reify
Recursively walks a term, replacing all bound variables within compound terms with their bound values. Unbound variables remain unchanged.