Package-level declarations

Types

Link copied to clipboard

Default LogicProgrammingScope implementation: forwards VariablesProvider, Unificator, TheoryFactory and MutableSolver operations to its respective collaborator (variablesProvider, unificator, theoryFactory, defaultSolver), and requires (in its init block) that they all share the same Scope/Unificator consistently. Built by LogicProgrammingScope.of (and transitively by logicProgramming/lp/prolog) rather than instantiated directly by client code.

Link copied to clipboard

Adds resolution-driving sugar to LogicProgrammingScopeWithUnificator: implements MutableSolver itself (forwarding to defaultSolver, e.g. via MutableSolver by defaultSolver as LogicProgrammingScopeImpl does), so solve/solveOnce/solveList and every knowledge-base-mutating operation (MutableSolver.assertZ, MutableSolver.retract, ...) are callable directly on the scope — plus staticKb/dynamicKb shorthands for loading a whole knowledge base at once, and solverOf for building additional, independent solvers sharing this scope's solverFactory/unificator.

Functions

Link copied to clipboard
fun <R> logicProgramming(solverFactory: SolverFactory, unificator: Unificator = solverFactory.defaultUnificator, function: LogicProgrammingScope.() -> R): R

Entry point of the resolution-aware Prolog DSL: builds a fresh LogicProgrammingScope backed by a it.unibo.tuprolog.solve.MutableSolver obtained from solverFactory (see LogicProgrammingScopeWithResolution.defaultSolver), and runs function against it as the receiver. Everything built or asserted inside function (facts, rules, queries via solve/staticKb/dynamicKb) shares that one scope and that one underlying solver.

Link copied to clipboard
fun <R> lp(solverFactory: SolverFactory, unificator: Unificator = solverFactory.defaultUnificator, function: LogicProgrammingScope.() -> R): R

Shorthand alias for logicProgramming.

Link copied to clipboard
fun <R> prolog(unificator: Unificator = Solver.prolog.defaultUnificator, function: LogicProgrammingScope.() -> R): R

Shorthand for logicProgramming defaulting its solverFactory argument to Solver.prolog, the classic, ISO-standard SLD-NF resolution engine (:solve-classic). This is the DSL's main entry point for everyday use: