occam-verify-cli 1.0.950 → 1.0.955
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/aphasic.js +27 -0
- package/lib/context/ephemeral.js +28 -0
- package/lib/context/liminal.js +2 -2
- package/lib/context/synoptic.js +6 -2
- package/lib/element/assertion/signature.js +2 -2
- package/lib/element/assertion/subproof.js +1 -1
- package/lib/element/conclusion.js +2 -2
- package/lib/element/deduction.js +2 -2
- package/lib/element/label.js +8 -6
- package/lib/element/metavariable.js +3 -3
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/reference.js +7 -5
- package/lib/element/signature.js +7 -5
- package/lib/element/substitution/frame.js +75 -4
- package/lib/element/substitution/reference.js +3 -3
- package/lib/element/substitution/statement.js +53 -58
- package/lib/element/substitution/term.js +75 -4
- package/lib/element/substitution.js +1 -5
- package/lib/element/variable.js +2 -2
- package/lib/process/unify.js +2 -51
- package/lib/utilities/context.js +44 -12
- package/package.json +1 -1
- package/src/context/aphasic.js +15 -0
- package/src/context/ephemeral.js +17 -0
- package/src/context/liminal.js +1 -1
- package/src/context/synoptic.js +9 -1
- package/src/element/assertion/signature.js +1 -1
- package/src/element/assertion/subproof.js +1 -1
- package/src/element/conclusion.js +2 -2
- package/src/element/deduction.js +2 -2
- package/src/element/label.js +9 -7
- package/src/element/metavariable.js +2 -2
- package/src/element/proofAssertion/step.js +3 -2
- package/src/element/reference.js +8 -6
- package/src/element/signature.js +8 -6
- package/src/element/substitution/frame.js +137 -3
- package/src/element/substitution/reference.js +3 -3
- package/src/element/substitution/statement.js +84 -83
- package/src/element/substitution/term.js +137 -4
- package/src/element/substitution.js +0 -6
- package/src/element/variable.js +1 -1
- package/src/process/unify.js +0 -76
- package/src/utilities/context.js +61 -18
|
@@ -127,9 +127,10 @@ export default define(class Step extends ProofAssertion {
|
|
|
127
127
|
|
|
128
128
|
context.trace(`Validating the '${stepString}' step...`);
|
|
129
129
|
|
|
130
|
-
const qualified = this.isQualified()
|
|
130
|
+
const qualified = this.isQualified(),
|
|
131
|
+
stated = qualified; ///
|
|
131
132
|
|
|
132
|
-
(
|
|
133
|
+
(stated ? declare : derive)((context) => {
|
|
133
134
|
attempt((context) => {
|
|
134
135
|
const statementValidates = this.validateStatement(context);
|
|
135
136
|
|
package/src/element/reference.js
CHANGED
|
@@ -6,7 +6,7 @@ import { define } from "../elements";
|
|
|
6
6
|
import { instantiateReference } from "../process/instantiate";
|
|
7
7
|
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
8
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
9
|
-
import { join, ablate, attempt, serialise, reconcile, unserialise, instantiate } from "../utilities/context";
|
|
9
|
+
import { join, posit, ablate, attempt, serialise, reconcile, unserialise, instantiate } from "../utilities/context";
|
|
10
10
|
import { referenceFromReferenceNode, metavariableFromReferenceNode, topLevelMetaAssertionFromReferenceNode } from "../utilities/element";
|
|
11
11
|
|
|
12
12
|
export default define(class Reference extends Element {
|
|
@@ -340,12 +340,14 @@ export default define(class Reference extends Element {
|
|
|
340
340
|
static fromReferenceString(referenceString, context) {
|
|
341
341
|
let reference;
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
posit((context) => {
|
|
344
|
+
ablate((context) => {
|
|
345
|
+
instantiate((context) => {
|
|
346
|
+
const string = referenceString, ///
|
|
347
|
+
referenceNode = instantiateReference(string, context);
|
|
347
348
|
|
|
348
|
-
|
|
349
|
+
reference = referenceFromReferenceNode(referenceNode, context);
|
|
350
|
+
}, context);
|
|
349
351
|
}, context);
|
|
350
352
|
}, context);
|
|
351
353
|
|
package/src/element/signature.js
CHANGED
|
@@ -6,7 +6,7 @@ import { arrayUtilities } from "necessary";
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { signatureFromSignatureNode } from "../utilities/element";
|
|
8
8
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
9
|
-
import { join, ablate, attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
9
|
+
import { join, posit, ablate, attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
const { match } = arrayUtilities;
|
|
12
12
|
|
|
@@ -276,12 +276,14 @@ export default define(class Signature extends Element {
|
|
|
276
276
|
static fromSignatureString(signatureString, context) {
|
|
277
277
|
let signature;
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
posit((context) => {
|
|
280
|
+
ablate((context) => {
|
|
281
|
+
instantiate((context) => {
|
|
282
|
+
const string = signatureString, ///
|
|
283
|
+
signatureNode = instantiateSignature(string, context);
|
|
283
284
|
|
|
284
|
-
|
|
285
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
286
|
+
}, context);
|
|
285
287
|
}, context);
|
|
286
288
|
}, context);
|
|
287
289
|
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { join, reconcile } from "../../utilities/context";
|
|
6
7
|
import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
7
8
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
8
9
|
import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
9
10
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
10
|
-
import { ablate, ablates, manifest, attempts,
|
|
11
|
+
import { ablate, ablates, manifest, attempts, sequester, instantiate, unserialises } from "../../utilities/context";
|
|
11
12
|
|
|
12
13
|
export default define(class FrameSubstitution extends Substitution {
|
|
13
14
|
constructor(contexts, string, node, breakPoint, targetFrame, replacementFrame) {
|
|
@@ -136,7 +137,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
136
137
|
|
|
137
138
|
if (targetFrameSingular) {
|
|
138
139
|
manifest((context) => {
|
|
139
|
-
|
|
140
|
+
sequester((context) => {
|
|
140
141
|
const tragetFrame = this.targetFrame.validate(context);
|
|
141
142
|
|
|
142
143
|
if (tragetFrame !== null) {
|
|
@@ -167,7 +168,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
167
168
|
|
|
168
169
|
context.trace(`Validating the '${frameSubstitutionString}' frame substitution's replacement frame...`);
|
|
169
170
|
|
|
170
|
-
|
|
171
|
+
sequester((context) => {
|
|
171
172
|
const replacementFrame = this.replacementFrame.validate(context);
|
|
172
173
|
|
|
173
174
|
if (replacementFrame !== null) {
|
|
@@ -184,6 +185,127 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
184
185
|
return replacementFrameValidates;
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
unifySubstitution(substitution, context) {
|
|
189
|
+
let substitutionUnifies = false;
|
|
190
|
+
|
|
191
|
+
const generalSubstitution = this, ///
|
|
192
|
+
specificSubstitution = substitution,
|
|
193
|
+
generalSubstitutionString = generalSubstitution.getString(),
|
|
194
|
+
specificSubstitutionString = specificSubstitution.getString();
|
|
195
|
+
|
|
196
|
+
context.trace(`Unifying the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution...`);
|
|
197
|
+
|
|
198
|
+
reconcile((context) => {
|
|
199
|
+
const replacementFrameUnifies = this.unifyReplacementFrame(substitution, context);
|
|
200
|
+
|
|
201
|
+
if (replacementFrameUnifies) {
|
|
202
|
+
const targetFrameUnifies = this.unifyTargetFrame(substitution, context);
|
|
203
|
+
|
|
204
|
+
if (targetFrameUnifies) {
|
|
205
|
+
context.commit();
|
|
206
|
+
|
|
207
|
+
substitutionUnifies = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, context);
|
|
211
|
+
|
|
212
|
+
if (substitutionUnifies) {
|
|
213
|
+
context.debug(`...unified the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution.`);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return substitutionUnifies;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
unifyTargetFrame(substitution, context) {
|
|
220
|
+
let targetFrameUnifies = false;
|
|
221
|
+
|
|
222
|
+
const generalSubstitution = this, ///
|
|
223
|
+
specificSubstitution = substitution,
|
|
224
|
+
generalSubstitutionString = generalSubstitution.getString(),
|
|
225
|
+
specificSubstitutionString = specificSubstitution.getString();
|
|
226
|
+
|
|
227
|
+
context.trace(`Unifying the '${specificSubstitutionString}' substitution's target frame with the '${generalSubstitutionString}' substitution's target frame...`);
|
|
228
|
+
|
|
229
|
+
const generalSubstitutionGeneralContext = generalSubstitution.getGeneralContext(),
|
|
230
|
+
specificSubstitutionGeneralContext = specificSubstitution.getGeneralContext(),
|
|
231
|
+
generalSubstitutionTargetFrame = generalSubstitution.getTargetFrame(),
|
|
232
|
+
specificSubstitutionTargetFrame = specificSubstitution.getTargetFrame(),
|
|
233
|
+
generalContext = generalSubstitutionGeneralContext, ///
|
|
234
|
+
specificContext = specificSubstitutionGeneralContext, ///
|
|
235
|
+
generalFrame = generalSubstitutionTargetFrame, ///
|
|
236
|
+
specificFrame = specificSubstitutionTargetFrame; ///
|
|
237
|
+
|
|
238
|
+
join((specificContext) => {
|
|
239
|
+
reconcile((specificContext) => {
|
|
240
|
+
const generalFrameNode = generalFrame.getNode(),
|
|
241
|
+
generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
|
|
242
|
+
|
|
243
|
+
if (generalMetavariable !== null) {
|
|
244
|
+
const frame = specificFrame, ///
|
|
245
|
+
metavariable = generalMetavariable, ///
|
|
246
|
+
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
247
|
+
|
|
248
|
+
if (frameUnifies) {
|
|
249
|
+
specificContext.commit(context);
|
|
250
|
+
|
|
251
|
+
targetFrameUnifies = true;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}, specificContext);
|
|
255
|
+
}, specificContext, context);
|
|
256
|
+
|
|
257
|
+
if (targetFrameUnifies) {
|
|
258
|
+
context.trace(`...unified the '${specificSubstitutionString}' substitution's target frame with the '${generalSubstitutionString}' substitution's target frame.`);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return targetFrameUnifies;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
unifyReplacementFrame(substitution, context) {
|
|
265
|
+
let replacementFrameUnifies = false;
|
|
266
|
+
|
|
267
|
+
const generalSubstitution = this, ///
|
|
268
|
+
specificSubstitution = substitution,
|
|
269
|
+
generalSubstitutionString = generalSubstitution.getString(),
|
|
270
|
+
specificSubstitutionString = specificSubstitution.getString();
|
|
271
|
+
|
|
272
|
+
context.trace(`Unifying the '${specificSubstitutionString}' substitution's replacement frame with the '${generalSubstitutionString}' substitution's replacement frame...`);
|
|
273
|
+
|
|
274
|
+
const generalSubstitutionSpecificContext = generalSubstitution.getSpecificContext(),
|
|
275
|
+
specificSubstitutionSpecificContext = specificSubstitution.getSpecificContext(),
|
|
276
|
+
generalSubstitutionReplacementFrame = generalSubstitution.getReplacementFrame(),
|
|
277
|
+
specificSubstitutionReplacementFrame = specificSubstitution.getReplacementFrame(),
|
|
278
|
+
generalContext = generalSubstitutionSpecificContext, ///
|
|
279
|
+
specificContext = specificSubstitutionSpecificContext, ///
|
|
280
|
+
generalFrame = generalSubstitutionReplacementFrame, ///
|
|
281
|
+
specificFrame = specificSubstitutionReplacementFrame; ///
|
|
282
|
+
|
|
283
|
+
join((specificContext) => {
|
|
284
|
+
reconcile((specificContext) => {
|
|
285
|
+
const generalFrameNode = generalFrame.getNode(),
|
|
286
|
+
generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
|
|
287
|
+
|
|
288
|
+
if (generalMetavariable !== null) {
|
|
289
|
+
const frame = specificFrame, ///
|
|
290
|
+
metavariable = generalMetavariable, ///
|
|
291
|
+
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
292
|
+
|
|
293
|
+
if (frameUnifies) {
|
|
294
|
+
specificContext.commit(context);
|
|
295
|
+
|
|
296
|
+
replacementFrameUnifies = true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}, specificContext);
|
|
300
|
+
}, specificContext, context);
|
|
301
|
+
|
|
302
|
+
if (replacementFrameUnifies) {
|
|
303
|
+
context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement frame with the '${generalSubstitutionString}' substitution's replacement frame.`);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return replacementFrameUnifies;
|
|
307
|
+
}
|
|
308
|
+
|
|
187
309
|
static name = "FrameSubstitution";
|
|
188
310
|
|
|
189
311
|
static fromJSON(json, context) {
|
|
@@ -253,6 +375,18 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
253
375
|
}
|
|
254
376
|
});
|
|
255
377
|
|
|
378
|
+
function metavariableFromFrameNode(frameNode, context) {
|
|
379
|
+
let metavariable = null;
|
|
380
|
+
|
|
381
|
+
const metavariableNode = frameNode.getMetavariableNode();
|
|
382
|
+
|
|
383
|
+
if (metavariableNode !== null) {
|
|
384
|
+
metavariable = context.findMetavariableByMetavariableNode(metavariableNode);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return metavariable;
|
|
388
|
+
}
|
|
389
|
+
|
|
256
390
|
function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
257
391
|
const targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
|
|
258
392
|
targetFrame = context.findFrameByFrameNode(targetFrameNode);
|
|
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
|
7
7
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
10
|
-
import { ablates, manifest, attempts,
|
|
10
|
+
import { ablates, manifest, attempts, sequester, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
|
|
12
12
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
13
13
|
constructor(context, string, node, breakPoint, targetReference, replacementReference) {
|
|
@@ -150,7 +150,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
150
150
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's target reference...`);
|
|
151
151
|
|
|
152
152
|
manifest((context) => {
|
|
153
|
-
|
|
153
|
+
sequester((context) => {
|
|
154
154
|
const targetReference = this.targetReference.validate(context);
|
|
155
155
|
|
|
156
156
|
if (targetReference !== null) {
|
|
@@ -174,7 +174,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
174
174
|
|
|
175
175
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's replacement reference...`);
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
sequester((context) => {
|
|
178
178
|
const replacementReference = this.replacementReference.validate(context);
|
|
179
179
|
|
|
180
180
|
if (replacementReference !== null) {
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { unifySubstitution } from "../../process/unify";
|
|
7
|
-
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
8
6
|
import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
7
|
+
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
9
8
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
10
9
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
11
|
-
import { join, ablates, manifest, attempts,
|
|
10
|
+
import { join, ablates, manifest, attempts, sequester, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
12
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
13
12
|
|
|
14
13
|
export default define(class StatementSubstitution extends Substitution {
|
|
@@ -174,7 +173,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
174
173
|
|
|
175
174
|
if (targetStatementSingular) {
|
|
176
175
|
manifest((context) => {
|
|
177
|
-
|
|
176
|
+
sequester((context) => {
|
|
178
177
|
const targetStatement = this.targetStatement.validate(context);
|
|
179
178
|
|
|
180
179
|
if (targetStatement !== null) {
|
|
@@ -203,7 +202,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
203
202
|
|
|
204
203
|
context.trace(`Validating the '${statementSubstitutionString}' statement substitution's replacement statement...`);
|
|
205
204
|
|
|
206
|
-
|
|
205
|
+
sequester((context) => {
|
|
207
206
|
const replacementStatement = this.replacementStatement.validate(context);
|
|
208
207
|
|
|
209
208
|
if (replacementStatement !== null) {
|
|
@@ -218,132 +217,134 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
218
217
|
return replacementStatementValidates;
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
|
|
222
|
-
let
|
|
220
|
+
unifyTargetStatement(substitution, context) {
|
|
221
|
+
let targetStatemnentUnifies = false;
|
|
223
222
|
|
|
224
|
-
const
|
|
225
|
-
|
|
223
|
+
const generalSubstitution = this, ///
|
|
224
|
+
specificSubstitution = substitution,
|
|
225
|
+
generalSubstitutionString = generalSubstitution.getString(),
|
|
226
|
+
specificSubstitutionString = specificSubstitution.getString();
|
|
226
227
|
|
|
227
|
-
context.trace(`Unifying the '${
|
|
228
|
+
context.trace(`Unifying the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement...`);
|
|
228
229
|
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
const generalSubstitutionGeneralContext = generalSubstitution.getGeneralContext(),
|
|
231
|
+
specificSubstitutionGeneralContext = specificSubstitution.getGeneralContext(),
|
|
232
|
+
generalSubstitutionTargetStatement = generalSubstitution.getTargetStatement(),
|
|
233
|
+
specificSubstitutionTargetStatement = specificSubstitution.getTargetStatement(),
|
|
234
|
+
generalContext = generalSubstitutionGeneralContext, ///
|
|
235
|
+
specificContext = specificSubstitutionGeneralContext, ///
|
|
236
|
+
generalStatement = generalSubstitutionTargetStatement, ///
|
|
237
|
+
specificStatement = specificSubstitutionTargetStatement; ///
|
|
233
238
|
|
|
234
239
|
join((specificContext) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
simpleSubstitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext);
|
|
240
|
+
reconcile((specificContext) => {
|
|
241
|
+
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
238
242
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
}, specificContext)
|
|
243
|
-
}, ...generalContexts);
|
|
244
|
-
}, ...specificContexts, context);
|
|
243
|
+
if (statementUnifies) {
|
|
244
|
+
specificContext.commit(context);
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
targetStatemnentUnifies = true;
|
|
247
|
+
}
|
|
248
|
+
}, specificContext);
|
|
249
|
+
}, specificContext, context);
|
|
250
|
+
|
|
251
|
+
if (targetStatemnentUnifies) {
|
|
252
|
+
context.trace(`...unified the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement.`);
|
|
248
253
|
}
|
|
249
254
|
|
|
250
|
-
return
|
|
255
|
+
return targetStatemnentUnifies;
|
|
251
256
|
}
|
|
252
257
|
|
|
253
|
-
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
const simpleSubstitutionString = this.getString(), ///
|
|
257
|
-
complexSubstitutionString = complexSubstitution.getString(); ///
|
|
258
|
-
|
|
259
|
-
context.trace(`Unifying the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution...`);
|
|
258
|
+
unifyReplacementStatement(substitution, context) {
|
|
259
|
+
let replacementStatemnentUnifies = false;
|
|
260
260
|
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
specificContext = complexSubstitutionGSpecificContext; ///
|
|
261
|
+
const generalSubstitution = this, ///
|
|
262
|
+
specificSubstitution = substitution,
|
|
263
|
+
generalSubstitutionString = generalSubstitution.getString(),
|
|
264
|
+
specificSubstitutionString = specificSubstitution.getString();
|
|
266
265
|
|
|
267
|
-
|
|
266
|
+
context.trace(`Unifying the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement...`);
|
|
268
267
|
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
const generalSubstitutionSpecificContext = generalSubstitution.getSpecificContext(),
|
|
269
|
+
specificSubstitutionSpecificContext = specificSubstitution.getSpecificContext(),
|
|
270
|
+
generalSubstitutionReplacementStatement = generalSubstitution.getReplacementStatement(),
|
|
271
|
+
specificSubstitutionReplacementStatement = specificSubstitution.getReplacementStatement(),
|
|
272
|
+
generalContext = generalSubstitutionSpecificContext, ///
|
|
273
|
+
specificContext = specificSubstitutionSpecificContext, ///
|
|
274
|
+
generalStatement = generalSubstitutionReplacementStatement, ///
|
|
275
|
+
specificStatement = specificSubstitutionReplacementStatement; ///
|
|
271
276
|
|
|
277
|
+
join((specificContext) => {
|
|
272
278
|
reconcile((specificContext) => {
|
|
273
|
-
const
|
|
274
|
-
replacementStatementUnifies = this.unifyReplacementStatement(replacementStatement, generalContext, specificContext);
|
|
279
|
+
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
275
280
|
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
soleNonTrivialDerivedSubstitution = context.getSoleNonTrivialDerivedSubstitution();
|
|
281
|
+
if (statementUnifies) {
|
|
282
|
+
specificContext.commit(context);
|
|
279
283
|
|
|
280
|
-
|
|
284
|
+
replacementStatemnentUnifies = true;
|
|
281
285
|
}
|
|
282
286
|
}, specificContext);
|
|
283
287
|
}, specificContext, context);
|
|
284
288
|
|
|
285
|
-
if (
|
|
286
|
-
substitution
|
|
287
|
-
|
|
288
|
-
simpleSubstitutionUnifies = true;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (simpleSubstitutionUnifies) {
|
|
292
|
-
context.debug(`...unified the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution.`);
|
|
289
|
+
if (replacementStatemnentUnifies) {
|
|
290
|
+
context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement.`);
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
return
|
|
293
|
+
return replacementStatemnentUnifies;
|
|
296
294
|
}
|
|
297
295
|
|
|
298
|
-
|
|
299
|
-
let
|
|
296
|
+
unifyComplexSubstitution(complexSubstitution, context) {
|
|
297
|
+
let substitution = null;
|
|
300
298
|
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
const simpleSubstitution = this, ///
|
|
300
|
+
simpleSubstitutionString = simpleSubstitution.getString(), ///
|
|
301
|
+
complexSubstitutionString = complexSubstitution.getString(); ///
|
|
302
|
+
|
|
303
|
+
context.trace(`Unifying the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution...`);
|
|
304
|
+
|
|
305
|
+
let simpleSubstitutionUnifies = false;
|
|
304
306
|
|
|
305
|
-
context
|
|
307
|
+
reconcile((context) => {
|
|
308
|
+
const replacementStatementUnifies = this.unifyReplacementStatement(complexSubstitution, context);
|
|
306
309
|
|
|
307
|
-
|
|
310
|
+
if (replacementStatementUnifies) {
|
|
311
|
+
const soleNonTrivialDerivedSubstitution = context.getSoleNonTrivialDerivedSubstitution();
|
|
308
312
|
|
|
309
|
-
|
|
310
|
-
|
|
313
|
+
substitution = soleNonTrivialDerivedSubstitution; ///
|
|
314
|
+
}
|
|
315
|
+
}, context);
|
|
316
|
+
|
|
317
|
+
if (substitution !== null) {
|
|
318
|
+
simpleSubstitutionUnifies = true;
|
|
311
319
|
}
|
|
312
320
|
|
|
313
|
-
if (
|
|
314
|
-
context.debug(`...unified the '${
|
|
321
|
+
if (simpleSubstitutionUnifies) {
|
|
322
|
+
context.debug(`...unified the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution.`);
|
|
315
323
|
}
|
|
316
324
|
|
|
317
|
-
return
|
|
325
|
+
return substitution;
|
|
318
326
|
}
|
|
319
327
|
|
|
320
328
|
resolve(context) {
|
|
321
|
-
let resolved = false;
|
|
322
|
-
|
|
323
329
|
const metavariableNode = this.getMetavariableNode(),
|
|
324
|
-
simpleDerivedSubstitution = context.findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode)
|
|
325
|
-
complexSubstitution = this,
|
|
326
|
-
simpleSubstitution = simpleDerivedSubstitution; ///
|
|
330
|
+
simpleDerivedSubstitution = context.findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode);
|
|
327
331
|
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
332
|
+
if (simpleDerivedSubstitution !== null) {
|
|
333
|
+
const simpleSubstitution = simpleDerivedSubstitution, ///
|
|
334
|
+
complexSubstitution = this, ///
|
|
335
|
+
complexSubstitutionString = complexSubstitution.getString();
|
|
330
336
|
|
|
331
|
-
context.trace(`Resolving the ${
|
|
337
|
+
context.trace(`Resolving the ${complexSubstitutionString}' complex substitution...`);
|
|
332
338
|
|
|
333
339
|
const substitution = simpleSubstitution.unifyComplexSubstitution(complexSubstitution, context);
|
|
334
340
|
|
|
335
341
|
if (substitution !== null) {
|
|
336
|
-
const
|
|
337
|
-
simpleSubstitutionUnifies = complexSubstitution.unifySimpleSubstitution(simpleSubstitution, context);
|
|
342
|
+
const simpleSubstitutionUnifies = this.substitution.unifySubstitution(substitution, context);
|
|
338
343
|
|
|
339
344
|
if (simpleSubstitutionUnifies) {
|
|
340
|
-
resolved = true;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (resolved) {
|
|
344
345
|
this.resolved = true;
|
|
345
346
|
|
|
346
|
-
context.debug(`...resolved the '${
|
|
347
|
+
context.debug(`...resolved the '${complexSubstitutionString}' complex substitution.`);
|
|
347
348
|
}
|
|
348
349
|
}
|
|
349
350
|
}
|