Equation

sealed class Equation: TermConvertible, 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 isIdentity: Boolean
open isAssignment: Boolean
open isComparison: Boolean
open isContradiction: Boolean
open lhs: Term

The left-hand side of the equation

open rhs: Term

The right-hand side of the equation

Methods

asIdentity

open fun asIdentity(): Identity?

ReturnValue

Name Description
Identity?

castToIdentity

fun castToIdentity(): Identity

ReturnValue

Name Description
Identity

asAssignment

open fun asAssignment(): Assignment?

ReturnValue

Name Description
Assignment?

castToAssignment

fun castToAssignment(): Assignment

ReturnValue

Name Description
Assignment

asComparison

open fun asComparison(): Comparison?

ReturnValue

Name Description
Comparison?

castToComparison

fun castToComparison(): Comparison

ReturnValue

Name Description
Comparison

asContradiction

open fun asContradiction(): Contradiction?

ReturnValue

Name Description
Contradiction?

castToContradiction

fun castToContradiction(): Contradiction

ReturnValue

Name Description
Contradiction

toTerm

open fun toTerm(): Struct

Converts this instance to a Prolog Term

ReturnValue

Name Description
Struct

toPair

open fun toPair(): Pair<Term, Term>

ReturnValue

Name Description
Pair<Term, Term>

swap

fun swap(): Equation

ReturnValue

Name Description
Equation

apply

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

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

Extensions

toAssignmentPair

fun Equation.toAssignmentPair(): Pair<Var, Term>

Receiver

Name Description
Equation

ReturnValue

Name Description
Pair<Var, Term>

toSubstitution

fun Equation.toSubstitution(): Unifier

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

Receiver

Name Description
Equation

ReturnValue

Name Description
Unifier

CompanionObject

Equation

sealed class Equation: TermConvertible, 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 of(lhs: Term, rhs: Term, equalityChecker: (Term, Term)->Boolean): Equation

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

Parameters

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

ReturnValue

Name Description
Equation

of

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

Creates an Equation from given Pair

Parameters

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

ReturnValue

Name Description
Equation

from

fun from(pairs: Sequence><Pair<Term, Term>>, equalityChecker: (Term, Term)->Boolean): Sequence<Equation>

Parameters

Name Description
pairs: Sequence><Pair<Term, Term>>
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Sequence<Equation>

from

fun from(pairs: Iterable<Pair<Term, Term>>, equalityChecker: (Term, Term)->Boolean): Sequence<Equation>

Parameters

Name Description
pairs: Iterable<Pair<Term, Term>>
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Sequence<Equation>

from

fun from(vararg pairs: Pair<Term, Term>, equalityChecker: (Term, Term)->Boolean): Sequence<Equation>

Parameters

Name Description
vararg pairs: Pair<Term, Term>
equalityChecker: (Term, Term)->Boolean

ReturnValue

Name Description
Sequence<Equation>

allOf

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

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

Parameters

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

ReturnValue

Name Description
Sequence<Equation>

allOf

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

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

Parameters

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

ReturnValue

Name Description
Sequence<Equation>