NAME

Logic::Relational::Syntax - Declarative syntax layer for Logic::Relational.

SYNOPSIS

use v5.38;
use Logic::Relational::Syntax;

logic Graph {
    table path/2;

    facts {
        edge('a', 'b');
        edge('b', 'c');
        edge('c', 'a'); # cyclic graph
    }

    rule path($x, $y) {
        edge($x, $y);
    }
    rule path($x, $z) {
        fresh my $y;
        edge($x, $y);
        path($y, $z);
    }
}

query Graph::path('a', fresh my $dest) -> my $q;
my @reachable = $q->distinct_values($dest);

DESCRIPTION

Exports declarative keywords (logic, fact, facts, table, rule, fresh, query, and generator) via Keyword::Simple.

FUNCTIONS

translate_body

Internal helper that translates a declarative rule body string into a Perl expression returning a Logic::Relational::Goal object.