occam-verify-cli 1.0.404 → 1.0.414
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/file.js +3 -3
- package/lib/context/local.js +3 -3
- package/lib/context/release.js +2 -2
- package/lib/context/temporary.js +103 -54
- package/lib/mixins/statement/verify.js +2 -2
- package/lib/mixins/step/unify.js +2 -2
- package/lib/node/argument.js +2 -2
- package/lib/node/assumption.js +6 -6
- package/lib/node/frame.js +19 -7
- package/lib/node/judgement.js +8 -1
- package/lib/node/statement.js +34 -15
- package/lib/node/substitution/term.js +3 -11
- package/lib/node/term.js +20 -8
- package/lib/nonTerminalNode.js +3 -3
- package/lib/ontology/assertion/contained.js +7 -7
- package/lib/ontology/assertion/defined.js +8 -8
- package/lib/ontology/assertion/subproof.js +3 -3
- package/lib/ontology/assumption.js +49 -45
- package/lib/ontology/combinator.js +3 -3
- package/lib/ontology/constructor.js +3 -3
- package/lib/ontology/equality.js +4 -4
- package/lib/ontology/equivalence.js +2 -2
- package/lib/ontology/frame.js +37 -12
- package/lib/ontology/judgement.js +13 -6
- package/lib/ontology/metavariable.js +75 -76
- package/lib/ontology/propertyRelation.js +2 -2
- package/lib/ontology/reference.js +33 -4
- package/lib/ontology/signature.js +2 -2
- package/lib/ontology/statement.js +33 -8
- package/lib/ontology/step.js +4 -4
- package/lib/ontology/substitution/frame.js +13 -15
- package/lib/ontology/substitution/statement.js +31 -32
- package/lib/ontology/substitution/term.js +26 -25
- package/lib/ontology/substitution.js +2 -2
- package/lib/ontology/substitutions.js +4 -4
- package/lib/ontology/term.js +26 -12
- package/lib/ontology/variable.js +2 -2
- package/lib/process/equate.js +322 -0
- package/lib/process/unify.js +623 -0
- package/lib/process/verify.js +332 -0
- package/lib/utilities/brackets.js +3 -8
- package/lib/utilities/context.js +4 -14
- package/lib/utilities/json.js +18 -1
- package/lib/utilities/pass.js +68 -0
- package/lib/utilities/substitutions.js +11 -16
- package/package.json +7 -7
- package/src/context/file.js +2 -2
- package/src/context/local.js +2 -2
- package/src/context/release.js +1 -1
- package/src/context/temporary.js +124 -54
- package/src/mixins/statement/verify.js +3 -1
- package/src/mixins/step/unify.js +0 -1
- package/src/node/argument.js +1 -1
- package/src/node/assumption.js +4 -4
- package/src/node/frame.js +19 -5
- package/src/node/judgement.js +7 -0
- package/src/node/statement.js +35 -13
- package/src/node/substitution/term.js +4 -14
- package/src/node/term.js +20 -6
- package/src/nonTerminalNode.js +1 -1
- package/src/ontology/assertion/contained.js +6 -6
- package/src/ontology/assertion/defined.js +7 -7
- package/src/ontology/assertion/subproof.js +1 -1
- package/src/ontology/assumption.js +52 -57
- package/src/ontology/combinator.js +1 -1
- package/src/ontology/constructor.js +1 -1
- package/src/ontology/equality.js +3 -3
- package/src/ontology/equivalence.js +1 -1
- package/src/ontology/frame.js +44 -10
- package/src/ontology/judgement.js +8 -3
- package/src/ontology/metavariable.js +108 -102
- package/src/ontology/propertyRelation.js +3 -2
- package/src/ontology/reference.js +39 -1
- package/src/ontology/signature.js +3 -3
- package/src/ontology/statement.js +38 -4
- package/src/ontology/step.js +7 -7
- package/src/ontology/substitution/frame.js +13 -17
- package/src/ontology/substitution/statement.js +45 -48
- package/src/ontology/substitution/term.js +19 -19
- package/src/ontology/substitution.js +3 -2
- package/src/ontology/substitutions.js +3 -3
- package/src/ontology/term.js +26 -5
- package/src/ontology/variable.js +3 -2
- package/src/process/equate.js +212 -0
- package/src/process/unify.js +634 -0
- package/src/process/verify.js +204 -0
- package/src/utilities/brackets.js +2 -11
- package/src/utilities/context.js +1 -21
- package/src/utilities/json.js +19 -0
- package/src/utilities/{unifier.js → pass.js} +17 -1
- package/src/utilities/substitutions.js +10 -20
- package/lib/unifier/equantional.js +0 -170
- package/lib/unifier/intrinsicLevel.js +0 -144
- package/lib/unifier/metaLevel.js +0 -197
- package/lib/unifier/metavariable.js +0 -140
- package/lib/unifier/statementWithCombinator.js +0 -177
- package/lib/unifier/termWithConstructor.js +0 -145
- package/lib/unifier.js +0 -241
- package/lib/utilities/arguments.js +0 -28
- package/lib/utilities/frame.js +0 -18
- package/lib/utilities/metavariable.js +0 -18
- package/lib/utilities/statement.js +0 -18
- package/lib/utilities/unification.js +0 -109
- package/lib/utilities/unifier.js +0 -51
- package/lib/utilities/variable.js +0 -18
- package/lib/verifier/combinator.js +0 -158
- package/lib/verifier.js +0 -219
- package/src/unifier/equantional.js +0 -90
- package/src/unifier/intrinsicLevel.js +0 -52
- package/src/unifier/metaLevel.js +0 -151
- package/src/unifier/metavariable.js +0 -50
- package/src/unifier/statementWithCombinator.js +0 -114
- package/src/unifier/termWithConstructor.js +0 -56
- package/src/unifier.js +0 -183
- package/src/utilities/arguments.js +0 -21
- package/src/utilities/frame.js +0 -13
- package/src/utilities/metavariable.js +0 -13
- package/src/utilities/statement.js +0 -13
- package/src/utilities/unification.js +0 -136
- package/src/utilities/variable.js +0 -13
- package/src/verifier/combinator.js +0 -72
- package/src/verifier.js +0 -150
|
@@ -7,8 +7,7 @@ import { define } from "../ontology";
|
|
|
7
7
|
import { EMPTY_STRING } from "../constants";
|
|
8
8
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
9
9
|
import { metaTypeFromJSON, metaTypeToMetaTypeJSON } from "../utilities/json";
|
|
10
|
-
import {
|
|
11
|
-
import { unifyMetavariable, unifyMetavariableIntrinsically } from "../utilities/unification";
|
|
10
|
+
import { unifyMetavariable, unifyMetavariableIntrinsically } from "../process/unify";
|
|
12
11
|
|
|
13
12
|
export default define(class Metavariable {
|
|
14
13
|
constructor(string, node, tokens, name, type, metaType) {
|
|
@@ -81,8 +80,9 @@ export default define(class Metavariable {
|
|
|
81
80
|
isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
|
|
82
81
|
|
|
83
82
|
isEqualTo(metavariable) {
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
const metavariableNode = metavariable.getNode(),
|
|
84
|
+
matches = this.node.match(metavariableNode),
|
|
85
|
+
equalTo = matches; ///
|
|
86
86
|
|
|
87
87
|
return equalTo;
|
|
88
88
|
}
|
|
@@ -175,50 +175,6 @@ export default define(class Metavariable {
|
|
|
175
175
|
return frameUnifies;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
unifyReference(reference, substitutions, generalContext, specificContext) {
|
|
179
|
-
let referenceUnifies = false;
|
|
180
|
-
|
|
181
|
-
const referenceString = reference.getString(),
|
|
182
|
-
metavariableString = this.string;
|
|
183
|
-
|
|
184
|
-
specificContext.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
185
|
-
|
|
186
|
-
const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext);
|
|
187
|
-
|
|
188
|
-
if (referenceMetavariableUnifies) {
|
|
189
|
-
referenceUnifies = true;
|
|
190
|
-
} else {
|
|
191
|
-
const context = specificContext, ///
|
|
192
|
-
metavariable = this, ///
|
|
193
|
-
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
194
|
-
|
|
195
|
-
if (simpleSubstitutionPresent) {
|
|
196
|
-
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable), ///
|
|
197
|
-
substitution = simpleSubstitution, ///
|
|
198
|
-
substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference, context);
|
|
199
|
-
|
|
200
|
-
if (substitutionReferenceEqualToReference) {
|
|
201
|
-
referenceUnifies = true;
|
|
202
|
-
}
|
|
203
|
-
} else {
|
|
204
|
-
const { ReferenceSubstitution } = ontology,
|
|
205
|
-
metavariable = this,
|
|
206
|
-
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
207
|
-
substitution = referenceSubstitution; ///
|
|
208
|
-
|
|
209
|
-
substitutions.addSubstitution(substitution, context);
|
|
210
|
-
|
|
211
|
-
referenceUnifies = true;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (referenceUnifies) {
|
|
216
|
-
specificContext.debug(`...unified the '${referenceString}' reference with the '${metavariableString}' metavariable.`);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return referenceUnifies;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
178
|
unifyStatement(statement, substitution, substitutions, generalContext, specificContext) {
|
|
223
179
|
let statementUnifies = false;
|
|
224
180
|
|
|
@@ -267,6 +223,50 @@ export default define(class Metavariable {
|
|
|
267
223
|
return statementUnifies;
|
|
268
224
|
}
|
|
269
225
|
|
|
226
|
+
unifyReference(reference, substitutions, generalContext, specificContext) {
|
|
227
|
+
let referenceUnifies = false;
|
|
228
|
+
|
|
229
|
+
const referenceString = reference.getString(),
|
|
230
|
+
metavariableString = this.string; ///
|
|
231
|
+
|
|
232
|
+
specificContext.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
233
|
+
|
|
234
|
+
const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext);
|
|
235
|
+
|
|
236
|
+
if (referenceMetavariableUnifies) {
|
|
237
|
+
referenceUnifies = true;
|
|
238
|
+
} else {
|
|
239
|
+
const context = specificContext, ///
|
|
240
|
+
metavariable = this, ///
|
|
241
|
+
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
242
|
+
|
|
243
|
+
if (simpleSubstitutionPresent) {
|
|
244
|
+
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable), ///
|
|
245
|
+
substitution = simpleSubstitution, ///
|
|
246
|
+
substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference, context);
|
|
247
|
+
|
|
248
|
+
if (substitutionReferenceEqualToReference) {
|
|
249
|
+
referenceUnifies = true;
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
const { ReferenceSubstitution } = ontology,
|
|
253
|
+
metavariable = this,
|
|
254
|
+
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
255
|
+
substitution = referenceSubstitution; ///
|
|
256
|
+
|
|
257
|
+
substitutions.addSubstitution(substitution, context);
|
|
258
|
+
|
|
259
|
+
referenceUnifies = true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (referenceUnifies) {
|
|
264
|
+
specificContext.debug(`...unified the '${referenceString}' reference with the '${metavariableString}' metavariable.`);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return referenceUnifies;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
270
|
unifyMetavariable(metavariable, context) {
|
|
271
271
|
let metavariableUnifies;
|
|
272
272
|
|
|
@@ -291,33 +291,35 @@ export default define(class Metavariable {
|
|
|
291
291
|
unifyFrameMetavariable(frame, substitutions, generalContext, specificContext) {
|
|
292
292
|
let frameMetavariableUnifies = false;
|
|
293
293
|
|
|
294
|
-
const
|
|
294
|
+
const context = specificContext, ///
|
|
295
|
+
generalContextFilePath = generalContext.getFilePath(),
|
|
295
296
|
specificContextFilePath = specificContext.getFilePath();
|
|
296
297
|
|
|
297
298
|
if (generalContextFilePath === specificContextFilePath) {
|
|
298
|
-
const
|
|
299
|
+
const metavariable = this,
|
|
300
|
+
metavariableString = this.string, ///
|
|
301
|
+
frameMetavariableEqualToMetvariable = frame.isMetavariableEqualToMetavariable(metavariable, context);
|
|
299
302
|
|
|
300
|
-
if (
|
|
303
|
+
if (frameMetavariableEqualToMetvariable) {
|
|
301
304
|
frameMetavariableUnifies = true;
|
|
302
305
|
} else {
|
|
303
|
-
const
|
|
304
|
-
metavariable = metavariableFromFrame(frame, context);
|
|
306
|
+
const frameSingular = frame.isSingular();
|
|
305
307
|
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
|
|
308
|
+
if (frameSingular) {
|
|
309
|
+
const frameMetavariableName = frame.getMetavariableName(),
|
|
310
|
+
frameMetavariable = context.findMetavariableByMetavariableName(frameMetavariableName),
|
|
309
311
|
frameMetavariableString = frameMetavariable.getString();
|
|
310
312
|
|
|
311
|
-
|
|
313
|
+
context.trace(`Unifying the frame's '${frameMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
312
314
|
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
+
const generalMetavariable = this, ///
|
|
316
|
+
specificMetavariable = frameMetavariable, ///
|
|
315
317
|
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
316
318
|
|
|
317
319
|
frameMetavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
318
320
|
|
|
319
321
|
if (frameMetavariableUnifies) {
|
|
320
|
-
|
|
322
|
+
context.debug(`...unified the frame's '${frameMetavariableString}' metavariable with the '${metavariableString}' metavariable.`);
|
|
321
323
|
}
|
|
322
324
|
}
|
|
323
325
|
}
|
|
@@ -326,77 +328,79 @@ export default define(class Metavariable {
|
|
|
326
328
|
return frameMetavariableUnifies;
|
|
327
329
|
}
|
|
328
330
|
|
|
329
|
-
|
|
330
|
-
let
|
|
331
|
+
unifyStatementMetavariable(statement, substitutions, generalContext, specificContext) {
|
|
332
|
+
let statementMetavariableUnifies = false;
|
|
331
333
|
|
|
332
|
-
const
|
|
334
|
+
const context = specificContext, ///
|
|
335
|
+
generalContextFilePath = generalContext.getFilePath(),
|
|
333
336
|
specificContextFilePath = specificContext.getFilePath();
|
|
334
337
|
|
|
335
338
|
if (generalContextFilePath === specificContextFilePath) {
|
|
336
|
-
const
|
|
339
|
+
const metavariable = this, ///
|
|
340
|
+
metavariableString = this.string, ///
|
|
341
|
+
statementMetavariableEqualToMetvariable = statement.isMetavariableEqualToMetavariable(metavariable, context);
|
|
337
342
|
|
|
338
|
-
if (
|
|
339
|
-
|
|
343
|
+
if (statementMetavariableEqualToMetvariable) {
|
|
344
|
+
statementMetavariableUnifies = true;
|
|
340
345
|
} else {
|
|
341
|
-
const
|
|
346
|
+
const statementSingular = statement.isSingular();
|
|
342
347
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
if (statementSingular) {
|
|
349
|
+
const statementMetavariableName = statement.getMetavariableName(),
|
|
350
|
+
statementMetavariable = context.findMetavariableByMetavariableName(statementMetavariableName),
|
|
351
|
+
statementMetavariableString = statementMetavariable.getString();
|
|
346
352
|
|
|
347
|
-
|
|
353
|
+
context.trace(`Unifying the statement's ${statementMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
348
354
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
355
|
+
const generalMetavariable = this, ///
|
|
356
|
+
specificMetavariable = statementMetavariable, ///
|
|
357
|
+
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
352
358
|
|
|
353
|
-
|
|
359
|
+
statementMetavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
354
360
|
|
|
355
|
-
|
|
356
|
-
|
|
361
|
+
if (statementMetavariableUnifies) {
|
|
362
|
+
context.debug(`...unified the statement's '${statementMetavariableString}' metavariable with the '${metavariableString}' metavariable.`);
|
|
363
|
+
}
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
}
|
|
360
367
|
|
|
361
|
-
return
|
|
368
|
+
return statementMetavariableUnifies;
|
|
362
369
|
}
|
|
363
370
|
|
|
364
|
-
|
|
365
|
-
let
|
|
371
|
+
unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext) {
|
|
372
|
+
let referenceMetavariableUnifies = false;
|
|
366
373
|
|
|
367
|
-
const
|
|
374
|
+
const context = specificContext, ///
|
|
375
|
+
generalContextFilePath = generalContext.getFilePath(),
|
|
368
376
|
specificContextFilePath = specificContext.getFilePath();
|
|
369
377
|
|
|
370
378
|
if (generalContextFilePath === specificContextFilePath) {
|
|
371
|
-
const
|
|
379
|
+
const metavariable = this, ///
|
|
380
|
+
metavariableString = this.string, ///
|
|
381
|
+
referenceMetavariableEqualToMetvariable = reference.isMetavariableEqualToMetavariable(metavariable);
|
|
372
382
|
|
|
373
|
-
if (
|
|
374
|
-
|
|
383
|
+
if (referenceMetavariableEqualToMetvariable) {
|
|
384
|
+
referenceMetavariableUnifies = true;
|
|
375
385
|
} else {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (metavariable !== null) {
|
|
380
|
-
const statementMetavariable = metavariable, ///
|
|
381
|
-
metavariableString = this.string, ///
|
|
382
|
-
statementMetavariableString = statementMetavariable.getString();
|
|
386
|
+
const referenceMetavariable = reference.getMetavariable(),
|
|
387
|
+
referenceMetavariableString = referenceMetavariable.getString();
|
|
383
388
|
|
|
384
|
-
|
|
389
|
+
context.trace(`Unifying the reference's ${referenceMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
385
390
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
391
|
+
const generalMetavariable = this, ///
|
|
392
|
+
specificMetavariable = referenceMetavariable, ///
|
|
393
|
+
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
389
394
|
|
|
390
|
-
|
|
395
|
+
referenceMetavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
391
396
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
397
|
+
if (referenceMetavariableUnifies) {
|
|
398
|
+
context.debug(`...unified the reference's '${referenceMetavariableString}' metavariable with the '${metavariableString}' metavariable.`);
|
|
395
399
|
}
|
|
396
400
|
}
|
|
397
401
|
}
|
|
398
402
|
|
|
399
|
-
return
|
|
403
|
+
return referenceMetavariableUnifies;
|
|
400
404
|
}
|
|
401
405
|
|
|
402
406
|
toJSON() {
|
|
@@ -465,9 +469,11 @@ export default define(class Metavariable {
|
|
|
465
469
|
static fromStatementNode(statementNode, context) {
|
|
466
470
|
let metavariable = null;
|
|
467
471
|
|
|
468
|
-
const
|
|
472
|
+
const singularMetavariableNode = statementNode.getSingularMetavariableNode();
|
|
473
|
+
|
|
474
|
+
if (singularMetavariableNode !== null) {
|
|
475
|
+
const metavariableNode = singularMetavariableNode; ///
|
|
469
476
|
|
|
470
|
-
if (metavariableNode !== null) {
|
|
471
477
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
472
478
|
}
|
|
473
479
|
|
|
@@ -34,8 +34,9 @@ export default define(class PropertyRelation {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
isEqualTo(propertyRelation) {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const propertyRelationNode = propertyRelation.getNode(),
|
|
38
|
+
matches = this.node.match(propertyRelationNode),
|
|
39
|
+
equalTo = matches; ///
|
|
39
40
|
|
|
40
41
|
return equalTo;
|
|
41
42
|
}
|
|
@@ -4,7 +4,7 @@ import ontology from "../ontology";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../ontology";
|
|
6
6
|
import { referenceMetaType } from ".//metaType";
|
|
7
|
-
import { unifyMetavariableIntrinsically } from "../
|
|
7
|
+
import { unifyMetavariableIntrinsically } from "../process/unify";
|
|
8
8
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
10
|
export default define(class Reference {
|
|
@@ -18,6 +18,8 @@ export default define(class Reference {
|
|
|
18
18
|
|
|
19
19
|
getName() { return this.metavariable.getName(); }
|
|
20
20
|
|
|
21
|
+
getName() { return this.metavariable.getName(); }
|
|
22
|
+
|
|
21
23
|
getString() { return this.metavariable.getString(); }
|
|
22
24
|
|
|
23
25
|
getMetavariableName() {
|
|
@@ -32,10 +34,30 @@ export default define(class Reference {
|
|
|
32
34
|
return metavariableNode;
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
isEqualTo(refernece) {
|
|
38
|
+
const metavariable = refernece.getMetavariable(),
|
|
39
|
+
metavariableEqualToMetvariable = this.metavariable.isEqualTo(metavariable),
|
|
40
|
+
equalTo = metavariableEqualToMetvariable; ///
|
|
41
|
+
|
|
42
|
+
return equalTo;
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
36
46
|
|
|
37
47
|
matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
|
|
38
48
|
|
|
49
|
+
matchMetavariableNode(metavariableNode) {
|
|
50
|
+
const metavariableNodeA = metavariableNode; ///
|
|
51
|
+
|
|
52
|
+
metavariableNode = this.metavariable.getNode();
|
|
53
|
+
|
|
54
|
+
const metavariableNodeB = metavariableNode, ///
|
|
55
|
+
matches = metavariableNodeA.match(metavariableNodeB),
|
|
56
|
+
metavariableNodeMatches = matches; ///
|
|
57
|
+
|
|
58
|
+
return metavariableNodeMatches; ///
|
|
59
|
+
}
|
|
60
|
+
|
|
39
61
|
verify(context) {
|
|
40
62
|
let verifies = false;
|
|
41
63
|
|
|
@@ -57,6 +79,10 @@ export default define(class Reference {
|
|
|
57
79
|
}
|
|
58
80
|
|
|
59
81
|
if (verifies) {
|
|
82
|
+
const reference = this; ///
|
|
83
|
+
|
|
84
|
+
context.addReference(reference);
|
|
85
|
+
|
|
60
86
|
context.debug(`...verified the '${referenceString}' reference.`);
|
|
61
87
|
}
|
|
62
88
|
|
|
@@ -191,6 +217,18 @@ export default define(class Reference {
|
|
|
191
217
|
return reference;
|
|
192
218
|
}
|
|
193
219
|
|
|
220
|
+
static fromAssumptionNode(assumptionNode, context) {
|
|
221
|
+
let reference = null;
|
|
222
|
+
|
|
223
|
+
const metavariableNode = assumptionNode.getMetavariableNode();
|
|
224
|
+
|
|
225
|
+
if (metavariableNode !== null) {
|
|
226
|
+
reference = referenceFromMetavariableNode(metavariableNode, context);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return reference;
|
|
230
|
+
}
|
|
231
|
+
|
|
194
232
|
static fromMetavariableNode(metavariableNode, context) {
|
|
195
233
|
const reference = referenceFromMetavariableNode(metavariableNode, context);
|
|
196
234
|
|
|
@@ -27,7 +27,7 @@ export default define(class Signature {
|
|
|
27
27
|
verify(context) {
|
|
28
28
|
let verifies;
|
|
29
29
|
|
|
30
|
-
const signatureString = this.string;
|
|
30
|
+
const signatureString = this.string; ///
|
|
31
31
|
|
|
32
32
|
context.trace(`Verifying the ${signatureString} signature...`);
|
|
33
33
|
|
|
@@ -84,7 +84,7 @@ export default define(class Signature {
|
|
|
84
84
|
compareSubstitutions(substitutions, context) {
|
|
85
85
|
let substitutionsCompares = false;
|
|
86
86
|
|
|
87
|
-
const signatureString = this.string,
|
|
87
|
+
const signatureString = this.string, ///
|
|
88
88
|
substitutionsString = substitutions.asString();
|
|
89
89
|
|
|
90
90
|
context.trace(`Comparing the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
|
|
@@ -113,7 +113,7 @@ export default define(class Signature {
|
|
|
113
113
|
correlateSubstitutions(substitutions, context) {
|
|
114
114
|
let substitutionsCorrelates = false;
|
|
115
115
|
|
|
116
|
-
const signatureString = this.string,
|
|
116
|
+
const signatureString = this.string, ///
|
|
117
117
|
substitutionsString = substitutions.asString();
|
|
118
118
|
|
|
119
119
|
context.trace(`Correlating the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
|
|
@@ -6,7 +6,7 @@ import verifyMixins from "../mixins/statement/verify";
|
|
|
6
6
|
import StatementPartialContext from "../context/partial/statement";
|
|
7
7
|
|
|
8
8
|
import { define } from "../ontology";
|
|
9
|
-
import { unifyStatement } from "../
|
|
9
|
+
import { unifyStatement } from "../process/unify";
|
|
10
10
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
11
11
|
import { statementFromStatementNode } from "../utilities/node";
|
|
12
12
|
import { stripBracketsFromStatementNode } from "../utilities/brackets";
|
|
@@ -32,11 +32,24 @@ export default define(class Statement {
|
|
|
32
32
|
return this.tokens;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
getMetavariableName() {
|
|
36
|
+
let metavariableName = null;
|
|
37
|
+
|
|
38
|
+
const singular = this.isSingular();
|
|
39
|
+
|
|
40
|
+
if (singular) {
|
|
41
|
+
metavariableName = this.node.getMetavariableName();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return metavariableName;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
isSingular() { return this.node.isSingular(); }
|
|
36
48
|
|
|
37
49
|
isEqualTo(statement) {
|
|
38
|
-
const
|
|
39
|
-
|
|
50
|
+
const statementNode = statement.getNode(),
|
|
51
|
+
matches = this.node.match(statementNode),
|
|
52
|
+
equalTo = matches; ///
|
|
40
53
|
|
|
41
54
|
return equalTo;
|
|
42
55
|
}
|
|
@@ -95,6 +108,27 @@ export default define(class Statement {
|
|
|
95
108
|
return frameContained;
|
|
96
109
|
}
|
|
97
110
|
|
|
111
|
+
isMetavariableEqualToMetavariable(metavariable, context) {
|
|
112
|
+
let metavariableEqualToMetavariable;
|
|
113
|
+
|
|
114
|
+
const singular = this.isSingular();
|
|
115
|
+
|
|
116
|
+
if (singular) {
|
|
117
|
+
const metavariableA = metavariable, ///
|
|
118
|
+
singularMetavariableNode = this.node.getSingularMetavariableNode(),
|
|
119
|
+
metavariableName = singularMetavariableNode.getMetavariableName();
|
|
120
|
+
|
|
121
|
+
metavariable = context.findMetavariableByMetavariableName(metavariableName)
|
|
122
|
+
|
|
123
|
+
const metavariableB = metavariable,
|
|
124
|
+
equalTo = metavariableA.isEqualTo(metavariableB);
|
|
125
|
+
|
|
126
|
+
metavariableEqualToMetavariable = equalTo; ///
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return metavariableEqualToMetavariable;
|
|
130
|
+
}
|
|
131
|
+
|
|
98
132
|
matchStatementNode(statementNode) { return this.node.match(statementNode); }
|
|
99
133
|
|
|
100
134
|
verify(assignments, stated, context) {
|
package/src/ontology/step.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import ontology from "../ontology";
|
|
4
4
|
import unifyMixins from "../mixins/step/unify";
|
|
5
5
|
import TemporaryContext from "../context/temporary";
|
|
6
|
-
import equationalUnifier from "../unifier/equantional";
|
|
7
6
|
|
|
8
7
|
import { define } from "../ontology";
|
|
8
|
+
import { equateStatements } from "../process/equate";
|
|
9
9
|
import { propertyAssertionFromStatement } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class Step {
|
|
@@ -158,13 +158,13 @@ export default define(class Step {
|
|
|
158
158
|
equateWithStatement(statement, context) {
|
|
159
159
|
let statementEquates;
|
|
160
160
|
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
const leftStatement = statement, ///
|
|
162
|
+
rightStatement = this.statement, ///
|
|
163
|
+
leftStatementNode = leftStatement.getNode(),
|
|
164
|
+
rightStatementNode = rightStatement.getNode(),
|
|
165
|
+
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
166
166
|
|
|
167
|
-
statementEquates =
|
|
167
|
+
statementEquates = statementsEquate; ///
|
|
168
168
|
|
|
169
169
|
return statementEquates;
|
|
170
170
|
}
|
|
@@ -40,35 +40,31 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
40
40
|
|
|
41
41
|
const frameSubstitutionString = this.string; ///
|
|
42
42
|
|
|
43
|
-
context.trace(`Verifiying the '${frameSubstitutionString}' frame
|
|
43
|
+
context.trace(`Verifiying the '${frameSubstitutionString}' frame substitution...`);
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const frameSingular = this.frame.isSingular();
|
|
46
46
|
|
|
47
|
-
if (
|
|
48
|
-
if (this.metavariable
|
|
49
|
-
context.debug(`The specific frame is not simple.`);
|
|
50
|
-
} else {
|
|
47
|
+
if (frameSingular) {
|
|
48
|
+
if (this.metavariable !== null) {
|
|
51
49
|
const metavariablePresent = context.isMetavariablePresent(this.metavariable);
|
|
52
50
|
|
|
53
51
|
if (metavariablePresent) {
|
|
54
|
-
const
|
|
55
|
-
|
|
52
|
+
const frameMetavariable = this.frame.getMetavariable(),
|
|
53
|
+
frameMetavariablePresent = context.isMetavariablePresent(frameMetavariable);
|
|
56
54
|
|
|
57
|
-
if (
|
|
55
|
+
if (frameMetavariablePresent) {
|
|
58
56
|
verifies = true;
|
|
59
57
|
} else {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
context.debug(`The '${metavariableString}' metavariable is not present.`);
|
|
58
|
+
context.debug(`The '${frameSubstitutionString}' frame substitution's general frame's metavariable is not present.`);
|
|
63
59
|
}
|
|
64
60
|
} else {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
context.debug(`The '${metavariableString}' metavariable is not present.`);
|
|
61
|
+
context.debug(`The '${frameSubstitutionString}' frame substitution's specific frame's metavariable is not present.`);
|
|
68
62
|
}
|
|
63
|
+
} else {
|
|
64
|
+
context.debug(`The '${frameSubstitutionString}' frame substitution's general frame is not singular.`);
|
|
69
65
|
}
|
|
70
66
|
} else {
|
|
71
|
-
context.debug(`The
|
|
67
|
+
context.debug(`The '${frameSubstitutionString}' frame substitution's specific frame is not singular.`);
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
if (verifies) {
|
|
@@ -76,7 +72,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
76
72
|
|
|
77
73
|
context.addSubstitution(substititoin);
|
|
78
74
|
|
|
79
|
-
context.debug(`...verified the '${frameSubstitutionString}' frame
|
|
75
|
+
context.debug(`...verified the '${frameSubstitutionString}' frame substitution.`);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
return verifies;
|