Equation

sealed class Equation<A : Term, B : Term> : ToTermConvertible, Any

A class representing an Equation of logic terms, to be unified;

LHS stands for Left-Hand side and RHS stands for Right-Hand side, of the Equation

Fields

Name Description
open lhs: A

The left-hand side of the equation

open rhs: B

The right-hand side of the equation

Methods

toTerm

open fun toTerm(): Struct

Converts this instance to a Prolog Term

ReturnValue

Name Description
Struct

toPair

fun toPair(): Pair<A, B>

ReturnValue

Name Description
Pair<A, B>

swap

fun swap(): Equation<Term, Term>

ReturnValue

Name Description
Equation<Term, Term>

apply

fun apply(substitution: Substitution, equalityChecker: (Term, Term)->Boolean): Equation<Term, Term>

Applies given substitution to the Equation left-hand and right-hand sides, returning the new Equation

To modify default equality between Terms, a custom equalityChecker can be provided

Parameters

Name Description
substitution: Substitution
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Equation<Term, Term>

Extensions

toSubstitution

fun <A : Var, B : Term> Equation<A, B>.toSubstitution(): Substitution

Transforms an Equation of a Var with a Term to the corresponding Substitution

Receiver

Name Description
Equation<A, B>

ReturnValue

Name Description
Substitution

CompanionObject

Equation

sealed class Equation<A : Term, B : Term> : ToTermConvertible, Any

A class representing an Equation of logic terms, to be unified;

LHS stands for Left-Hand side and RHS stands for Right-Hand side, of the Equation

Methods

of

fun <A : Term, B : Term> of(lhs: A, rhs: B, equalityChecker: (Term, Term)->Boolean): Equation<Term, Term>

Creates an Equation with provided left-hand and right-hand sides

Parameters

Name Description
lhs: A
rhs: B
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Equation<Term, Term>

of

fun <A : Term, B : Term> of(pair: Pair<A, B>, equalityChecker: (Term, Term)->Boolean): Equation<Term, Term>

Creates an Equation from given Pair

Parameters

Name Description
pair: Pair<A, B>
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Equation<Term, Term>

allOf

fun <A : Term, B : Term> allOf(pair: Pair<A, B>, equalityChecker: (Term, Term)->Boolean): Sequence><Equation<Term, Term>>

Creates all equations resulting from the deep inspection of given Pair of Terms

Parameters

Name Description
pair: Pair<A, B>
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Sequence><Equation<Term, Term>>

allOf

fun <A : Term, B : Term> allOf(lhs: A, rhs: B, equalityChecker: (Term, Term)->Boolean): Sequence><Equation<Term, Term>>

Creates all equations resulting from the deep inspection of provided left-hand and right-hand sides' Term

Parameters

Name Description
lhs: A
rhs: B
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Sequence><Equation<Term, Term>>