occam-verify-cli 0.0.968 → 0.0.971
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/bin/action/verify.js +6 -8
- package/lib/constants.js +5 -1
- package/lib/context/file.js +48 -53
- package/lib/context/local.js +45 -39
- package/lib/context/release.js +3 -3
- package/lib/declaration.js +9 -7
- package/lib/equivalence.js +23 -21
- package/lib/judgement.js +3 -3
- package/lib/label.js +3 -3
- package/lib/log.js +3 -3
- package/lib/metaType.js +7 -7
- package/lib/metavariable.js +7 -7
- package/lib/node/term/bracketed.js +16 -0
- package/lib/proofStep.js +3 -29
- package/lib/releaseContext/initialise.js +11 -17
- package/lib/resolve/substitutions.js +99 -0
- package/lib/rule.js +10 -6
- package/lib/substitution/statementForMetavariable.js +93 -98
- package/lib/substitution/termForVariable.js +45 -54
- package/lib/substitution.js +51 -9
- package/lib/substitutions.js +165 -12
- package/lib/term.js +8 -1
- package/lib/topLevelAssertion.js +10 -6
- package/lib/type.js +5 -5
- package/lib/unifier/metaLevel.js +10 -3
- package/lib/unifier/statementWithCombinator.js +6 -6
- package/lib/unifier.js +2 -2
- package/lib/unify/metavariableWithStatement.js +13 -48
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +39 -0
- package/lib/unify/premiseWithProofStep.js +3 -3
- package/lib/unify/statement/qualified.js +117 -0
- package/lib/unify/statement/unqualified.js +25 -0
- package/lib/unify/statementWithBracketedCombinator.js +3 -3
- package/lib/unify/statementWithCombinators.js +5 -5
- package/lib/unify/statementWithMetaType.js +3 -3
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +45 -0
- package/lib/unify/suppositionWithProffStep.js +3 -3
- package/lib/unify/variableWithTerm.js +11 -26
- package/lib/utilities/array.js +5 -14
- package/lib/utilities/assertion.js +24 -0
- package/lib/utilities/brackets.js +60 -0
- package/lib/utilities/message.js +52 -0
- package/lib/utilities/name.js +7 -7
- package/lib/utilities/node.js +10 -17
- package/lib/utilities/string.js +1 -7
- package/lib/utilities/subproof.js +19 -0
- package/lib/utilities/unify.js +30 -11
- package/lib/variable.js +8 -8
- package/lib/verifier/metaLevel.js +6 -6
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verify/assertion/contained.js +66 -32
- package/lib/verify/assertion/defined.js +51 -46
- package/lib/verify/assertion/subproof.js +9 -9
- package/lib/verify/assertion/type.js +11 -11
- package/lib/verify/conclusion.js +6 -6
- package/lib/verify/consequent.js +6 -6
- package/lib/verify/declaration/metavariable.js +2 -2
- package/lib/verify/declaration.js +34 -20
- package/lib/verify/equality.js +13 -13
- package/lib/verify/frame.js +38 -24
- package/lib/verify/judgement.js +13 -13
- package/lib/verify/metavariable.js +2 -2
- package/lib/verify/premise.js +5 -5
- package/lib/verify/proofStep.js +15 -24
- package/lib/verify/statement/qualified.js +15 -124
- package/lib/verify/statement/unqualified.js +23 -24
- package/lib/verify/statement.js +24 -24
- package/lib/verify/statementGivenMetaType.js +3 -3
- package/lib/verify/supposition.js +5 -5
- package/package.json +2 -2
- package/src/constants.js +1 -0
- package/src/context/file.js +49 -55
- package/src/context/local.js +34 -31
- package/src/context/release.js +2 -2
- package/src/declaration.js +12 -10
- package/src/equivalence.js +27 -26
- package/src/judgement.js +2 -2
- package/src/label.js +2 -2
- package/src/log.js +1 -1
- package/src/metaType.js +7 -7
- package/src/metavariable.js +7 -7
- package/src/node/term/bracketed.js +9 -0
- package/src/proofStep.js +3 -48
- package/src/releaseContext/initialise.js +13 -24
- package/src/resolve/substitutions.js +134 -0
- package/src/rule.js +10 -5
- package/src/substitution/statementForMetavariable.js +99 -85
- package/src/substitution/termForVariable.js +50 -65
- package/src/substitution.js +46 -8
- package/src/substitutions.js +176 -10
- package/src/term.js +6 -0
- package/src/topLevelAssertion.js +10 -5
- package/src/type.js +4 -4
- package/src/unifier/metaLevel.js +11 -3
- package/src/unifier/statementWithCombinator.js +5 -5
- package/src/unifier.js +1 -1
- package/src/unify/metavariableWithStatement.js +17 -71
- package/src/unify/metavariableWithStatementGivenSubstitution.js +39 -0
- package/src/unify/premiseWithProofStep.js +1 -1
- package/src/unify/statement/qualified.js +183 -0
- package/src/unify/statement/unqualified.js +24 -0
- package/src/unify/statementWithBracketedCombinator.js +2 -2
- package/src/unify/statementWithCombinators.js +4 -4
- package/src/unify/statementWithMetaType.js +2 -2
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +51 -0
- package/src/unify/suppositionWithProffStep.js +1 -1
- package/src/unify/variableWithTerm.js +14 -35
- package/src/utilities/array.js +1 -16
- package/src/utilities/assertion.js +19 -0
- package/src/utilities/brackets.js +56 -0
- package/src/utilities/name.js +8 -8
- package/src/utilities/node.js +14 -17
- package/src/utilities/string.js +2 -2
- package/src/utilities/subproof.js +18 -0
- package/src/utilities/unify.js +24 -12
- package/src/variable.js +11 -11
- package/src/verifier/metaLevel.js +5 -5
- package/src/verifier/statementAsCombinator.js +2 -2
- package/src/verify/assertion/contained.js +80 -38
- package/src/verify/assertion/defined.js +64 -55
- package/src/verify/assertion/subproof.js +8 -8
- package/src/verify/assertion/type.js +11 -11
- package/src/verify/conclusion.js +8 -8
- package/src/verify/consequent.js +8 -8
- package/src/verify/declaration/metavariable.js +4 -3
- package/src/verify/declaration.js +46 -23
- package/src/verify/equality.js +13 -13
- package/src/verify/frame.js +48 -28
- package/src/verify/judgement.js +13 -13
- package/src/verify/metavariable.js +3 -3
- package/src/verify/premise.js +6 -6
- package/src/verify/proofStep.js +14 -31
- package/src/verify/statement/qualified.js +18 -199
- package/src/verify/statement/unqualified.js +25 -31
- package/src/verify/statement.js +23 -23
- package/src/verify/statementGivenMetaType.js +2 -2
- package/src/verify/supposition.js +6 -6
- package/lib/unify/statementAtainstStatement.js +0 -49
- package/lib/utilities/lineIndex.js +0 -52
- package/lib/utilities/match.js +0 -59
- package/lib/utilities/verify.js +0 -19
- package/src/unify/statementAtainstStatement.js +0 -56
- package/src/utilities/match.js +0 -53
- package/src/utilities/verify.js +0 -14
- /package/src/utilities/{lineIndex.js → message.js} +0 -0
package/src/context/file.js
CHANGED
|
@@ -288,9 +288,9 @@ export default class FileContext {
|
|
|
288
288
|
types.push(objectType);
|
|
289
289
|
|
|
290
290
|
const type = types.find((type) => {
|
|
291
|
-
const
|
|
291
|
+
const typeNameMatches = type.matchTypeName(typeName);
|
|
292
292
|
|
|
293
|
-
if (
|
|
293
|
+
if (typeNameMatches) {
|
|
294
294
|
return true;
|
|
295
295
|
}
|
|
296
296
|
}) || null;
|
|
@@ -304,9 +304,9 @@ export default class FileContext {
|
|
|
304
304
|
types.push(objectType);
|
|
305
305
|
|
|
306
306
|
const type = types.find((type) => {
|
|
307
|
-
const
|
|
307
|
+
const nodeMatches = type.matchTypeNode(typeNode);
|
|
308
308
|
|
|
309
|
-
if (
|
|
309
|
+
if (nodeMatches) {
|
|
310
310
|
return true;
|
|
311
311
|
}
|
|
312
312
|
}) || null;
|
|
@@ -314,26 +314,13 @@ export default class FileContext {
|
|
|
314
314
|
return type;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
findMetavariableByName(name) {
|
|
318
|
-
const metavariables = this.getMetavariables(),
|
|
319
|
-
metavariable = metavariables.find((metavariable) => {
|
|
320
|
-
const matches = metavariable.matchName(name);
|
|
321
|
-
|
|
322
|
-
if (matches) {
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
}) || null;
|
|
326
|
-
|
|
327
|
-
return metavariable;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
317
|
findVariableByVariableNode(variableNode) {
|
|
331
318
|
const node = variableNode, ///
|
|
332
319
|
variables = this.getVariables(),
|
|
333
320
|
variable = variables.find((variable) => {
|
|
334
|
-
const
|
|
321
|
+
const nodeMatches = variable.matchNode(node);
|
|
335
322
|
|
|
336
|
-
if (
|
|
323
|
+
if (nodeMatches) {
|
|
337
324
|
return true;
|
|
338
325
|
}
|
|
339
326
|
}) || null;
|
|
@@ -344,9 +331,9 @@ export default class FileContext {
|
|
|
344
331
|
findMetaTypeByMetaTypeNode(metaTypeNode) {
|
|
345
332
|
const metaTypes = this.getMetaTypes(),
|
|
346
333
|
metaType = metaTypes.find((metaType) => {
|
|
347
|
-
const
|
|
334
|
+
const metaTypeNodeMatches = metaType.matchMetaTypeNode(metaTypeNode);
|
|
348
335
|
|
|
349
|
-
if (
|
|
336
|
+
if (metaTypeNodeMatches) {
|
|
350
337
|
return true;
|
|
351
338
|
}
|
|
352
339
|
}) || null;
|
|
@@ -357,9 +344,9 @@ export default class FileContext {
|
|
|
357
344
|
findLabelByMetavariableNode(metavariableNode) {
|
|
358
345
|
const labels = this.getLabels(),
|
|
359
346
|
label = labels.find((label) => {
|
|
360
|
-
const
|
|
347
|
+
const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
|
|
361
348
|
|
|
362
|
-
if (
|
|
349
|
+
if (metavariableNodeMatches) {
|
|
363
350
|
return true;
|
|
364
351
|
}
|
|
365
352
|
}) || null;
|
|
@@ -370,9 +357,9 @@ export default class FileContext {
|
|
|
370
357
|
findRuleByMetavariableNode(metavariableNode) {
|
|
371
358
|
const rules = this.getRules(),
|
|
372
359
|
rule = rules.find((rule) => {
|
|
373
|
-
const
|
|
360
|
+
const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
|
|
374
361
|
|
|
375
|
-
if (
|
|
362
|
+
if (metavariableNodeMatches) {
|
|
376
363
|
return true;
|
|
377
364
|
}
|
|
378
365
|
}) || null;
|
|
@@ -383,9 +370,9 @@ export default class FileContext {
|
|
|
383
370
|
findAxiomByMetavariableNode(metavariableNode) {
|
|
384
371
|
const axioms = this.getAxioms(),
|
|
385
372
|
axiom = axioms.find((axiom) => {
|
|
386
|
-
const
|
|
373
|
+
const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
|
|
387
374
|
|
|
388
|
-
if (
|
|
375
|
+
if (metavariableNodeMatches) {
|
|
389
376
|
return true;
|
|
390
377
|
}
|
|
391
378
|
}) || null;
|
|
@@ -396,9 +383,9 @@ export default class FileContext {
|
|
|
396
383
|
findLemmaByMetavariableNode(metavariableNode) {
|
|
397
384
|
const lemmas = this.getLemmas(),
|
|
398
385
|
lemma = lemmas.find((lemma) => {
|
|
399
|
-
const
|
|
386
|
+
const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
|
|
400
387
|
|
|
401
|
-
if (
|
|
388
|
+
if (metavariableNodeMatches) {
|
|
402
389
|
return true;
|
|
403
390
|
}
|
|
404
391
|
}) || null;
|
|
@@ -409,9 +396,9 @@ export default class FileContext {
|
|
|
409
396
|
findTheoremByMetavariableNode(metavariableNode) {
|
|
410
397
|
const theorems = this.getTheorems(),
|
|
411
398
|
theorem = theorems.find((theorem) => {
|
|
412
|
-
const
|
|
399
|
+
const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
|
|
413
400
|
|
|
414
|
-
if (
|
|
401
|
+
if (metavariableNodeMatches) {
|
|
415
402
|
return true;
|
|
416
403
|
}
|
|
417
404
|
}) || null;
|
|
@@ -422,9 +409,9 @@ export default class FileContext {
|
|
|
422
409
|
findMetaLemmaByMetavariableNode(metavariableNode) {
|
|
423
410
|
const metaLemmas = this.getMetaLemmas(),
|
|
424
411
|
metaLemma = metaLemmas.find((metaLemma) => {
|
|
425
|
-
const
|
|
412
|
+
const metavariableNodeMatches = metaLemma.matchMetavariableNode(metavariableNode);
|
|
426
413
|
|
|
427
|
-
if (
|
|
414
|
+
if (metavariableNodeMatches) {
|
|
428
415
|
return true;
|
|
429
416
|
}
|
|
430
417
|
}) || null;
|
|
@@ -435,9 +422,9 @@ export default class FileContext {
|
|
|
435
422
|
findConjectureByMetavariableNode(metavariableNode) {
|
|
436
423
|
const conjectures = this.getConjectures(),
|
|
437
424
|
conjecture = conjectures.find((conjecture) => {
|
|
438
|
-
const
|
|
425
|
+
const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
|
|
439
426
|
|
|
440
|
-
if (
|
|
427
|
+
if (metavariableNodeMatches) {
|
|
441
428
|
return true;
|
|
442
429
|
}
|
|
443
430
|
}) || null;
|
|
@@ -448,9 +435,9 @@ export default class FileContext {
|
|
|
448
435
|
findMetatheoremByMetavariableNode(metavariableNode) {
|
|
449
436
|
const metatheorems = this.getMetatheorems(),
|
|
450
437
|
metatheorem = metatheorems.find((metatheorem) => {
|
|
451
|
-
const
|
|
438
|
+
const metavariableNodeMatches = metatheorem.matchMetavariableNode(metavariableNode);
|
|
452
439
|
|
|
453
|
-
if (
|
|
440
|
+
if (metavariableNodeMatches) {
|
|
454
441
|
return true;
|
|
455
442
|
}
|
|
456
443
|
}) || null;
|
|
@@ -459,12 +446,25 @@ export default class FileContext {
|
|
|
459
446
|
}
|
|
460
447
|
|
|
461
448
|
findMetavariableByMetavariableNode(metavariableNode) {
|
|
462
|
-
const
|
|
449
|
+
const metavariables = this.getMetavariables(),
|
|
450
|
+
metavariable = metavariables.find((metavariable) => {
|
|
451
|
+
const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode);
|
|
452
|
+
|
|
453
|
+
if (metavariableNodeMatches) {
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
}) || null;
|
|
457
|
+
|
|
458
|
+
return metavariable;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
findMetavariableByMetavariableName(metavariableName) {
|
|
462
|
+
const name = metavariableName, ///
|
|
463
463
|
metavariables = this.getMetavariables(),
|
|
464
464
|
metavariable = metavariables.find((metavariable) => {
|
|
465
|
-
const
|
|
465
|
+
const nameMatches = metavariable.matchName(name);
|
|
466
466
|
|
|
467
|
-
if (
|
|
467
|
+
if (nameMatches) {
|
|
468
468
|
return true;
|
|
469
469
|
}
|
|
470
470
|
}) || null;
|
|
@@ -486,13 +486,6 @@ export default class FileContext {
|
|
|
486
486
|
return typePresent;
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
isMetavariablePresentByName(name) {
|
|
490
|
-
const metavariable = this.findMetavariableByName(name),
|
|
491
|
-
metavariablePresent = (metavariable !== null);
|
|
492
|
-
|
|
493
|
-
return metavariablePresent;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
489
|
isVariablePresentByVariableNode(variableNode) {
|
|
497
490
|
const variable = this.findVariableByVariableNode(variableNode),
|
|
498
491
|
variablePresent = (variable !== null);
|
|
@@ -507,6 +500,13 @@ export default class FileContext {
|
|
|
507
500
|
return labelPresent;
|
|
508
501
|
}
|
|
509
502
|
|
|
503
|
+
isMetavariablePresentByMetavariableName(metavariablename) {
|
|
504
|
+
const metavariable = this.findMetavariableByMetavariableName(metavariablename),
|
|
505
|
+
metavariablePresent = (metavariable !== null);
|
|
506
|
+
|
|
507
|
+
return metavariablePresent;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
510
|
isMetavariablePresentByMetavariableNode(metavariableNode) {
|
|
511
511
|
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
|
|
512
512
|
metavariablePresent = (metavariable !== null);
|
|
@@ -590,14 +590,8 @@ export default class FileContext {
|
|
|
590
590
|
addMetavariable(metavariable) {
|
|
591
591
|
let metavariableAdded = false;
|
|
592
592
|
|
|
593
|
-
const
|
|
594
|
-
metavariablePresent = this.
|
|
595
|
-
const metavariableMatchesNode = metavariable.matchName(name);
|
|
596
|
-
|
|
597
|
-
if (metavariableMatchesNode) {
|
|
598
|
-
return true;
|
|
599
|
-
}
|
|
600
|
-
});
|
|
593
|
+
const metavariableName = metavariable.getName(),
|
|
594
|
+
metavariablePresent = this.isMetavariablePresentByMetavariableName(metavariableName);
|
|
601
595
|
|
|
602
596
|
if (!metavariablePresent) {
|
|
603
597
|
this.metavariables.push(metavariable);
|
package/src/context/local.js
CHANGED
|
@@ -211,14 +211,8 @@ class LocalContext {
|
|
|
211
211
|
addMetavariable(metavariable) {
|
|
212
212
|
let metavariableAdded = false;
|
|
213
213
|
|
|
214
|
-
const
|
|
215
|
-
metavariablePresent = this.
|
|
216
|
-
const metavariableMatchesNode = metavariable.matchNode(node);
|
|
217
|
-
|
|
218
|
-
if (metavariableMatchesNode) {
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
});
|
|
214
|
+
const metavariableName = metavariable.getName(),
|
|
215
|
+
metavariablePresent = this.isMetavariablePresentByMetavariableName(metavariableName);
|
|
222
216
|
|
|
223
217
|
if (!metavariablePresent) {
|
|
224
218
|
this.metavariables.push(metavariable);
|
|
@@ -276,9 +270,10 @@ class LocalContext {
|
|
|
276
270
|
groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
|
|
277
271
|
|
|
278
272
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
279
|
-
const
|
|
273
|
+
const groundedTermNode = groundedTerm.getNode(),
|
|
274
|
+
groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
|
|
280
275
|
|
|
281
|
-
if (
|
|
276
|
+
if (groundedTermNodeMatches) {
|
|
282
277
|
return true;
|
|
283
278
|
}
|
|
284
279
|
}),
|
|
@@ -307,6 +302,20 @@ class LocalContext {
|
|
|
307
302
|
return variableDefined;
|
|
308
303
|
}
|
|
309
304
|
|
|
305
|
+
isMetavariableDefined(metavariable) {
|
|
306
|
+
const judgements = this.getJudgements(),
|
|
307
|
+
metavariableNode = metavariable.getNode(),
|
|
308
|
+
metavariableDefined = judgements.some((judgement) => {
|
|
309
|
+
const metavariableNodeMatchesJudgement = judgement.matchMetavariableNode(metavariableNode);
|
|
310
|
+
|
|
311
|
+
if (metavariableNodeMatchesJudgement) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
return metavariableDefined
|
|
317
|
+
}
|
|
318
|
+
|
|
310
319
|
isVariablePresentByVariableNode(variableNode) {
|
|
311
320
|
const variable = this.findVariableByVariableNode(variableNode),
|
|
312
321
|
variablePresent = (variable !== null);
|
|
@@ -325,24 +334,19 @@ class LocalContext {
|
|
|
325
334
|
|
|
326
335
|
isTypePresentByTypeNode(typeNode) { return this.context.isTypePresentByTypeNode(typeNode); }
|
|
327
336
|
|
|
328
|
-
isMetavariablePresentByName(name) { return this.context.isMetavariablePresentByName(name); }
|
|
329
|
-
|
|
330
337
|
isLabelPresentByMetavariableNode(metavariableNode) { return this.context.isLabelPresentByMetavariableNode(metavariableNode); }
|
|
331
338
|
|
|
332
|
-
|
|
333
|
-
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
|
|
334
|
-
metavariablePresent = (metavariable !== null);
|
|
339
|
+
isMetavariablePresentByMetavariableName(metavariableName) { return this.context.isMetavariablePresentByMetavariableName(metavariableName); }
|
|
335
340
|
|
|
336
|
-
|
|
337
|
-
}
|
|
341
|
+
isMetavariablePresentByMetavariableNode(metavariableNode) { return this.context.isMetavariablePresentByMetavariableNode(metavariableNode); }
|
|
338
342
|
|
|
339
343
|
findVariableByVariableNode(variableNode) {
|
|
340
344
|
const node = variableNode, ///
|
|
341
345
|
variables = this.getVariables(),
|
|
342
346
|
variable = variables.find((variable) => {
|
|
343
|
-
const
|
|
347
|
+
const nodeMatches = variable.matchNode(node);
|
|
344
348
|
|
|
345
|
-
if (
|
|
349
|
+
if (nodeMatches) {
|
|
346
350
|
return true;
|
|
347
351
|
}
|
|
348
352
|
}) || null;
|
|
@@ -364,13 +368,12 @@ class LocalContext {
|
|
|
364
368
|
}
|
|
365
369
|
|
|
366
370
|
findMetavariableByMetavariableNode(metavariableNode) {
|
|
367
|
-
const
|
|
368
|
-
localContext = this, ///
|
|
371
|
+
const localContext = this, ///
|
|
369
372
|
metavariables = this.getMetavariables(),
|
|
370
373
|
metavariable = metavariables.find((metavariable) => {
|
|
371
|
-
const
|
|
374
|
+
const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode, localContext);
|
|
372
375
|
|
|
373
|
-
if (
|
|
376
|
+
if (metavariableNodeMatches) {
|
|
374
377
|
return true;
|
|
375
378
|
}
|
|
376
379
|
}) || null;
|
|
@@ -382,8 +385,6 @@ class LocalContext {
|
|
|
382
385
|
|
|
383
386
|
findTypeByTypeNode(typeNode) { return this.context.findTypeByTypeNode(typeNode); }
|
|
384
387
|
|
|
385
|
-
findMetavariableByName(name) { return this.context.findMetavariableByName(name); }
|
|
386
|
-
|
|
387
388
|
findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
|
|
388
389
|
|
|
389
390
|
findMetaTypeByMetaTypeNode(metaTypeNode) { return this.context.findMetaTypeByMetaTypeNode(metaTypeNode); }
|
|
@@ -402,21 +403,23 @@ class LocalContext {
|
|
|
402
403
|
|
|
403
404
|
findMetatheoremByMetavariableNode(metavariableNode) { return this.context.findMetatheoremByMetavariableNode(metavariableNode); }
|
|
404
405
|
|
|
406
|
+
findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
|
|
407
|
+
|
|
405
408
|
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
406
409
|
|
|
407
410
|
nodesAsString(node) { return this.context.nodesAsString(node); }
|
|
408
411
|
|
|
409
|
-
trace(
|
|
412
|
+
trace(message, node) { this.context.trace(message, node); }
|
|
410
413
|
|
|
411
|
-
debug(
|
|
414
|
+
debug(message, node) { this.context.debug(message, node); }
|
|
412
415
|
|
|
413
|
-
info(
|
|
416
|
+
info(message, node) { this.context.info(message, node); }
|
|
414
417
|
|
|
415
|
-
warning(
|
|
418
|
+
warning(message, node) { this.context.warning(message, node); }
|
|
416
419
|
|
|
417
|
-
error(
|
|
420
|
+
error(message, node) { this.context.error(message, node); }
|
|
418
421
|
|
|
419
|
-
fatal(
|
|
422
|
+
fatal(message, node) { this.context.fatal(node, message); }
|
|
420
423
|
|
|
421
424
|
static fromFileContext(fileContext) {
|
|
422
425
|
const context = fileContext, ///
|
package/src/context/release.js
CHANGED
|
@@ -377,9 +377,9 @@ export default class ReleaseContext {
|
|
|
377
377
|
types.push(objectType);
|
|
378
378
|
|
|
379
379
|
const type = types.find((type) => {
|
|
380
|
-
const
|
|
380
|
+
const typeNameMatches = type.matchTypeName(typeName);
|
|
381
381
|
|
|
382
|
-
if (
|
|
382
|
+
if (typeNameMatches) {
|
|
383
383
|
return true;
|
|
384
384
|
}
|
|
385
385
|
}) || null;
|
package/src/declaration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { stripBracketsFromStatement } from "./utilities/brackets";
|
|
4
4
|
|
|
5
5
|
export default class Declaration {
|
|
6
6
|
constructor(metavariableNode, statementNode) {
|
|
@@ -27,30 +27,32 @@ export default class Declaration {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
unifyMetavariable(metavariableNode) {
|
|
30
|
-
const
|
|
30
|
+
const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
|
|
31
31
|
|
|
32
|
-
return
|
|
32
|
+
return metavariableNodeMatches;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
unifyStatement(statementNode) {
|
|
36
|
-
|
|
37
|
-
statementNodeB = this.statementNode, ///
|
|
38
|
-
statementMatches = matchStatementModuloBrackets(statementNodeA, statementNodeB),
|
|
39
|
-
matchesStatementNode = statementMatches; ///
|
|
36
|
+
statementNode = stripBracketsFromStatement(statementNode); ///
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
const statementNodeMatches = this.statementNode.match(statementNode),
|
|
39
|
+
statementUnified = statementNodeMatches; ///
|
|
40
|
+
|
|
41
|
+
return statementUnified;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem) {
|
|
45
45
|
const consequent = metaLemmaMetatheorem.getConsequent(),
|
|
46
46
|
statementNode = consequent.getStatementNode(),
|
|
47
|
-
|
|
48
|
-
metaLemmaOrMetaTheoremUnified =
|
|
47
|
+
statementNodeMatches = this.statementNode.match(statementNode),
|
|
48
|
+
metaLemmaOrMetaTheoremUnified = statementNodeMatches; ///
|
|
49
49
|
|
|
50
50
|
return metaLemmaOrMetaTheoremUnified;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
|
|
54
|
+
statementNode = stripBracketsFromStatement(statementNode); ///
|
|
55
|
+
|
|
54
56
|
const declaration = new Declaration(metavariableNode, statementNode);
|
|
55
57
|
|
|
56
58
|
return declaration;
|
package/src/equivalence.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "./utilities/query";
|
|
4
|
+
import { stripBracketsFromTerm } from "./utilities/brackets";
|
|
4
5
|
|
|
5
6
|
const variableNodeQuery = nodeQuery("/term/variable!");
|
|
6
7
|
|
|
@@ -49,14 +50,14 @@ export default class Equivalence {
|
|
|
49
50
|
const typeB = type; ///
|
|
50
51
|
|
|
51
52
|
const typeAEqualToTypeB = typeA.isEqualTo(typeB),
|
|
52
|
-
|
|
53
|
+
typeMatches = typeAEqualToTypeB; ///
|
|
53
54
|
|
|
54
|
-
return
|
|
55
|
+
return typeMatches;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
matchTerm(term) {
|
|
58
59
|
const termA = term, ///
|
|
59
|
-
|
|
60
|
+
termMatches = this.terms.some((term) => {
|
|
60
61
|
const termB = term, ///
|
|
61
62
|
termAMatchesTermB = termA.match(termB);
|
|
62
63
|
|
|
@@ -65,39 +66,38 @@ export default class Equivalence {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
return
|
|
69
|
+
return termMatches;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
matchTerms(terms) {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
73
|
+
const termsMatch = terms.every((term) => {
|
|
74
|
+
const termMatches = this.matchTerm(term);
|
|
74
75
|
|
|
75
|
-
if (
|
|
76
|
+
if (termMatches) {
|
|
76
77
|
return true;
|
|
77
78
|
}
|
|
78
79
|
})
|
|
79
80
|
|
|
80
|
-
return
|
|
81
|
+
return termsMatch;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
matchTermNode(termNode) {
|
|
84
|
-
|
|
85
|
-
matchesTermNode = this.terms.some((term) => {
|
|
86
|
-
const termNode = term.getNode(),
|
|
87
|
-
termNodeB = termNode, ///
|
|
88
|
-
termNodeAMatchesTermB = termNodeA.match(termNodeB);
|
|
85
|
+
termNode = stripBracketsFromTerm(termNode); ///
|
|
89
86
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
const termNodeMatches = this.terms.some((term) => {
|
|
88
|
+
const termNodeMatches = term.matchTermNode(termNode);
|
|
89
|
+
|
|
90
|
+
if (termNodeMatches) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
94
|
|
|
95
|
-
return
|
|
95
|
+
return termNodeMatches;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
matchVariableNode(variableNode) {
|
|
99
99
|
const variableNodeA = variableNode, ///
|
|
100
|
-
|
|
100
|
+
variableNodeMatches = this.terms.some((term) => {
|
|
101
101
|
const termNode = term.getNode(),
|
|
102
102
|
variableNode = variableNodeQuery(termNode);
|
|
103
103
|
|
|
@@ -111,19 +111,19 @@ export default class Equivalence {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
return
|
|
114
|
+
return variableNodeMatches;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
matchTermNodes(termNodes) {
|
|
118
|
-
const
|
|
119
|
-
const
|
|
118
|
+
const termNodesMatch = termNodes.every((termNode) => {
|
|
119
|
+
const termNodeMatches = this.matchTermNode(termNode);
|
|
120
120
|
|
|
121
|
-
if (
|
|
121
|
+
if (termNodeMatches) {
|
|
122
122
|
return true;
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
return
|
|
126
|
+
return termNodesMatch;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
getGroundedTerms(definedVariables, groundedTerms, localContext) {
|
|
@@ -132,9 +132,10 @@ export default class Equivalence {
|
|
|
132
132
|
|
|
133
133
|
if (termGrounded) {
|
|
134
134
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
135
|
-
const
|
|
135
|
+
const groundedTermNode = groundedTerm.getNode(),
|
|
136
|
+
groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
|
|
136
137
|
|
|
137
|
-
if (
|
|
138
|
+
if (groundedTermNodeMatches) {
|
|
138
139
|
return true;
|
|
139
140
|
}
|
|
140
141
|
})
|
package/src/judgement.js
CHANGED
|
@@ -22,9 +22,9 @@ export default class Judgement {
|
|
|
22
22
|
getDeclarations() { return this.frame.getDeclarations(); }
|
|
23
23
|
|
|
24
24
|
matchMetavariableNode(metavariableNode) {
|
|
25
|
-
const
|
|
25
|
+
const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return metavariableNodeMatches;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
unifyMetaLemmaOrmetatheorem(metaLemmaMetatheorem) { return this.frame.unifyMetaLemmaOrmetatheorem(metaLemmaMetatheorem); }
|
package/src/label.js
CHANGED
|
@@ -12,9 +12,9 @@ export default class Label {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
matchMetavariableNode(metavariableNode) {
|
|
15
|
-
const
|
|
15
|
+
const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return metavariableNodeMatches;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
asString(tokens) {
|
package/src/log.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { levels } from "necessary";
|
|
4
4
|
|
|
5
|
-
import { leastLineIndexFromNodeAndTokens, greatestLineIndexFromNodeAndTokens } from "./utilities/
|
|
5
|
+
import { leastLineIndexFromNodeAndTokens, greatestLineIndexFromNodeAndTokens } from "./utilities/message";
|
|
6
6
|
|
|
7
7
|
const { TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARNING_LEVEL, ERROR_LEVEL, FATAL_LEVEL } = levels;
|
|
8
8
|
|
package/src/metaType.js
CHANGED
|
@@ -25,23 +25,23 @@ export default class MetaType {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
matchName(name) {
|
|
28
|
-
const
|
|
28
|
+
const nameMatches = (this.name === name);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return nameMatches;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
matchMetaTypeName(metaTypeName) {
|
|
34
|
-
const
|
|
34
|
+
const metaTypeNameMatches = (this.name === metaTypeName);
|
|
35
35
|
|
|
36
|
-
return
|
|
36
|
+
return metaTypeNameMatches;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
matchMetaTypeNode(metaTypeNode) {
|
|
40
40
|
const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
metaTypeNameMatches = this.matchMetaTypeName(metaTypeName),
|
|
42
|
+
metaTypeNodeMatches = metaTypeNameMatches; ///
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return metaTypeNodeMatches;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
asString(tokens) {
|
package/src/metavariable.js
CHANGED
|
@@ -4,7 +4,7 @@ import verifyTermGivenType from "./verify/termGivenType";
|
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "./utilities/query";
|
|
6
6
|
import { nodeAsString } from "./utilities/string";
|
|
7
|
-
import {
|
|
7
|
+
import { metavariableNameFromMetavariableNode } from "./utilities/name";
|
|
8
8
|
|
|
9
9
|
const termNodeQuery = nodeQuery("/metavariable/argument/term!"),
|
|
10
10
|
typeNodeQuery = nodeQuery("/metavariable/argument/type!");
|
|
@@ -40,19 +40,19 @@ export default class Metavariable {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
matchName(name) {
|
|
43
|
-
const
|
|
43
|
+
const nameMatches = (this.name === name);
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return nameMatches;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
matchMetavariableNode(metavariableNode, localContext) {
|
|
49
49
|
let matchesNode = false;
|
|
50
50
|
|
|
51
|
-
const
|
|
52
|
-
typeNode = typeNodeQuery(metavariableNode);
|
|
51
|
+
const typeNode = typeNodeQuery(metavariableNode);
|
|
53
52
|
|
|
54
53
|
if (typeNode === null) {
|
|
55
|
-
const
|
|
54
|
+
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
55
|
+
name = metavariableName; ///
|
|
56
56
|
|
|
57
57
|
if (this.name === name) {
|
|
58
58
|
const termNode = termNodeQuery(metavariableNode);
|