occam-verify-cli 1.0.747 → 1.0.753
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/branching.js +56 -0
- package/lib/context/ephemeral.js +10 -1
- package/lib/context/file/nominal.js +1 -6
- package/lib/context/synthetic.js +3 -3
- package/lib/context.js +9 -1
- package/lib/element/assertion/contained.js +7 -7
- package/lib/element/assertion/defined.js +7 -7
- package/lib/element/assertion/property.js +3 -3
- package/lib/element/assertion/satisfies.js +2 -2
- package/lib/element/assertion/subproof.js +2 -2
- package/lib/element/assertion/type.js +7 -7
- package/lib/element/assumption.js +2 -2
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +3 -3
- package/lib/element/constructor/bracketed.js +9 -8
- package/lib/element/constructor.js +9 -5
- package/lib/element/deduction.js +3 -3
- package/lib/element/equality.js +12 -11
- package/lib/element/equivalence.js +3 -3
- package/lib/element/frame.js +2 -2
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +2 -2
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +59 -25
- package/lib/element/parameter.js +2 -2
- package/lib/element/procedureCall.js +2 -2
- package/lib/element/procedureReference.js +2 -2
- package/lib/element/proof.js +2 -2
- package/lib/element/proofAssertion/premise.js +5 -5
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/proofAssertion/supposition.js +5 -5
- package/lib/element/property.js +2 -2
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/reference.js +2 -2
- package/lib/element/rule.js +2 -2
- package/lib/element/signature.js +3 -3
- package/lib/element/statement.js +2 -2
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +8 -8
- package/lib/element/substitution/metaLevel.js +7 -7
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +17 -21
- package/lib/element/substitution/term.js +10 -10
- package/lib/element/term.js +17 -14
- package/lib/element/topLevelAssertion.js +2 -2
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/type.js +2 -2
- package/lib/element/typePrefix.js +2 -2
- package/lib/element/variable.js +4 -3
- package/lib/process/unify.js +11 -7
- package/lib/process/validate.js +5 -5
- package/lib/utilities/context.js +28 -20
- package/lib/utilities/element.js +2 -2
- package/lib/utilities/instance.js +3 -3
- package/lib/utilities/validation.js +13 -5
- package/package.json +1 -1
- package/src/context/branching.js +59 -0
- package/src/context/ephemeral.js +12 -0
- package/src/context/file/nominal.js +0 -8
- package/src/context/synthetic.js +3 -2
- package/src/context.js +14 -0
- package/src/element/assertion/contained.js +7 -7
- package/src/element/assertion/defined.js +7 -7
- package/src/element/assertion/property.js +4 -4
- package/src/element/assertion/satisfies.js +2 -2
- package/src/element/assertion/subproof.js +2 -2
- package/src/element/assertion/type.js +7 -7
- package/src/element/assumption.js +2 -2
- package/src/element/combinator.js +4 -4
- package/src/element/conclusion.js +3 -3
- package/src/element/constructor/bracketed.js +9 -7
- package/src/element/constructor.js +11 -5
- package/src/element/deduction.js +3 -3
- package/src/element/equality.js +16 -14
- package/src/element/equivalence.js +3 -3
- package/src/element/frame.js +2 -2
- package/src/element/hypothesis.js +2 -2
- package/src/element/judgement.js +2 -2
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +81 -30
- package/src/element/parameter.js +2 -2
- package/src/element/procedureCall.js +2 -2
- package/src/element/procedureReference.js +2 -2
- package/src/element/proof.js +2 -2
- package/src/element/proofAssertion/premise.js +5 -5
- package/src/element/proofAssertion/step.js +3 -3
- package/src/element/proofAssertion/supposition.js +5 -5
- package/src/element/property.js +2 -2
- package/src/element/propertyRelation.js +3 -3
- package/src/element/reference.js +2 -2
- package/src/element/rule.js +2 -2
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +2 -2
- package/src/element/subproof.js +2 -2
- package/src/element/substitution/frame.js +8 -8
- package/src/element/substitution/metaLevel.js +7 -7
- package/src/element/substitution/reference.js +7 -7
- package/src/element/substitution/statement.js +17 -24
- package/src/element/substitution/term.js +10 -10
- package/src/element/term.js +22 -16
- package/src/element/topLevelAssertion.js +2 -2
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/element/type.js +3 -2
- package/src/element/typePrefix.js +2 -2
- package/src/element/variable.js +7 -3
- package/src/process/unify.js +15 -8
- package/src/process/validate.js +4 -4
- package/src/utilities/context.js +20 -12
- package/src/utilities/element.js +2 -2
- package/src/utilities/instance.js +3 -3
- package/src/utilities/validation.js +16 -4
|
@@ -6,7 +6,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { unifyStatements } from "../../utilities/unification";
|
|
9
|
-
import { attempt,
|
|
9
|
+
import { attempt, asyncReconcile } from "../../utilities/context";
|
|
10
10
|
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
11
11
|
|
|
12
12
|
const { asyncSome } = asynchronousUtilities;
|
|
@@ -117,7 +117,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
117
117
|
const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
|
|
118
118
|
|
|
119
119
|
if (satisfiesAssertioValidates) {
|
|
120
|
-
|
|
120
|
+
context.commit(this);
|
|
121
121
|
|
|
122
122
|
validates = true;
|
|
123
123
|
}
|
|
@@ -190,7 +190,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
190
190
|
reference = this.getReference(),
|
|
191
191
|
satisfiesAssertion = this.getSatisfiesAssertion();
|
|
192
192
|
|
|
193
|
-
await
|
|
193
|
+
await asyncReconcile(async (context) => {
|
|
194
194
|
await asyncSome(unifyStatements, async (unifyStatement) => {
|
|
195
195
|
const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
196
196
|
|
|
@@ -4,7 +4,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateSupposition} from "../../process/instantiate";
|
|
7
|
-
import { attempt,
|
|
7
|
+
import { attempt, reconcile, instantiate } from "../../utilities/context";
|
|
8
8
|
import { statementFromSuppositionNode, procedureCallFromSuppositionNode } from "../../utilities/element";
|
|
9
9
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
|
|
10
10
|
|
|
@@ -72,7 +72,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
72
72
|
const statementValidates = this.validateStatement(context);
|
|
73
73
|
|
|
74
74
|
if (statementValidates) {
|
|
75
|
-
|
|
75
|
+
context.commit(this);
|
|
76
76
|
|
|
77
77
|
validates = true;
|
|
78
78
|
}
|
|
@@ -82,7 +82,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
82
82
|
const procedureCallValidates = this.validateProcedureCall(context);
|
|
83
83
|
|
|
84
84
|
if (procedureCallValidates) {
|
|
85
|
-
|
|
85
|
+
context.commit(this);
|
|
86
86
|
|
|
87
87
|
validates = true;
|
|
88
88
|
}
|
|
@@ -190,7 +190,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
190
190
|
suppositionContext = this.getContext(),
|
|
191
191
|
generalContext = suppositionContext, ///
|
|
192
192
|
specificContext = proofAssertionContext,
|
|
193
|
-
statementUnifies =
|
|
193
|
+
statementUnifies = reconcile((specificContext) => {
|
|
194
194
|
const statement = proofAssertion.getStatement(),
|
|
195
195
|
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
196
196
|
|
|
@@ -321,7 +321,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
321
321
|
|
|
322
322
|
context = ephemeralContext; ///
|
|
323
323
|
|
|
324
|
-
const supposition =
|
|
324
|
+
const supposition = instantiate((context) => {
|
|
325
325
|
const { string } = json,
|
|
326
326
|
suppositionNode = instantiateSupposition(string, context),
|
|
327
327
|
node = suppositionNode, ///
|
package/src/element/property.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateProperty } from "../process/instantiate";
|
|
8
8
|
import { nameFromPropertyNode } from "../utilities/element";
|
|
9
9
|
import { nominalTypeNameFromJSON, nominalTypeNameToNominalTypeNameJSON } from "../utilities/json";
|
|
@@ -58,7 +58,7 @@ export default define(class Property extends Element {
|
|
|
58
58
|
static name = "Property";
|
|
59
59
|
|
|
60
60
|
static fromJSON(json, context) {
|
|
61
|
-
const property =
|
|
61
|
+
const property = instantiate((context) => {
|
|
62
62
|
const { string } = json,
|
|
63
63
|
propertyNode = instantiateProperty(string, context),
|
|
64
64
|
node = propertyNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiatePropertyRelation } from "../process/instantiate";
|
|
8
8
|
import { propertyFromPropertyRelationNode } from "../utilities/element";
|
|
9
9
|
|
|
@@ -59,7 +59,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
59
59
|
|
|
60
60
|
context.trace(`Validating the '${termString}' term...`);
|
|
61
61
|
|
|
62
|
-
const term = this.term.validate(context, () => {
|
|
62
|
+
const term = this.term.validate(context, (term) => {
|
|
63
63
|
const validatesForwards = true;
|
|
64
64
|
|
|
65
65
|
return validatesForwards;
|
|
@@ -124,7 +124,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
static fromJSON(json, context) {
|
|
127
|
-
const propertyRelation =
|
|
127
|
+
const propertyRelation = instantiate((context) => {
|
|
128
128
|
const { string } = json,
|
|
129
129
|
propertyRelationNode = instantiatePropertyRelation(string, context),
|
|
130
130
|
node = propertyRelationNode, ///
|
package/src/element/reference.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateReference } from "../process/instantiate";
|
|
8
8
|
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
9
|
import { metavariableFromReferenceNode } from "../utilities/element";
|
|
@@ -282,7 +282,7 @@ export default define(class Reference extends Element {
|
|
|
282
282
|
static name = "Reference";
|
|
283
283
|
|
|
284
284
|
static fromJSON(json, context) {
|
|
285
|
-
const reference =
|
|
285
|
+
const reference = instantiate((context) => {
|
|
286
286
|
const { string } = json,
|
|
287
287
|
referenceNode = instantiateReference(string, context),
|
|
288
288
|
node = referenceNode, ///
|
package/src/element/rule.js
CHANGED
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { asyncRestrict } from "../utilities/context";
|
|
8
8
|
import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
10
|
const { reverse, extract } = arrayUtilities,
|
|
@@ -88,7 +88,7 @@ export default define(class Rule extends Element {
|
|
|
88
88
|
|
|
89
89
|
context.trace(`Verifying the '${ruleString}' rule...`);
|
|
90
90
|
|
|
91
|
-
await
|
|
91
|
+
await asyncRestrict(async (context) => {
|
|
92
92
|
const labelsVerify = this.verifyLabels();
|
|
93
93
|
|
|
94
94
|
if (labelsVerify) {
|
package/src/element/signature.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { instantiate } from "../utilities/context";
|
|
8
8
|
import { instantiateSignature } from "../process/instantiate";
|
|
9
9
|
import { termsFromSignatureNode } from "../utilities/element";
|
|
10
10
|
|
|
@@ -79,7 +79,7 @@ export default define(class Signature extends Element {
|
|
|
79
79
|
|
|
80
80
|
context.trace(`Validating the '${signatureString}' signature's '${termString}' term...`);
|
|
81
81
|
|
|
82
|
-
term = term.validate(context, () => { ///
|
|
82
|
+
term = term.validate(context, (term) => { ///
|
|
83
83
|
const validatesForwards = true;
|
|
84
84
|
|
|
85
85
|
return validatesForwards;
|
|
@@ -225,7 +225,7 @@ export default define(class Signature extends Element {
|
|
|
225
225
|
static name = "Signature";
|
|
226
226
|
|
|
227
227
|
static fromJSON(json, context) {
|
|
228
|
-
const signature =
|
|
228
|
+
const signature = instantiate((context) => {
|
|
229
229
|
const { string } = json,
|
|
230
230
|
signatureNode = instantiateSignature(string, context),
|
|
231
231
|
node = signatureNode, ///
|
package/src/element/statement.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { instantiate } from "../utilities/context";
|
|
8
8
|
import { unifyStatement } from "../process/unify";
|
|
9
9
|
import { validateStatements } from "../utilities/validation";
|
|
10
10
|
import { instantiateStatement } from "../process/instantiate";
|
|
@@ -319,7 +319,7 @@ export default define(class Statement extends Element {
|
|
|
319
319
|
static name = "Statement";
|
|
320
320
|
|
|
321
321
|
static fromJSON(json, context) {
|
|
322
|
-
const statement =
|
|
322
|
+
const statement = instantiate((context) => {
|
|
323
323
|
const { string } = json,
|
|
324
324
|
statementNode = instantiateStatement(string, context),
|
|
325
325
|
node = statementNode; ///
|
package/src/element/subproof.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { asyncRestrict } from "../utilities/context";
|
|
7
7
|
|
|
8
8
|
const { asyncEvery } = asynchronousUtilities;
|
|
9
9
|
|
|
@@ -63,7 +63,7 @@ export default define(class Subproof extends Element {
|
|
|
63
63
|
async verify(context) {
|
|
64
64
|
let verifies = false;
|
|
65
65
|
|
|
66
|
-
await
|
|
66
|
+
await asyncRestrict(async (context) => {
|
|
67
67
|
const suppositionsVerify = await this.verifySuppositions(context);
|
|
68
68
|
|
|
69
69
|
if (suppositionsVerify) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
9
9
|
import { frameSubstitutionFromStatementNode, frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
@@ -121,7 +121,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
121
121
|
targetFrameString = this.targetFrame.getString(),
|
|
122
122
|
frameSubstitutionString = this.getString(); ///
|
|
123
123
|
|
|
124
|
-
context.trace(`Validating the '${frameSubstitutionString}' frame
|
|
124
|
+
context.trace(`Validating the '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame...`);
|
|
125
125
|
|
|
126
126
|
const targetFrameSingular = this.targetFrame.isSingular();
|
|
127
127
|
|
|
@@ -135,11 +135,11 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
135
135
|
targetFrameValidates = true;
|
|
136
136
|
}
|
|
137
137
|
} else {
|
|
138
|
-
context.debug(`The '${frameSubstitutionString}' frame
|
|
138
|
+
context.debug(`The '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame is not singular.`);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if (targetFrameValidates) {
|
|
142
|
-
context.debug(`...validated the '${frameSubstitutionString}' frame
|
|
142
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame...`);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return targetFrameValidates;
|
|
@@ -152,7 +152,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
152
152
|
replacementFrameString = this.replacementFrame.getString(),
|
|
153
153
|
frameSubstitutionString = this.getString(); ///
|
|
154
154
|
|
|
155
|
-
context.trace(`Validating the '${frameSubstitutionString}' frame
|
|
155
|
+
context.trace(`Validating the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame...`);
|
|
156
156
|
|
|
157
157
|
const stated = true,
|
|
158
158
|
replacementFrame = this.replacementFrame.validate(stated, context);
|
|
@@ -164,7 +164,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
if (replacementFrameValidates) {
|
|
167
|
-
context.debug(`...validated the '${frameSubstitutionString}' frame
|
|
167
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame.`);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
return replacementFrameValidates;
|
|
@@ -178,7 +178,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
178
178
|
const { name } = json;
|
|
179
179
|
|
|
180
180
|
if (this.name === name) {
|
|
181
|
-
|
|
181
|
+
instantiate((context) => {
|
|
182
182
|
const { string } = json,
|
|
183
183
|
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
184
184
|
node = frameSubstitutionNode, ///
|
|
@@ -202,7 +202,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
static fromFrameAndMetavariable(frame, metavariable, context) {
|
|
205
|
-
return
|
|
205
|
+
return instantiate((context) => {
|
|
206
206
|
const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
|
|
207
207
|
string = frameSubstitutionString, ///
|
|
208
208
|
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateMetaLevelSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { metaLevelSubstitutionFromMetaLevelSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { metaLevelSubstitutionStringFromStatementAndReference } from "../../utilities/string";
|
|
@@ -111,7 +111,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
111
111
|
targetReferenceString = this.targetReference.getString(),
|
|
112
112
|
metaLevelSubstitutionString = this.getString(); ///
|
|
113
113
|
|
|
114
|
-
context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level
|
|
114
|
+
context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level substitution's '${targetReferenceString}' target reference...`);
|
|
115
115
|
|
|
116
116
|
const targetReference = this.targetReference.validate(context);
|
|
117
117
|
|
|
@@ -120,7 +120,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
if (targetReferenceValidates) {
|
|
123
|
-
context.debug(`...validated the '${metaLevelSubstitutionString}' meta-level
|
|
123
|
+
context.debug(`...validated the '${metaLevelSubstitutionString}' meta-level substitution's '${targetReferenceString}' target reference...`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
return targetReferenceValidates;
|
|
@@ -133,7 +133,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
133
133
|
replacementStatementString = this.replacementStatement.getString(),
|
|
134
134
|
metaLevelSubstitutionString = this.getString(); ///
|
|
135
135
|
|
|
136
|
-
context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level
|
|
136
|
+
context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level substitution's '${replacementStatementString}' replacement statement...`);
|
|
137
137
|
|
|
138
138
|
const stated = true,
|
|
139
139
|
replacementStatement = this.replacementStatement.validate(stated, context);
|
|
@@ -143,7 +143,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
if (replacementStatementValidates) {
|
|
146
|
-
context.debug(`...validated the '${metaLevelSubstitutionString}' meta-level
|
|
146
|
+
context.debug(`...validated the '${metaLevelSubstitutionString}' meta-level substitution's '${replacementStatementString}' replacement statement.`);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
return replacementStatementValidates;
|
|
@@ -176,7 +176,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
176
176
|
|
|
177
177
|
context = ephemeralContext; ///
|
|
178
178
|
|
|
179
|
-
const metaLevelSubstitution =
|
|
179
|
+
const metaLevelSubstitution = instantiate((context) => {
|
|
180
180
|
const { string } = json,
|
|
181
181
|
metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
|
|
182
182
|
targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
|
|
@@ -191,7 +191,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
static fromStatementAndReference(statement, reference, context) {
|
|
194
|
-
return
|
|
194
|
+
return instantiate((context) => {
|
|
195
195
|
const metaLevelSubstitutionString = metaLevelSubstitutionStringFromStatementAndReference(statement, reference),
|
|
196
196
|
string = metaLevelSubstitutionString, ///
|
|
197
197
|
metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
@@ -121,7 +121,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
121
121
|
targetReferenceString = this.targetReference.getString(),
|
|
122
122
|
referenceSubstitutionString = this.getString(); ///
|
|
123
123
|
|
|
124
|
-
context.trace(`Validating the '${referenceSubstitutionString}' reference
|
|
124
|
+
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's '${targetReferenceString}' target reference...`);
|
|
125
125
|
|
|
126
126
|
const targetReference = this.targetReference.validate(context);
|
|
127
127
|
|
|
@@ -130,7 +130,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
if (targetReferenceValidates) {
|
|
133
|
-
context.debug(`...validated the '${referenceSubstitutionString}' reference
|
|
133
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution's '${targetReferenceString}' target reference...`);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
return targetReferenceValidates;
|
|
@@ -143,7 +143,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
143
143
|
replacementReferenceString = this.replacementReference.getString(),
|
|
144
144
|
referenceSubstitutionString = this.getString(); ///
|
|
145
145
|
|
|
146
|
-
context.trace(`Validating the '${referenceSubstitutionString}' reference
|
|
146
|
+
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's '${replacementReferenceString}' replacement reference...`);
|
|
147
147
|
|
|
148
148
|
const replacementReference = this.replacementReference.validate(context);
|
|
149
149
|
|
|
@@ -152,7 +152,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
if (replacementReferenceValidates) {
|
|
155
|
-
context.debug(`...validated the '${referenceSubstitutionString}' reference
|
|
155
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution's '${replacementReferenceString}' replacement reference.`);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
return replacementReferenceValidates;
|
|
@@ -166,7 +166,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
166
166
|
const { name } = json;
|
|
167
167
|
|
|
168
168
|
if (this.name === name) {
|
|
169
|
-
|
|
169
|
+
instantiate((context) => {
|
|
170
170
|
const { string } = json,
|
|
171
171
|
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
172
172
|
node = referenceSubstitutionNode, ///
|
|
@@ -183,7 +183,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
static fromReferenceAndMetavariable(reference, metavariable, context) {
|
|
186
|
-
return
|
|
186
|
+
return instantiate((context) => {
|
|
187
187
|
const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
|
|
188
188
|
string = referenceSubstitutionString, ///
|
|
189
189
|
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
@@ -4,9 +4,9 @@ import Substitution from "../substitution";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { unifySubstitution } from "../../process/unify";
|
|
7
|
+
import { join, reconcile, instantiate } from "../../utilities/context";
|
|
7
8
|
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
8
9
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
9
|
-
import { liminally, literally, synthetically } from "../../utilities/context";
|
|
10
10
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
11
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
12
|
|
|
@@ -156,7 +156,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
156
156
|
targetStatementString = this.targetStatement.getString(),
|
|
157
157
|
statementSubstitutionString = this.getString(); ///
|
|
158
158
|
|
|
159
|
-
context.trace(`Validating the '${statementSubstitutionString}' statement
|
|
159
|
+
context.trace(`Validating the '${statementSubstitutionString}' statement substitution's '${targetStatementString}' target statement...`);
|
|
160
160
|
|
|
161
161
|
const targetStatementSingular = this.targetStatement.isSingular();
|
|
162
162
|
|
|
@@ -168,11 +168,11 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
168
168
|
targetStatementValidates = true;
|
|
169
169
|
}
|
|
170
170
|
} else {
|
|
171
|
-
context.debug(`The '${statementSubstitutionString}' statement
|
|
171
|
+
context.debug(`The '${statementSubstitutionString}' statement substitution's '${targetStatementString}' target statement is not singular.`);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
if (targetStatementValidates) {
|
|
175
|
-
context.debug(`...validated the '${statementSubstitutionString}' statement
|
|
175
|
+
context.debug(`...validated the '${statementSubstitutionString}' statement substitution's '${targetStatementString}' target statement...`);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
return targetStatementValidates;
|
|
@@ -185,7 +185,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
185
185
|
replacementStatementString = this.replacementStatement.getString(),
|
|
186
186
|
statementSubstitutionString = this.getString(); ///
|
|
187
187
|
|
|
188
|
-
context.trace(`Validating the '${statementSubstitutionString}' statement
|
|
188
|
+
context.trace(`Validating the '${statementSubstitutionString}' statement substitution's '${replacementStatementString}' replacement statement...`);
|
|
189
189
|
|
|
190
190
|
const stated = true,
|
|
191
191
|
replacementStatement = this.replacementStatement.validate(stated, context);
|
|
@@ -195,7 +195,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
if (replacementStatementValidates) {
|
|
198
|
-
context.debug(`...validated the '${statementSubstitutionString}' statement
|
|
198
|
+
context.debug(`...validated the '${statementSubstitutionString}' statement substitution's '${replacementStatementString}' replacement statement.`);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
return replacementStatementValidates;
|
|
@@ -262,7 +262,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
262
262
|
if (simpleSubstitution !== null) {
|
|
263
263
|
context = this.getContext();
|
|
264
264
|
|
|
265
|
-
const
|
|
265
|
+
const substitution = reconcile((context) => {
|
|
266
266
|
let substitution = null;
|
|
267
267
|
|
|
268
268
|
const specificContext = context; ///
|
|
@@ -285,29 +285,22 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
285
285
|
return substitution;
|
|
286
286
|
}, context);
|
|
287
287
|
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
context = simpleSubstitution.getContext();
|
|
293
|
-
|
|
294
|
-
contexts.push(context);
|
|
295
|
-
|
|
296
|
-
context = this.getContext();
|
|
297
|
-
|
|
298
|
-
contexts.push(context);
|
|
288
|
+
if (substitution !== null) {
|
|
289
|
+
reconcile((specificContext) => {
|
|
290
|
+
const complexContext = this.getContext(), ///
|
|
291
|
+
simpleContext = simpleSubstitution.getContext(); ///
|
|
299
292
|
|
|
300
293
|
context = specificContext; ///
|
|
301
294
|
|
|
302
|
-
|
|
295
|
+
join((context) => {
|
|
303
296
|
const specificContext = context; ///
|
|
304
297
|
|
|
305
298
|
context = this.substitution.getContext();
|
|
306
299
|
|
|
307
300
|
const generalContext = context; ///
|
|
308
301
|
|
|
309
|
-
this.unifySubstitution(
|
|
310
|
-
},
|
|
302
|
+
this.unifySubstitution(substitution, generalContext, specificContext);
|
|
303
|
+
}, complexContext, simpleContext, context);
|
|
311
304
|
|
|
312
305
|
specificContext.commit();
|
|
313
306
|
}, specificContext);
|
|
@@ -329,7 +322,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
329
322
|
const { name } = json;
|
|
330
323
|
|
|
331
324
|
if (this.name === name) {
|
|
332
|
-
|
|
325
|
+
instantiate((context) => {
|
|
333
326
|
const { string } = json,
|
|
334
327
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
335
328
|
node = statementSubstitutionNode, ///
|
|
@@ -348,7 +341,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
348
341
|
static fromStatementAndMetavariable(statement, metavariable, context) {
|
|
349
342
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
350
343
|
|
|
351
|
-
return
|
|
344
|
+
return instantiate((context) => {
|
|
352
345
|
const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
|
|
353
346
|
string = statementSubstitutionString, ///
|
|
354
347
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
@@ -361,7 +354,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
361
354
|
static fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) {
|
|
362
355
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
363
356
|
|
|
364
|
-
return
|
|
357
|
+
return instantiate((context) => {
|
|
365
358
|
const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
|
|
366
359
|
string = statementSubstitutionString, ///
|
|
367
360
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { stripBracketsFromTerm } from "../../utilities/brackets";
|
|
8
8
|
import { instantiateTermSubstitution } from "../../process/instantiate";
|
|
9
9
|
import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
|
|
@@ -124,12 +124,12 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
124
124
|
targetTermString = this.targetTerm.getString(),
|
|
125
125
|
termSubstitutionString = this.getString(); ///
|
|
126
126
|
|
|
127
|
-
context.trace(`Validating the '${termSubstitutionString}' term
|
|
127
|
+
context.trace(`Validating the '${termSubstitutionString}' term substitution's '${targetTermString}' target term...`);
|
|
128
128
|
|
|
129
129
|
const targetTermSingular = this.targetTerm.isSingular();
|
|
130
130
|
|
|
131
131
|
if (targetTermSingular) {
|
|
132
|
-
const targetTerm = this.targetTerm.validate(context, () => {
|
|
132
|
+
const targetTerm = this.targetTerm.validate(context, (targetTerm) => {
|
|
133
133
|
const validatesForwards = true;
|
|
134
134
|
|
|
135
135
|
return validatesForwards;
|
|
@@ -141,11 +141,11 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
141
141
|
targetTermValidates = true;
|
|
142
142
|
}
|
|
143
143
|
} else {
|
|
144
|
-
context.debug(`The '${termSubstitutionString}' term
|
|
144
|
+
context.debug(`The '${termSubstitutionString}' term substitution's '${targetTermString}' target term is not singular.`);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (targetTermValidates) {
|
|
148
|
-
context.debug(`...validated the '${termSubstitutionString}' term
|
|
148
|
+
context.debug(`...validated the '${termSubstitutionString}' term substitution's '${targetTermString}' target term...`);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
return targetTermValidates;
|
|
@@ -158,9 +158,9 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
158
158
|
replacementTermString = this.replacementTerm.getString(),
|
|
159
159
|
termSubstitutionString = this.getString(); ///
|
|
160
160
|
|
|
161
|
-
context.trace(`Validating the '${termSubstitutionString}' term
|
|
161
|
+
context.trace(`Validating the '${termSubstitutionString}' term substitution's '${replacementTermString}' replacement term...`);
|
|
162
162
|
|
|
163
|
-
const replacementTerm = this.replacementTerm.validate(context, () => {
|
|
163
|
+
const replacementTerm = this.replacementTerm.validate(context, (replacementTerm) => {
|
|
164
164
|
const validatesForwards = true;
|
|
165
165
|
|
|
166
166
|
return validatesForwards;
|
|
@@ -173,7 +173,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (replacementTermValidates) {
|
|
176
|
-
context.debug(`...validated the '${termSubstitutionString}' term
|
|
176
|
+
context.debug(`...validated the '${termSubstitutionString}' term substitution's '${replacementTermString}' replacement term...`);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
return replacementTermValidates;
|
|
@@ -187,7 +187,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
187
187
|
const { name } = json;
|
|
188
188
|
|
|
189
189
|
if (this.name === name) {
|
|
190
|
-
|
|
190
|
+
instantiate((context) => {
|
|
191
191
|
const { string } = json,
|
|
192
192
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|
|
193
193
|
node = termSubstitutionNode, ///
|
|
@@ -213,7 +213,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
213
213
|
static fromTermAndVariable(term, variable, context) {
|
|
214
214
|
term = stripBracketsFromTerm(term, context); ///
|
|
215
215
|
|
|
216
|
-
return
|
|
216
|
+
return instantiate((context) => {
|
|
217
217
|
const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
|
|
218
218
|
string = termSubstitutionString, ///
|
|
219
219
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|