OMD Documentation

SimplificationEngine

The SimplificationEngine is a static class that provides a collection of helper methods for creating, matching, and transforming expression nodes. It forms the backbone of the simplification rule system.

Overview

The engine is not instantiated. Instead, its static methods are used directly by the simplification rules to perform their logic. The methods can be grouped into several categories:

Node Creation Helpers

These methods simplify the process of creating new nodes, often by abstracting away the underlying AST structure.

createConstant(value, fontSize)

createBinaryOp(left, operator, right, ...)

createMultiplication(leftConstantNode, rightNode, ...)

createRational(numerator, denominator, fontSize)

createMonomial(coefficient, variable, power, ...)

Pattern Matching Helpers

These methods are used within the match function of a simplification rule to determine if the rule applies to a given node.

isType(node, typeName)

isBinaryOp(node, operator)

isConstantValue(node, value)

hasConstantOperand(node)

unwrapParentheses(node)

Monomial and Like Terms Helpers

isMonomial(node)

areLikeTerms(monomial1, monomial2)

SimplificationRule Class

This is an inner class of SimplificationEngine that provides the blueprint for all simplification rules.

Constructor

new SimplificationRule(name, matchFn, transformFn, messageFn, type)

Key Methods

Rule Factory Functions

These are static methods on SimplificationEngine that create common types of rules.

createRule(...)

createConstantFoldRule(name, operator)

createIdentityRule(name, operator, identityValue, side)

createZeroMultiplicationRule()

See Also

↑ Top