Assignment

abstract class Assignment(val lhs: Term, val rhs: Term) : Equation

An equation assigning a Var to a Term, regardless of which side (lhs or rhs) the Var is on.

Inheritors

Constructors

Link copied to clipboard
constructor(lhs: Term, rhs: Term)

Properties

Link copied to clipboard
open override val isAssignment: Boolean

Whether this Equation is an Assignment (either LeftAssignment or RightAssignment).

Link copied to clipboard

Whether this Equation is a Comparison, i.e. still needs decomposing into sub-equations.

Link copied to clipboard

Whether this Equation is a Contradiction, i.e. represents unification failure.

Link copied to clipboard

Whether this Equation is an Identity, i.e. an equation between already-equal terms.

Link copied to clipboard

Whether this Equation is a LeftAssignment, i.e. shaped as Var = Term.

Link copied to clipboard

Whether this Equation is a RightAssignment, i.e. shaped as Term = Var.

Link copied to clipboard
open override val lhs: Term

The left-hand side of the equation

Link copied to clipboard
open override val rhs: Term

The right-hand side of the equation

Link copied to clipboard
abstract val term: Term

The Term being assigned to variable, i.e. the other side of the equation.

Link copied to clipboard
abstract val variable: Var

The Var being assigned, i.e. whichever of lhs/rhs is a variable.

Functions

Link copied to clipboard
fun apply(substitution: Substitution, equalityChecker: (Term, Term) -> Boolean = Term::equals): Equation

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

Link copied to clipboard
open fun <U : Equation> as(): U?
Link copied to clipboard
open override fun asAssignment(): Equation.Assignment

This Equation as an Assignment, or null if isAssignment is false.

Link copied to clipboard

This Equation as a Comparison, or null if isComparison is false.

Link copied to clipboard
Link copied to clipboard

This Equation as an Identity, or null if isIdentity is false.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun <U : Equation> castTo(): U
Link copied to clipboard

This Equation as an Assignment. @throws ClassCastException if isAssignment is false.

Link copied to clipboard

This Equation as a Comparison. @throws ClassCastException if isComparison is false.

Link copied to clipboard

This Equation as a Contradiction. @throws ClassCastException if isContradiction is false.

Link copied to clipboard

This Equation as an Identity. @throws ClassCastException if isIdentity is false.

Link copied to clipboard

This Equation as a LeftAssignment. @throws ClassCastException if isLeftAssignment is false.

Link copied to clipboard

This Equation as a RightAssignment. @throws ClassCastException if isRightAssignment is false.

Link copied to clipboard
abstract override fun clone(lhs: Term = this.lhs, rhs: Term = this.rhs): Equation.Assignment

Creates a copy of this Equation, of the same concrete subtype, with lhs and/or rhs replaced.

Link copied to clipboard
fun swap(): Equation

Creates a new Equation with lhs and rhs swapped, reclassifying it accordingly (see of).

Link copied to clipboard
open override fun toAssignmentPair(): Pair<Var, Term>

The (variable, term) pair this Equation assigns, i.e. its Var side paired with the other side.

Link copied to clipboard

Turns this Equation into a Contradiction with the same lhs and rhs, regardless of its actual shape.

Link copied to clipboard
open fun toPair(): Pair<Term, Term>

This Equation's lhs and rhs, as a Pair.

Link copied to clipboard
open override fun toSubstitution(): Substitution

The single-binding Substitution this Equation amounts to, i.e. its Var side unified with the other side.

Link copied to clipboard
open override fun toTerm(): Struct

Converts this Equation to its logical representation, the binary Struct lhs = rhs.