Package-level declarations

Types

Link copied to clipboard
open class ThermostatAgent : Thread
Java counterpart of it.unibo.tuprolog.examples.solve.ThermostatAgentKt: a reactive agent whose control loop is a Prolog program, while its get_temp/1 sensor and push/1 actuator primitives are plain Java objects, showing how the :solve public API reads from Java (e.g.
Link copied to clipboard
class ThermostatAgentKt(name: String, coldThreshold: Int, hotThreshold: Int, initialTemperature: Int) : Thread

A self-contained reactive agent whose control loop is written in Prolog but whose sensor/actuator primitives are implemented in Kotlin, demonstrating how to embed a it.unibo.tuprolog.solve.Solver inside a regular JVM Thread to bridge logic programming with imperative, stateful host code.

Properties

Link copied to clipboard

The it.unibo.tuprolog.solve.Signature (gt/2) under which gt is registered as a primitive.

Functions

Link copied to clipboard

A hand-written it.unibo.tuprolog.solve.primitive.Primitive implementing a gt/2 predicate that succeeds iff its first numeric argument is strictly greater than its second. It is the lowest-level way of extending the solver with custom logic: rather than subclassing one of the it.unibo.tuprolog.solve.primitive.Primitive convenience base types (as it.unibo.tuprolog.examples.solve.ThermostatAgentKt does), it directly implements the (Solve.Request<ExecutionContext>) -> Sequence<Solve.Response> function type expected by it.unibo.tuprolog.solve.primitive.Primitive's constructor.

Link copied to clipboard
fun main()

Demonstrates several :solve and :dsl-theory features together in one runnable program: the it.unibo.tuprolog.dsl.theory.logicProgramming DSL block for writing terms/theories/queries with ordinary Kotlin syntax, registering a custom it.unibo.tuprolog.solve.primitive.Primitive (gt) inside a custom it.unibo.tuprolog.solve.library.Library, building a solver with it.unibo.tuprolog.solve.Solver.prolog.solverWithDefaultBuiltins combining that library with an inline static knowledge base, and exhaustively pattern-matching over the three it.unibo.tuprolog.solve.Solution subtypes (Yes, No, Halt) returned while iterating it.unibo.tuprolog.solve.Solver.solve.