Lurch Deductive Engine

Module

Metavariables

This module defines a constant and function that formalize the concept of a "metavariable." See the documentation for the Matching module for a definition of metavariables and how they relate to the concept of matching.

See

Source

Members

staticconstant

metavariable

To facilitate marking some Symbols as metavariables (in contrast to any Symbol not so marked), we declare a string constant that can be used with the isA() and asA() and makeIntoA() functions in the MathConcept class.

For example, to mark a symbol A as a metavariable, one can import this module (call it M) and then call A.makeIntoA( M.metavariable ). You can later test to see if A is a metavariable with A.isA( M.metavariable ).

Note, however, that only Symbol instances can be used as metavariables by the matching module. Although you can mark any LogicConcept as a metavariable this way, it is useless to do so, and other functions in this module will not recognize non-Symbols as metavariables.

Source

Methods

static

containsAMetavariable(LC) → {boolean}

A pattern is an Expression that may contain a metavariable. Hence all Expressions are patterns, though an Expression without any metavariables is a pattern only in a degenerate sense. But sometimes we need to know we are working with an Expression that does not contain a metavariable, that is, a non-pattern expression. This function is useful for detecting that case.

Recall that a metavariable is any Symbol that has been marked as a metavariable as described in the documentation for metavariable.

Parameters

Returns

  • boolean

    true if and only if LC contains no metavariables

Source

static

metavariableNamesIn(LC) → {Set}

Find the collection of metavariables appearing in the given LogicConcept, considering only their names as strings, not distinguishing one instance of, say, $x$, from another. Thus the result of this function will be a set that may have fewer elements than the array that would be returned by metavariablesIn() if it were called on the same input.

Parameters

Returns

  • Set

    a JavaScript set of strings, each of which is the name of a metavariable appearing in the given LC

Source

static

metavariablesIn(LC) → {Array}

Find the ordered list of all descendants of the given LogicConcept that are metavariables. In contrast to metavariableNamesIn(), this function returns the actual Symbol instances, not just their string names, and thus this list might be longer than what metavariableNamesIn() would return on the same input.

Parameters

Returns

  • Array

    a JavaScript array of all Symbol instances that are descendants of the given LC and that pass the s.isA( metavariable ) test. Note that a LogicConcept is considered a descendant of itself. The results appear in tree traversal order.

Source