All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.it.unibo.tuprolog.dsl.unify.LogicProgrammingScopeWithUnification.kt Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy