Members
LurchOptions
Lurch Options
We just use a global for storing the current options. This avoids having to
pass it as an optional argument through the entire validation chain of
interpretations and validation tools. To set an option just do e.g.
LurchOptions.avoidLoneMetavars = false. Current validation options are:
validateall- if true, validate all inferences. If false, only validate the target.checkPreemies- Check for preemies iff this is trueprocessBIHs- process BIHs iff this is trueinstantiateEverything- don't avoid anything below (equivalent to setting the next three settings to false)avoidLoneMetavars- if true don't try to instantiate lone metavariables, otherwise try to instantiate them with every user proposition.avoidLoneEFAs- the same thing for lone EFAsavoidLoneElementOfs- the same thing for lone x∈A's where A is a metavariableprocessChains- process chains and equations iff this is trueprocessEquations- process equations iff this is trueprocessCases- process the cases tool iff this is trueautoCases- similar to avoidLoneMetavars=false. If true, then identify all Cases-like rules and try to instantiate their univar conclusion with every user's conclusion in the document.processCAS- process CAS tool iff this is trueprocessAlgebra- use the CAS tool to validate equations followed by 'by algebra' iff this is trueswapTheoremProofPairs- move theorems after their next sibling if its a proofupdateProgress- the function that gives progress updates while instantiatingupdateFreq- how often to give a progress update during a passbadResultMsg- what the feedback message should be internally to expressions which are not found to be propositionally validrunStudentTests- use all of the student test files in the acid test suitestartStudentTest- the number of the first student test to runendStudentTest- the number of the last student test to run
Source
addIndex
Create a document index, add it to the document, and populate it. The second argument specifies the type of index to make. The types correspond to the various phases of processing.
Source
addLurchIndices
addLurchIndices
This routine populates the generic tree indexer with the index definition we
need for a Lurch document. It will usually be called by the addIndex(doc)
routine to create, define, and populate a document's index which can then be
accessed via doc.index.
Source
predictableStringify
A JSON stringification that is predictable. The standard JSON.stringify()
can produce different outputs unpredictably, because there is no required
ordering on the key-value pairs. This one requires keys to be output in
increasing string order, so it is predictable.
Source
Methods
deepCopyJson(json) → {*}
A deep copy of a JSON-encodable value, implemented as a direct recursion
rather than a JSON.stringify()/JSON.parse() round trip. This is on a
hot path (every MathConcept.copy() deep-copies its
attribute values through Map.deepCopy()), and the
recursive implementation is several times faster than serialization.
Parameters
-
json
*the structure to copy, which must be amenable to JSON encoding using
JSON.stringify()
Returns
-
*if the input is an object, this is a deep copy; if the input was atomic, this is the same atomic
Source
putdownSymbolText()
Render a symbol's text the way putdown does: unchanged if it contains no putdown delimiter or whitespace characters, and quoted with the appropriate escapes otherwise. This matches the Symbol case of toPutdown().