commonMain.it.unibo.tuprolog.dsl.unify.LogicProgrammingScopeWithUnification.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-unify Show documentation
Show all versions of dsl-unify Show documentation
Kotlin DSL for logic programming, enriched with unification facilities
package it.unibo.tuprolog.dsl.unify
import it.unibo.tuprolog.core.Scope
import it.unibo.tuprolog.core.Substitution
import it.unibo.tuprolog.core.Term
import it.unibo.tuprolog.dsl.LogicProgrammingScope
import it.unibo.tuprolog.unify.Unificator
import kotlin.js.JsName
interface LogicProgrammingScopeWithUnification : LogicProgrammingScope, Unificator {
@JsName("unificator")
val unificator: Unificator
@JsName("anyMguWith")
infix fun Any.mguWith(other: Any): Substitution =
[email protected](this.toTerm(), other.toTerm())
@JsName("anyMatches")
infix fun Any.matches(other: Any): Boolean =
[email protected](this.toTerm(), other.toTerm())
@JsName("anyUnifyWith")
infix fun Any.unifyWith(other: Any): Term? =
[email protected](this.toTerm(), other.toTerm())
@JsName("mguAny")
fun mgu(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Substitution =
mgu(term1.toTerm(), term2.toTerm(), occurCheckEnabled)
@JsName("matchAny")
fun match(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Boolean =
match(term1.toTerm(), term2.toTerm(), occurCheckEnabled)
@JsName("unifyAny")
fun unify(term1: Any, term2: Any, occurCheckEnabled: Boolean = true): Term? =
unify(term1.toTerm(), term2.toTerm(), occurCheckEnabled)
companion object {
@JsName("of")
fun of(
unificator: Unificator = Unificator.default,
scope: Scope = Scope.empty()
): LogicProgrammingScopeWithUnification = LogicProgrammingScopeWithUnificationImpl(unificator, scope)
}
}