LogicProgrammingScope

Full term-construction and unification scope of :dsl-unify's Prolog DSL: composes :dsl-core's scope mixins (MinimalLogicProgrammingScope, LogicProgrammingScopeWithSubstitutions, LogicProgrammingScopeWithPrologStandardLibrary, LogicProgrammingScopeWithOperators, LogicProgrammingScopeWithVariables — none of which know anything about unification) with LogicProgrammingScopeWithUnification, so an it.unibo.tuprolog.unify.Unificator's operations (bare, or through the mguWith/matches/unifyWith sugar) are available alongside the rest of the DSL, all self-referentially typed so chained calls keep resolving to this same, richer scope.

logicProgramming/lp are the idiomatic way to obtain and use one, optionally choosing which Unificator strategy governs it; of and empty exist for callers that need to plug in a custom Termificator, VariablesProvider or Unificator (or build a scope without immediately entering it). it.unibo.tuprolog.dsl.LogicProgrammingScope.withUnification upgrades an existing :dsl-core scope into one of these, reusing its underlying Scope/Termificator/VariablesProvider.

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val _: Var
Link copied to clipboard
abstract val A: Var
Link copied to clipboard
Link copied to clipboard
abstract val B: Var
Link copied to clipboard
abstract val C: Var
Link copied to clipboard
abstract val context: Substitution
Link copied to clipboard
open val cut: Atom
Link copied to clipboard
abstract val D: Var
Link copied to clipboard
abstract val E: Var
Link copied to clipboard
abstract val emptyBlock: EmptyBlock
Link copied to clipboard
Link copied to clipboard
abstract val F: Var
Link copied to clipboard
abstract val fail: Truth
Link copied to clipboard
abstract val G: Var
Link copied to clipboard
abstract val H: Var
Link copied to clipboard
open val halt: Atom
Link copied to clipboard
abstract val I: Var
Link copied to clipboard
abstract val J: Var
Link copied to clipboard
abstract val K: Var
Link copied to clipboard
abstract val L: Var
Link copied to clipboard
abstract val M: Var
Link copied to clipboard
abstract val N: Var
Link copied to clipboard
open val nl: Atom
Link copied to clipboard
abstract val O: Var
Link copied to clipboard
abstract val P: Var
Link copied to clipboard
abstract val Q: Var
Link copied to clipboard
abstract val R: Var
Link copied to clipboard
open val repeat: Atom
Link copied to clipboard
abstract val S: Var
Link copied to clipboard
abstract val scope: Scope
Link copied to clipboard
abstract val T: Var
Link copied to clipboard
Link copied to clipboard
abstract val U: Var
Link copied to clipboard
abstract val unificator: Unificator
Link copied to clipboard
abstract val V: Var
Link copied to clipboard
abstract val variables: Map<String, Var>
Link copied to clipboard
Link copied to clipboard
abstract val W: Var
Link copied to clipboard
abstract val X: Var
Link copied to clipboard
abstract val Y: Var
Link copied to clipboard
abstract val Z: Var

Functions

Link copied to clipboard
open fun abolish(indicator: Any): Struct
Link copied to clipboard
open infix fun Any.and(other: Any): Struct
Link copied to clipboard
abstract fun anonymous(): Var
Link copied to clipboard
open fun append(left: Any, right: Any, result: Any): Struct
Link copied to clipboard
open fun arg(index: Any, compound: Any, argument: Any): Struct
Link copied to clipboard
open infix fun Any.arithEq(right: Any): Struct
Link copied to clipboard
open infix fun Any.arithNeq(right: Any): Struct
Link copied to clipboard
open fun assert(clause: Any): Struct
Link copied to clipboard
open fun asserta(clause: Any): Struct
Link copied to clipboard
open fun assertz(clause: Any): Struct
Link copied to clipboard
open fun at_end_of_stream(alias: Any): Struct
Link copied to clipboard
open fun atom(atom: Any): Struct
Link copied to clipboard
open fun atom_chars(atom: Any, chars: Any): Struct
Link copied to clipboard
open fun atom_codes(atom: Any, codes: Any): Struct
Link copied to clipboard
open fun atom_concat(first: Any, second: Any, result: Any): Struct
Link copied to clipboard
open fun atom_length(atom: Any, length: Any): Struct
Link copied to clipboard
open fun atomic(atomic: Any): Struct
Link copied to clipboard
abstract fun atomOf(value: Char): Atom
abstract fun atomOf(value: String): Atom
Link copied to clipboard
open fun bagof(template: Any, goal: Any, bag: Any): Struct
Link copied to clipboard
open fun between(min: Any, max: Any, number: Any): Struct
Link copied to clipboard
abstract fun blockOf(terms: Iterable<Term>): Block
abstract fun blockOf(terms: Sequence<Term>): Block
abstract fun blockOf(vararg terms: Term): Block
open fun blockOf(vararg terms: Any): Block
Link copied to clipboard
open fun call(goal: Any): Struct
Link copied to clipboard
open fun callable(goal: Any): Struct
Link copied to clipboard
open fun catch(goal: Any, error: Any, continuation: Any): Struct
Link copied to clipboard
open fun char_code(char: Any, code: Any): Struct
Link copied to clipboard
open fun clause(head: Any, body: Any): Struct
open fun clause(function: LogicProgrammingScope.() -> Any): Clause
Link copied to clipboard
abstract fun clauseOf(head: Struct?, vararg body: Term): Clause
Link copied to clipboard
open fun compound(struct: Any): Struct
Link copied to clipboard
abstract fun consOf(head: Term, tail: Term): Cons
open fun consOf(head: Any, tail: Any): Cons
Link copied to clipboard
open fun consult(url: Any): Struct
Link copied to clipboard
abstract operator fun contains(variable: Var): Boolean
abstract operator fun contains(variable: String): Boolean
open operator fun Substitution.contains(term: Any): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract override fun copy(scope: Scope): LogicProgrammingScope

abstract fun copy(unificator: Unificator): LogicProgrammingScope

Creates a copy of this scope, backed by the same it.unibo.tuprolog.core.Scope, using unificator instead of the current one.

Link copied to clipboard
open fun copy_term(term: Any, copy: Any): Struct
Link copied to clipboard
open fun current_flag(name: Any, value: Any): Struct
Link copied to clipboard
open fun current_op(precedence: Any, specifier: Any, functor: Any): Struct
Link copied to clipboard
open fun current_prolog_flag(name: Any, value: Any): Struct
Link copied to clipboard
open fun directive(function: LogicProgrammingScope.() -> Any): Directive
Link copied to clipboard
abstract fun directiveOf(body1: Term, vararg body: Term): Directive
open fun directiveOf(term: Any, vararg terms: Any): Directive
Link copied to clipboard
open operator fun Term.div(other: Any): Indicator
open operator fun Boolean.div(other: Any): Struct
open operator fun Char.div(other: Any): Struct
open operator fun Number.div(other: Any): Struct
open operator fun String.div(other: Any): Struct
Link copied to clipboard
open fun dynamic(indicator: Any): Struct
Link copied to clipboard
open infix fun Any.eq(right: Any): Struct
Link copied to clipboard
open infix fun Any.equalsTo(other: Any): Struct
Link copied to clipboard
open fun fact(function: LogicProgrammingScope.() -> Any): Fact
Link copied to clipboard
abstract fun factOf(head: Struct): Fact
open fun factOf(term: Any): Fact
Link copied to clipboard
open fun findall(template: Any, goal: Any, bag: Any): Struct
Link copied to clipboard
open fun float(number: Any): Struct
Link copied to clipboard
open fun functor(struct: Any, functor: Any, arity: Any): Struct
Link copied to clipboard
abstract operator fun get(variable: String): Var?
open operator fun Substitution.get(term: Any): Term?
Link copied to clipboard
abstract operator fun getValue(thisRef: Any?, property: KProperty<*>): Var
Link copied to clipboard
open infix fun Any.greaterThan(other: Any): Struct
Link copied to clipboard
open infix fun Any.greaterThanOrEqualsTo(other: Any): Struct
Link copied to clipboard
open fun ground(term: Any): Struct
Link copied to clipboard
open infix fun Any.id(right: Any): Struct
Link copied to clipboard
open infix fun Any.if(other: Any): Rule
open fun Any.if(vararg other: Any): Rule
Link copied to clipboard
open infix fun Any.impliedBy(other: Any): Rule
open fun Any.impliedBy(vararg other: Any): Rule
Link copied to clipboard
open fun include(url: Any): Struct
Link copied to clipboard
abstract fun indicatorOf(name: Term, arity: Term): Indicator
abstract fun indicatorOf(name: String, arity: Int): Indicator
Link copied to clipboard
open fun initialization(goal: Any): Struct
Link copied to clipboard
open infix fun Any.intDiv(other: Any): Struct
Link copied to clipboard
open fun integer(number: Any): Struct
Link copied to clipboard
abstract fun intOf(value: Byte): Integer
abstract fun intOf(value: Int): Integer
abstract fun intOf(value: Long): Integer
abstract fun intOf(value: Short): Integer
abstract fun intOf(value: String): Integer
abstract fun intOf(value: BigInteger): Integer
abstract fun intOf(value: String, radix: Int): Integer
Link copied to clipboard
open operator fun String.invoke(term: Any, vararg terms: Any): Struct
Link copied to clipboard
open infix fun Any.is(other: Any): Struct
Link copied to clipboard
open fun load(url: Any): Struct
Link copied to clipboard
open fun logicList(vararg items: Any, tail: Any?): List
Link copied to clipboard
abstract fun logicListFrom(terms: Iterable<Term>, last: Term?): List
abstract fun logicListFrom(terms: Sequence<Term>, last: Term?): List
abstract fun logicListFrom(vararg terms: Term, last: Term?): List
Link copied to clipboard
abstract fun logicListOf(terms: Iterable<Term>): List
abstract fun logicListOf(terms: Sequence<Term>): List
abstract fun logicListOf(vararg terms: Term): List
open fun logicListOf(vararg terms: Any): List
Link copied to clipboard
open infix fun Any.lowerThan(other: Any): Struct
Link copied to clipboard
open infix fun Any.lowerThanOrEqualsTo(other: Any): Struct
Link copied to clipboard
open fun match(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Boolean

Overload of Unificator.match accepting plain values instead of Terms: term1 and term2 are auto-toTerm-ed before delegating to this scope's unificator.

open fun match(term1: Term, term2: Term): Boolean
open fun match(term1: Term, term2: Term, occurCheckEnabled: Boolean): Boolean
Link copied to clipboard
open infix fun Any.matches(other: Any): Boolean

Infix alias of match for Any operands: tells whether this and other (both auto-toTerm-ed) unify, with occurs-check enabled, using this scope's unificator.

Link copied to clipboard
open fun member(item: Any, list: Any): Struct
Link copied to clipboard
open fun merge(substitution1: Substitution, substitution2: Substitution): Substitution
abstract fun merge(substitution1: Substitution, substitution2: Substitution, occurCheckEnabled: Boolean): Substitution
Link copied to clipboard
open fun mgu(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Substitution

Overload of Unificator.mgu accepting plain values instead of Terms: term1 and term2 are auto-toTerm-ed before delegating to this scope's unificator, so e.g. raw Strings, numbers or already-built Terms can be mixed freely.

open fun mgu(term1: Term, term2: Term): Substitution
abstract fun mgu(term1: Term, term2: Term, occurCheckEnabled: Boolean): Substitution
Link copied to clipboard
open infix fun Any.mguWith(other: Any): Substitution

Infix alias of mgu for Any operands: computes the Most General Unifier of this and other (both auto-toTerm-ed), with occurs-check enabled, using this scope's unificator.

Link copied to clipboard
open operator fun Term.minus(other: Any): Struct
open operator fun Boolean.minus(other: Any): Struct
open operator fun Char.minus(other: Any): Struct
open operator fun Number.minus(other: Any): Struct
open operator fun String.minus(other: Any): Struct
Link copied to clipboard
open fun naf(goal: Any): Struct
Link copied to clipboard
open fun natural(number: Any): Struct
Link copied to clipboard
open infix fun Any.neq(right: Any): Struct
Link copied to clipboard
Link copied to clipboard
open infix fun Any.nid(right: Any): Struct
Link copied to clipboard
open infix fun Any.nonGreaterThan(other: Any): Struct
Link copied to clipboard
open infix fun Any.nonLowerThan(other: Any): Struct
Link copied to clipboard
open fun nonvar(number: Any): Struct
Link copied to clipboard
open fun not(goal: Any): Struct
Link copied to clipboard
open infix fun Any.notEqualsTo(other: Any): Struct
Link copied to clipboard
open fun number(number: Any): Struct
Link copied to clipboard
open fun number_chars(first: Any, second: Any): Struct
Link copied to clipboard
open fun number_codes(first: Any, second: Any): Struct
Link copied to clipboard
abstract fun numOf(value: Byte): Integer
abstract fun numOf(value: Double): Real
abstract fun numOf(value: Float): Real
abstract fun numOf(value: Int): Integer
abstract fun numOf(value: Long): Integer
abstract fun numOf(value: Number): Numeric
abstract fun numOf(value: Short): Integer
abstract fun numOf(value: String): Numeric
abstract fun numOf(value: BigDecimal): Real
abstract fun numOf(value: BigInteger): Integer
Link copied to clipboard
open fun op(precedence: Any, specifier: Any, functor: Any): Struct
Link copied to clipboard
open infix fun Any.or(other: Any): Struct
Link copied to clipboard
open operator fun Term.plus(other: Any): Struct
open operator fun Boolean.plus(other: Any): Struct
open operator fun Char.plus(other: Any): Struct
open operator fun Number.plus(other: Any): Struct
Link copied to clipboard
open infix fun Any.pow(other: Any): Struct
Link copied to clipboard
abstract fun realOf(value: Double): Real
abstract fun realOf(value: Float): Real
abstract fun realOf(value: String): Real
abstract fun realOf(value: BigDecimal): Real
Link copied to clipboard
open infix operator fun Term.rem(other: Any): Struct
open infix operator fun Boolean.rem(other: Any): Struct
open infix operator fun Char.rem(other: Any): Struct
open infix operator fun Number.rem(other: Any): Struct
open infix operator fun String.rem(other: Any): Struct
Link copied to clipboard
open fun retract(clause: Any): Struct
Link copied to clipboard
open fun retractall(clause: Any): Struct
Link copied to clipboard
open fun rule(function: LogicProgrammingScope.() -> Any): Rule
Link copied to clipboard
abstract fun ruleOf(head: Struct, body1: Term, vararg body: Term): Rule
Link copied to clipboard
open fun <R> scope(function: LogicProgrammingScope.() -> R): R
Link copied to clipboard
open fun set_flag(name: Any, value: Any): Struct
Link copied to clipboard
open fun set_prolog_flag(name: Any, value: Any): Struct
Link copied to clipboard
open fun setof(template: Any, goal: Any, bag: Any): Struct
Link copied to clipboard
open fun solve(goal: Any): Struct
Link copied to clipboard
open fun static(indicator: Any): Struct
Link copied to clipboard
abstract fun structOf(functor: String, args: Iterable<Term>): Struct
abstract fun structOf(functor: String, args: List<Term>): Struct
abstract fun structOf(functor: String, args: Sequence<Term>): Struct
abstract fun structOf(functor: String, vararg args: Term): Struct
open fun structOf(functor: String, vararg args: Any): Struct
Link copied to clipboard
open fun sub_atom(atom: Any, before: Any, length: Any, after: Any, sub_atom: Any): Struct
Link copied to clipboard
abstract fun substitutionOf(assignments: Iterable<Pair<Var, Term>>): Substitution
abstract fun substitutionOf(assignments: Sequence<Pair<Var, Term>>): Substitution
abstract fun substitutionOf(vararg assignments: Pair<String, Term>): Substitution
Link copied to clipboard
open infix fun Any.sup(other: Any): Struct
Link copied to clipboard
open infix fun Any.then(other: Any): Struct
Link copied to clipboard
open fun throw(error: Any): Struct
Link copied to clipboard
open operator fun Term.times(other: Any): Struct
open operator fun Boolean.times(other: Any): Struct
open operator fun Char.times(other: Any): Struct
open operator fun Number.times(other: Any): Struct
open operator fun String.times(other: Any): Struct
Link copied to clipboard
open infix fun Var.to(termObject: Any): Substitution.Unifier
open infix fun String.to(termObject: Any): Substitution.Unifier
Link copied to clipboard
open fun <T : Term> Any.toSpecificSubTypeOfTerm(type: KClass<T>, converter: (Struct) -> T): T
Link copied to clipboard
open fun Any.toTerm(): Term
Link copied to clipboard
abstract fun truthOf(value: Boolean): Truth
Link copied to clipboard
abstract fun tupleOf(terms: Iterable<Term>): Tuple
abstract fun tupleOf(terms: Sequence<Term>): Tuple
abstract fun tupleOf(vararg terms: Term): Tuple
open fun tupleOf(vararg terms: Any): Tuple
Link copied to clipboard
abstract fun unifierOf(assignments: Iterable<Pair<Var, Term>>): Substitution.Unifier
abstract fun unifierOf(assignments: Sequence<Pair<Var, Term>>): Substitution.Unifier
abstract fun unifierOf(vararg assignments: Pair<String, Term>): Substitution.Unifier
Link copied to clipboard
open fun unify(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Term?

Overload of Unificator.unify accepting plain values instead of Terms: term1 and term2 are auto-toTerm-ed before delegating to this scope's unificator.

open fun unify(term1: Term, term2: Term): Term?
open fun unify(term1: Term, term2: Term, occurCheckEnabled: Boolean): Term?
Link copied to clipboard
open infix fun Any.unifyWith(other: Any): Term?

Infix alias of unify for Any operands: unifies this and other (both auto-toTerm-ed), with occurs-check enabled, using this scope's unificator.

Link copied to clipboard
open infix fun Any.univ(other: Any): Struct
Link copied to clipboard
open fun var(term: Any): Struct
Link copied to clipboard
abstract fun varOf(name: Char): Var
abstract fun varOf(name: String): Var
Link copied to clipboard
abstract fun whatever(): Var
Link copied to clipboard
abstract fun where(lambda: Scope.() -> Unit): Scope
Link copied to clipboard
abstract fun <R> with(lambda: Scope.() -> R): R
Link copied to clipboard
open fun write(term: Any): Struct