NAME

Logic::Relational::Query - Manages the execution and backtracking search of a query.

SYNOPSIS

use Logic::Relational::Query;
my $query = Logic::Relational::Query->new(
    program    => $program,
    goals      => [$goal],
    predicates => $predicates_snapshot,
);
while (my $solution = $query->next) {
    ...
}

DESCRIPTION

Logic::Relational::Query executes the logical goals using a depth-first search and an explicit agenda of execution states. This design avoids deep recursion or complex mutable call stacks.

METHODS

new

Constructor. Takes program (Program), goals (arrayref), and predicates (snapshot of the predicates hash).

next

Performs the search step. Returns the next Logic::Relational::Solution object, or undef if all solutions have been exhausted.

reify_solution

Constructs a Logic::Relational::Solution object from a successful execution state.