occam-verify-cli 1.0.747 → 1.0.757
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 +5 -10
- package/lib/context/scoped.js +6 -5
- package/lib/context/synthetic.js +7 -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 +111 -14
- package/lib/element/assertion/type.js +7 -7
- package/lib/element/assumption.js +21 -33
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +3 -7
- package/lib/element/constructor/bracketed.js +9 -8
- package/lib/element/constructor.js +9 -5
- package/lib/element/deduction.js +17 -20
- package/lib/element/derivation.js +4 -4
- 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 +65 -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 +7 -7
- package/lib/element/proofAssertion/premise.js +12 -18
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/proofAssertion/supposition.js +13 -19
- package/lib/element/property.js +2 -2
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/reference.js +11 -9
- package/lib/element/rule.js +2 -2
- package/lib/element/signature.js +3 -3
- package/lib/element/statement.js +100 -59
- package/lib/element/subDerivation.js +4 -4
- package/lib/element/subproof.js +7 -7
- 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 +73 -60
- package/lib/element/substitution/term.js +10 -10
- package/lib/element/term.js +17 -14
- package/lib/element/topLevelAssertion/axiom.js +15 -13
- package/lib/element/topLevelAssertion.js +2 -5
- package/lib/element/topLevelMetaAssertion.js +27 -3
- package/lib/element/type.js +2 -2
- package/lib/element/typePrefix.js +2 -2
- package/lib/element/variable.js +6 -3
- package/lib/process/unify.js +51 -9
- 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/releaseContext.js +3 -3
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/validation.js +13 -5
- package/package.json +3 -3
- package/src/context/branching.js +59 -0
- package/src/context/ephemeral.js +12 -0
- package/src/context/file/nominal.js +4 -12
- package/src/context/scoped.js +6 -4
- package/src/context/synthetic.js +9 -2
- package/src/context.js +14 -0
- package/src/element/assertion/contained.js +8 -8
- 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 +191 -18
- package/src/element/assertion/type.js +7 -7
- package/src/element/assumption.js +21 -52
- package/src/element/combinator.js +4 -4
- package/src/element/conclusion.js +3 -10
- package/src/element/constructor/bracketed.js +9 -7
- package/src/element/constructor.js +11 -5
- package/src/element/deduction.js +17 -23
- package/src/element/derivation.js +4 -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 +96 -32
- 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 +8 -8
- package/src/element/proofAssertion/premise.js +22 -32
- package/src/element/proofAssertion/step.js +3 -3
- package/src/element/proofAssertion/supposition.js +27 -36
- package/src/element/property.js +2 -2
- package/src/element/propertyRelation.js +3 -3
- package/src/element/reference.js +11 -9
- package/src/element/rule.js +2 -2
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +154 -88
- package/src/element/subDerivation.js +4 -3
- package/src/element/subproof.js +6 -6
- 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 +99 -76
- package/src/element/substitution/term.js +10 -10
- package/src/element/term.js +22 -16
- package/src/element/topLevelAssertion/axiom.js +20 -16
- package/src/element/topLevelAssertion.js +2 -4
- package/src/element/topLevelMetaAssertion.js +42 -3
- package/src/element/type.js +3 -2
- package/src/element/typePrefix.js +2 -2
- package/src/element/variable.js +12 -3
- package/src/process/unify.js +78 -9
- 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/releaseContext.js +1 -1
- package/src/utilities/string.js +3 -3
- package/src/utilities/validation.js +16 -4
package/src/element/statement.js
CHANGED
|
@@ -4,12 +4,12 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import { literally } from "../utilities/context";
|
|
8
7
|
import { unifyStatement } from "../process/unify";
|
|
9
8
|
import { validateStatements } from "../utilities/validation";
|
|
10
9
|
import { instantiateStatement } from "../process/instantiate";
|
|
10
|
+
import { reconcile, instantiate } from "../utilities/context";
|
|
11
11
|
|
|
12
|
-
const {
|
|
12
|
+
const { backwardsSome } = arrayUtilities;
|
|
13
13
|
|
|
14
14
|
export default define(class Statement extends Element {
|
|
15
15
|
getStatementNode() {
|
|
@@ -33,6 +33,14 @@ export default define(class Statement extends Element {
|
|
|
33
33
|
return singular;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
isEqualTo(statement) {
|
|
37
|
+
const statementNode = statement.getNode(),
|
|
38
|
+
statementNodeMatches = this.matchStatementNode(statementNode),
|
|
39
|
+
equalTo = statementNodeMatches; ///
|
|
40
|
+
|
|
41
|
+
return equalTo;
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
matchStatementNode(statementNode) {
|
|
37
45
|
const node = statementNode, ///
|
|
38
46
|
nodeMatches = this.matchNode(node),
|
|
@@ -41,6 +49,48 @@ export default define(class Statement extends Element {
|
|
|
41
49
|
return statementNodeMatches;
|
|
42
50
|
}
|
|
43
51
|
|
|
52
|
+
compareParameter(parameter) {
|
|
53
|
+
let comparesToParamter = false;
|
|
54
|
+
|
|
55
|
+
const singular = this.isSingular();
|
|
56
|
+
|
|
57
|
+
if (singular) {
|
|
58
|
+
const parameterName = parameter.getName();
|
|
59
|
+
|
|
60
|
+
if (parameterName !== null) {
|
|
61
|
+
const metavariableName = this.getMetavariableName();
|
|
62
|
+
|
|
63
|
+
if (parameterName === metavariableName) {
|
|
64
|
+
comparesToParamter = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return comparesToParamter;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
compareMetavariable(metavariable) {
|
|
73
|
+
let comparesToMetavariableName;
|
|
74
|
+
|
|
75
|
+
const singular = this.isSingular();
|
|
76
|
+
|
|
77
|
+
if (singular) {
|
|
78
|
+
let metavariableName;
|
|
79
|
+
|
|
80
|
+
metavariableName = metavariable.getName();
|
|
81
|
+
|
|
82
|
+
const metavariableNameA = metavariableName; ///
|
|
83
|
+
|
|
84
|
+
metavariableName = this.getMetavariableName();
|
|
85
|
+
|
|
86
|
+
const metavariableNameB = metavariableName; ///
|
|
87
|
+
|
|
88
|
+
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return comparesToMetavariableName;
|
|
92
|
+
}
|
|
93
|
+
|
|
44
94
|
compareMetavariableName(metavariableName) {
|
|
45
95
|
let comparesToMetavariableName = false;
|
|
46
96
|
|
|
@@ -59,6 +109,21 @@ export default define(class Statement extends Element {
|
|
|
59
109
|
return comparesToMetavariableName;
|
|
60
110
|
}
|
|
61
111
|
|
|
112
|
+
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
113
|
+
let comparesToSubproofOrProofAssertions;
|
|
114
|
+
|
|
115
|
+
comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
116
|
+
const statement = this, ///
|
|
117
|
+
subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
|
|
118
|
+
|
|
119
|
+
if (subproofOrProofAssertionComparesToStatement) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return comparesToSubproofOrProofAssertions;
|
|
125
|
+
}
|
|
126
|
+
|
|
62
127
|
findValidStatment(context) {
|
|
63
128
|
const statementNode = this.getStatementNode(),
|
|
64
129
|
statement = context.findStatementByStatementNode(statementNode),
|
|
@@ -67,14 +132,6 @@ export default define(class Statement extends Element {
|
|
|
67
132
|
return validStatement;
|
|
68
133
|
}
|
|
69
134
|
|
|
70
|
-
isEqualTo(statement) {
|
|
71
|
-
const statementNode = statement.getNode(),
|
|
72
|
-
statementNodeMatches = this.matchStatementNode(statementNode),
|
|
73
|
-
equalTo = statementNodeMatches; ///
|
|
74
|
-
|
|
75
|
-
return equalTo;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
135
|
isTermContained(term, context) {
|
|
79
136
|
let termContained;
|
|
80
137
|
|
|
@@ -127,48 +184,6 @@ export default define(class Statement extends Element {
|
|
|
127
184
|
return frameContained;
|
|
128
185
|
}
|
|
129
186
|
|
|
130
|
-
compareParameter(parameter) {
|
|
131
|
-
let comparesToParamter = false;
|
|
132
|
-
|
|
133
|
-
const singular = this.isSingular();
|
|
134
|
-
|
|
135
|
-
if (singular) {
|
|
136
|
-
const parameterName = parameter.getName();
|
|
137
|
-
|
|
138
|
-
if (parameterName !== null) {
|
|
139
|
-
const metavariableName = this.getMetavariableName();
|
|
140
|
-
|
|
141
|
-
if (parameterName === metavariableName) {
|
|
142
|
-
comparesToParamter = true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return comparesToParamter;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
compareMetavariable(metavariable) {
|
|
151
|
-
let comparesToMetavariableName;
|
|
152
|
-
|
|
153
|
-
const singular = this.isSingular();
|
|
154
|
-
|
|
155
|
-
if (singular) {
|
|
156
|
-
let metavariableName;
|
|
157
|
-
|
|
158
|
-
metavariableName = metavariable.getName();
|
|
159
|
-
|
|
160
|
-
const metavariableNameA = metavariableName; ///
|
|
161
|
-
|
|
162
|
-
metavariableName = this.getMetavariableName();
|
|
163
|
-
|
|
164
|
-
const metavariableNameB = metavariableName; ///
|
|
165
|
-
|
|
166
|
-
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return comparesToMetavariableName;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
187
|
validate(stated, context) {
|
|
173
188
|
let statement = null;
|
|
174
189
|
|
|
@@ -208,40 +223,60 @@ export default define(class Statement extends Element {
|
|
|
208
223
|
let subproofUnifies = false;
|
|
209
224
|
|
|
210
225
|
const statementNode = this.getStatementNode(),
|
|
211
|
-
subproofAssertionNode = statementNode.getSubproofAssertionNode()
|
|
212
|
-
assertionNode = subproofAssertionNode; ///
|
|
226
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
213
227
|
|
|
214
|
-
if (
|
|
228
|
+
if (subproofAssertionNode !== null) {
|
|
215
229
|
const context = generalContext, ///
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
subproofString = subproof.getString(),
|
|
231
|
+
statementString = this.getString();
|
|
218
232
|
|
|
219
|
-
|
|
220
|
-
subproofAssertionString = subproofAssertion.getString();
|
|
233
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${statementString}' statement...`);
|
|
221
234
|
|
|
222
|
-
context.
|
|
235
|
+
const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
223
236
|
|
|
224
|
-
|
|
225
|
-
subproofAssertionStatements = subproofAssertion.getStatements();
|
|
226
|
-
|
|
227
|
-
subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
|
|
228
|
-
const generalStatement = subproofAssertionStatement, ///
|
|
229
|
-
specificStatement = subproofStatement, ///
|
|
230
|
-
statementUnifies = unifyStatement(generalStatement, specificStatement, generalContext, specificContext);
|
|
231
|
-
|
|
232
|
-
if (statementUnifies) {
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
});
|
|
237
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
236
238
|
|
|
237
239
|
if (subproofUnifies) {
|
|
238
|
-
context.debug(`...unified the '${subproofString}' subproof with the '${
|
|
240
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${statementString}' statement.`);
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
return subproofUnifies;
|
|
243
245
|
}
|
|
244
246
|
|
|
247
|
+
unifyDeduction(deduction, generalContext, specificContext) {
|
|
248
|
+
let deductionUnifies = false;
|
|
249
|
+
|
|
250
|
+
const statementString = this.getString(), ///
|
|
251
|
+
deductionString = deduction.getString(),
|
|
252
|
+
deductionStatement = deduction.getStatement(),
|
|
253
|
+
deductionStatementString = deductionStatement.getString();
|
|
254
|
+
|
|
255
|
+
let context;
|
|
256
|
+
|
|
257
|
+
context = specificContext; ///
|
|
258
|
+
|
|
259
|
+
context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement...`);
|
|
260
|
+
|
|
261
|
+
context = deduction.getContext();
|
|
262
|
+
|
|
263
|
+
specificContext = context; ///
|
|
264
|
+
|
|
265
|
+
reconcile((specificContext) => {
|
|
266
|
+
const deductionStatementUnfies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
267
|
+
|
|
268
|
+
if (deductionStatementUnfies) {
|
|
269
|
+
deductionUnifies = true;
|
|
270
|
+
}
|
|
271
|
+
}, specificContext);
|
|
272
|
+
|
|
273
|
+
if (deductionUnifies) {
|
|
274
|
+
context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement.`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return deductionUnifies;
|
|
278
|
+
}
|
|
279
|
+
|
|
245
280
|
unifyStatement(statement, generalContext, specificContext) {
|
|
246
281
|
let statementUnifies;
|
|
247
282
|
|
|
@@ -274,13 +309,22 @@ export default define(class Statement extends Element {
|
|
|
274
309
|
definedAssertionNode = statementNode.getDefinedAssertionNode(),
|
|
275
310
|
containedAssertionNode = statementNode.getContainedAssertionNode();
|
|
276
311
|
|
|
277
|
-
if (
|
|
312
|
+
if (definedAssertionNode !== null) {
|
|
313
|
+
const context = generalContext, ///
|
|
314
|
+
definedAssertion = context.findAssertionByAssertionNode(definedAssertionNode),
|
|
315
|
+
definedAssertionUnifiesIndependently = definedAssertion.unifyIndependently(generalContext, specificContext);
|
|
316
|
+
|
|
317
|
+
if (definedAssertionUnifiesIndependently) {
|
|
318
|
+
unifiesIndependently = true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (containedAssertionNode !== null) {
|
|
278
323
|
const context = generalContext, ///
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
assertionUnifiesIndependently = assertion.unifyIndependently(generalContext, specificContext);
|
|
324
|
+
containedAssertion = context.findAssertionByAssertionNode(containedAssertionNode),
|
|
325
|
+
containedAssertionUnifiesIndependently = containedAssertion.unifyIndependently(generalContext, specificContext);
|
|
282
326
|
|
|
283
|
-
if (
|
|
327
|
+
if (containedAssertionUnifiesIndependently) {
|
|
284
328
|
unifiesIndependently = true;
|
|
285
329
|
}
|
|
286
330
|
}
|
|
@@ -292,19 +336,41 @@ export default define(class Statement extends Element {
|
|
|
292
336
|
return unifiesIndependently;
|
|
293
337
|
}
|
|
294
338
|
|
|
295
|
-
|
|
296
|
-
let
|
|
339
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
|
|
340
|
+
let topLevelMetaAssertionUnifies = false;
|
|
297
341
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
342
|
+
const context = specificContext, ///
|
|
343
|
+
statementString = this.getString(), ///
|
|
344
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
301
345
|
|
|
302
|
-
|
|
303
|
-
|
|
346
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement...`);
|
|
347
|
+
|
|
348
|
+
const topLevelMetaAssertionUnconditional = topLevelMetaAssertion.isUnconditional();
|
|
349
|
+
|
|
350
|
+
if (topLevelMetaAssertionUnconditional) {
|
|
351
|
+
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
352
|
+
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
353
|
+
|
|
354
|
+
if (deductionUnifies) {
|
|
355
|
+
topLevelMetaAssertionUnifies = true;
|
|
304
356
|
}
|
|
305
|
-
}
|
|
357
|
+
} else {
|
|
358
|
+
const statementNode = this.getStatementNode(),
|
|
359
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
306
360
|
|
|
307
|
-
|
|
361
|
+
if (subproofAssertionNode !== null) {
|
|
362
|
+
const context = generalContext, ///
|
|
363
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
364
|
+
|
|
365
|
+
topLevelMetaAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (topLevelMetaAssertionUnifies) {
|
|
370
|
+
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement.`);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return topLevelMetaAssertionUnifies;
|
|
308
374
|
}
|
|
309
375
|
|
|
310
376
|
toJSON() {
|
|
@@ -319,7 +385,7 @@ export default define(class Statement extends Element {
|
|
|
319
385
|
static name = "Statement";
|
|
320
386
|
|
|
321
387
|
static fromJSON(json, context) {
|
|
322
|
-
const statement =
|
|
388
|
+
const statement = instantiate((context) => {
|
|
323
389
|
const { string } = json,
|
|
324
390
|
statementNode = instantiateStatement(string, context),
|
|
325
391
|
node = statementNode; ///
|
|
@@ -26,11 +26,12 @@ export default define(class SubDerivation extends Element {
|
|
|
26
26
|
return subDerivationNode;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
getLastStep() {
|
|
30
30
|
const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
|
|
31
|
-
lastProofAssertion = lastSubproofOrProofAssertion
|
|
31
|
+
lastProofAssertion = lastSubproofOrProofAssertion, ///
|
|
32
|
+
lastStep = lastProofAssertion; ///
|
|
32
33
|
|
|
33
|
-
return
|
|
34
|
+
return lastStep;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
async verify(context) {
|
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
|
|
|
@@ -30,19 +30,19 @@ export default define(class Subproof extends Element {
|
|
|
30
30
|
return subproofNode;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
getLastStep() { return this.subDerivation.getLastStep(); }
|
|
34
34
|
|
|
35
35
|
getStatements() {
|
|
36
|
-
const
|
|
36
|
+
const lastStep = this.getLastStep(),
|
|
37
37
|
suppositionStatements = this.suppositions.map((supposition) => {
|
|
38
38
|
const suppositionStatement = supposition.getStatement();
|
|
39
39
|
|
|
40
40
|
return suppositionStatement;
|
|
41
41
|
}),
|
|
42
|
-
|
|
42
|
+
lastStepStatement = lastStep.getStatement(),
|
|
43
43
|
statements = [
|
|
44
44
|
...suppositionStatements,
|
|
45
|
-
|
|
45
|
+
lastStepStatement
|
|
46
46
|
];
|
|
47
47
|
|
|
48
48
|
return statements;
|
|
@@ -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),
|