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.
Files changed (145) hide show
  1. package/bin/action/verify.js +6 -8
  2. package/lib/constants.js +5 -1
  3. package/lib/context/file.js +48 -53
  4. package/lib/context/local.js +45 -39
  5. package/lib/context/release.js +3 -3
  6. package/lib/declaration.js +9 -7
  7. package/lib/equivalence.js +23 -21
  8. package/lib/judgement.js +3 -3
  9. package/lib/label.js +3 -3
  10. package/lib/log.js +3 -3
  11. package/lib/metaType.js +7 -7
  12. package/lib/metavariable.js +7 -7
  13. package/lib/node/term/bracketed.js +16 -0
  14. package/lib/proofStep.js +3 -29
  15. package/lib/releaseContext/initialise.js +11 -17
  16. package/lib/resolve/substitutions.js +99 -0
  17. package/lib/rule.js +10 -6
  18. package/lib/substitution/statementForMetavariable.js +93 -98
  19. package/lib/substitution/termForVariable.js +45 -54
  20. package/lib/substitution.js +51 -9
  21. package/lib/substitutions.js +165 -12
  22. package/lib/term.js +8 -1
  23. package/lib/topLevelAssertion.js +10 -6
  24. package/lib/type.js +5 -5
  25. package/lib/unifier/metaLevel.js +10 -3
  26. package/lib/unifier/statementWithCombinator.js +6 -6
  27. package/lib/unifier.js +2 -2
  28. package/lib/unify/metavariableWithStatement.js +13 -48
  29. package/lib/unify/metavariableWithStatementGivenSubstitution.js +39 -0
  30. package/lib/unify/premiseWithProofStep.js +3 -3
  31. package/lib/unify/statement/qualified.js +117 -0
  32. package/lib/unify/statement/unqualified.js +25 -0
  33. package/lib/unify/statementWithBracketedCombinator.js +3 -3
  34. package/lib/unify/statementWithCombinators.js +5 -5
  35. package/lib/unify/statementWithMetaType.js +3 -3
  36. package/lib/unify/statementWithSttaemetnGivenEquivalences.js +45 -0
  37. package/lib/unify/suppositionWithProffStep.js +3 -3
  38. package/lib/unify/variableWithTerm.js +11 -26
  39. package/lib/utilities/array.js +5 -14
  40. package/lib/utilities/assertion.js +24 -0
  41. package/lib/utilities/brackets.js +60 -0
  42. package/lib/utilities/message.js +52 -0
  43. package/lib/utilities/name.js +7 -7
  44. package/lib/utilities/node.js +10 -17
  45. package/lib/utilities/string.js +1 -7
  46. package/lib/utilities/subproof.js +19 -0
  47. package/lib/utilities/unify.js +30 -11
  48. package/lib/variable.js +8 -8
  49. package/lib/verifier/metaLevel.js +6 -6
  50. package/lib/verifier/statementAsCombinator.js +2 -2
  51. package/lib/verify/assertion/contained.js +66 -32
  52. package/lib/verify/assertion/defined.js +51 -46
  53. package/lib/verify/assertion/subproof.js +9 -9
  54. package/lib/verify/assertion/type.js +11 -11
  55. package/lib/verify/conclusion.js +6 -6
  56. package/lib/verify/consequent.js +6 -6
  57. package/lib/verify/declaration/metavariable.js +2 -2
  58. package/lib/verify/declaration.js +34 -20
  59. package/lib/verify/equality.js +13 -13
  60. package/lib/verify/frame.js +38 -24
  61. package/lib/verify/judgement.js +13 -13
  62. package/lib/verify/metavariable.js +2 -2
  63. package/lib/verify/premise.js +5 -5
  64. package/lib/verify/proofStep.js +15 -24
  65. package/lib/verify/statement/qualified.js +15 -124
  66. package/lib/verify/statement/unqualified.js +23 -24
  67. package/lib/verify/statement.js +24 -24
  68. package/lib/verify/statementGivenMetaType.js +3 -3
  69. package/lib/verify/supposition.js +5 -5
  70. package/package.json +2 -2
  71. package/src/constants.js +1 -0
  72. package/src/context/file.js +49 -55
  73. package/src/context/local.js +34 -31
  74. package/src/context/release.js +2 -2
  75. package/src/declaration.js +12 -10
  76. package/src/equivalence.js +27 -26
  77. package/src/judgement.js +2 -2
  78. package/src/label.js +2 -2
  79. package/src/log.js +1 -1
  80. package/src/metaType.js +7 -7
  81. package/src/metavariable.js +7 -7
  82. package/src/node/term/bracketed.js +9 -0
  83. package/src/proofStep.js +3 -48
  84. package/src/releaseContext/initialise.js +13 -24
  85. package/src/resolve/substitutions.js +134 -0
  86. package/src/rule.js +10 -5
  87. package/src/substitution/statementForMetavariable.js +99 -85
  88. package/src/substitution/termForVariable.js +50 -65
  89. package/src/substitution.js +46 -8
  90. package/src/substitutions.js +176 -10
  91. package/src/term.js +6 -0
  92. package/src/topLevelAssertion.js +10 -5
  93. package/src/type.js +4 -4
  94. package/src/unifier/metaLevel.js +11 -3
  95. package/src/unifier/statementWithCombinator.js +5 -5
  96. package/src/unifier.js +1 -1
  97. package/src/unify/metavariableWithStatement.js +17 -71
  98. package/src/unify/metavariableWithStatementGivenSubstitution.js +39 -0
  99. package/src/unify/premiseWithProofStep.js +1 -1
  100. package/src/unify/statement/qualified.js +183 -0
  101. package/src/unify/statement/unqualified.js +24 -0
  102. package/src/unify/statementWithBracketedCombinator.js +2 -2
  103. package/src/unify/statementWithCombinators.js +4 -4
  104. package/src/unify/statementWithMetaType.js +2 -2
  105. package/src/unify/statementWithSttaemetnGivenEquivalences.js +51 -0
  106. package/src/unify/suppositionWithProffStep.js +1 -1
  107. package/src/unify/variableWithTerm.js +14 -35
  108. package/src/utilities/array.js +1 -16
  109. package/src/utilities/assertion.js +19 -0
  110. package/src/utilities/brackets.js +56 -0
  111. package/src/utilities/name.js +8 -8
  112. package/src/utilities/node.js +14 -17
  113. package/src/utilities/string.js +2 -2
  114. package/src/utilities/subproof.js +18 -0
  115. package/src/utilities/unify.js +24 -12
  116. package/src/variable.js +11 -11
  117. package/src/verifier/metaLevel.js +5 -5
  118. package/src/verifier/statementAsCombinator.js +2 -2
  119. package/src/verify/assertion/contained.js +80 -38
  120. package/src/verify/assertion/defined.js +64 -55
  121. package/src/verify/assertion/subproof.js +8 -8
  122. package/src/verify/assertion/type.js +11 -11
  123. package/src/verify/conclusion.js +8 -8
  124. package/src/verify/consequent.js +8 -8
  125. package/src/verify/declaration/metavariable.js +4 -3
  126. package/src/verify/declaration.js +46 -23
  127. package/src/verify/equality.js +13 -13
  128. package/src/verify/frame.js +48 -28
  129. package/src/verify/judgement.js +13 -13
  130. package/src/verify/metavariable.js +3 -3
  131. package/src/verify/premise.js +6 -6
  132. package/src/verify/proofStep.js +14 -31
  133. package/src/verify/statement/qualified.js +18 -199
  134. package/src/verify/statement/unqualified.js +25 -31
  135. package/src/verify/statement.js +23 -23
  136. package/src/verify/statementGivenMetaType.js +2 -2
  137. package/src/verify/supposition.js +6 -6
  138. package/lib/unify/statementAtainstStatement.js +0 -49
  139. package/lib/utilities/lineIndex.js +0 -52
  140. package/lib/utilities/match.js +0 -59
  141. package/lib/utilities/verify.js +0 -19
  142. package/src/unify/statementAtainstStatement.js +0 -56
  143. package/src/utilities/match.js +0 -53
  144. package/src/utilities/verify.js +0 -14
  145. /package/src/utilities/{lineIndex.js → message.js} +0 -0
@@ -288,9 +288,9 @@ export default class FileContext {
288
288
  types.push(objectType);
289
289
 
290
290
  const type = types.find((type) => {
291
- const matches = type.matchTypeName(typeName);
291
+ const typeNameMatches = type.matchTypeName(typeName);
292
292
 
293
- if (matches) {
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 matches = type.matchTypeNode(typeNode);
307
+ const nodeMatches = type.matchTypeNode(typeNode);
308
308
 
309
- if (matches) {
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 variableMatchesNode = variable.matchNode(node);
321
+ const nodeMatches = variable.matchNode(node);
335
322
 
336
- if (variableMatchesNode) {
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 matches = metaType.matchMetaTypeNode(metaTypeNode);
334
+ const metaTypeNodeMatches = metaType.matchMetaTypeNode(metaTypeNode);
348
335
 
349
- if (matches) {
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 matches = label.matchMetavariableNode(metavariableNode);
347
+ const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
361
348
 
362
- if (matches) {
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 ruleMatchesMetavariableNode = rule.matchMetavariableNode(metavariableNode);
360
+ const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
374
361
 
375
- if (ruleMatchesMetavariableNode) {
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 axiomMatchesMetavariableNode = axiom.matchMetavariableNode(metavariableNode);
373
+ const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
387
374
 
388
- if (axiomMatchesMetavariableNode) {
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 lemmaMatchesMetavariableNode = lemma.matchMetavariableNode(metavariableNode);
386
+ const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
400
387
 
401
- if (lemmaMatchesMetavariableNode) {
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 theoremMatchesMetavariableNode = theorem.matchMetavariableNode(metavariableNode);
399
+ const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
413
400
 
414
- if (theoremMatchesMetavariableNode) {
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 metaLemmaMatchesMetavariableNode = metaLemma.matchMetavariableNode(metavariableNode);
412
+ const metavariableNodeMatches = metaLemma.matchMetavariableNode(metavariableNode);
426
413
 
427
- if (metaLemmaMatchesMetavariableNode) {
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 conjectureMatchesMetavariableNode = conjecture.matchMetavariableNode(metavariableNode);
425
+ const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
439
426
 
440
- if (conjectureMatchesMetavariableNode) {
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 metatheoremMatchesMetavariableNode = metatheorem.matchMetavariableNode(metavariableNode);
438
+ const metavariableNodeMatches = metatheorem.matchMetavariableNode(metavariableNode);
452
439
 
453
- if (metatheoremMatchesMetavariableNode) {
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 node = metavariableNode, ///
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 matches = metavariable.matchNode(node);
465
+ const nameMatches = metavariable.matchName(name);
466
466
 
467
- if (matches) {
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 name = metavariable.getName(),
594
- metavariablePresent = this.metavariables.some((metavariable) => {
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);
@@ -211,14 +211,8 @@ class LocalContext {
211
211
  addMetavariable(metavariable) {
212
212
  let metavariableAdded = false;
213
213
 
214
- const node = metavariable.getName(),
215
- metavariablePresent = this.metavariables.some((metavariable) => {
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 termMatchesGroundedTerm = term.match(groundedTerm);
273
+ const groundedTermNode = groundedTerm.getNode(),
274
+ groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
280
275
 
281
- if (termMatchesGroundedTerm) {
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
- isMetavariablePresentByMetavariableNode(metavariableNode) {
333
- const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
334
- metavariablePresent = (metavariable !== null);
339
+ isMetavariablePresentByMetavariableName(metavariableName) { return this.context.isMetavariablePresentByMetavariableName(metavariableName); }
335
340
 
336
- return metavariablePresent;
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 matches = variable.matchNode(node);
347
+ const nodeMatches = variable.matchNode(node);
344
348
 
345
- if (matches) {
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 node = metavariableNode, ///
368
- localContext = this, ///
371
+ const localContext = this, ///
369
372
  metavariables = this.getMetavariables(),
370
373
  metavariable = metavariables.find((metavariable) => {
371
- const matches = metavariable.matchNode(node, localContext);
374
+ const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode, localContext);
372
375
 
373
- if (matches) {
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(node, message) { this.context.trace(node, message); }
412
+ trace(message, node) { this.context.trace(message, node); }
410
413
 
411
- debug(node, message) { this.context.debug(node, message); }
414
+ debug(message, node) { this.context.debug(message, node); }
412
415
 
413
- info(node, message) { this.context.info(node, message); }
416
+ info(message, node) { this.context.info(message, node); }
414
417
 
415
- warning(node, message) { this.context.warning(node, message); }
418
+ warning(message, node) { this.context.warning(message, node); }
416
419
 
417
- error(node, message) { this.context.error(node, message); }
420
+ error(message, node) { this.context.error(message, node); }
418
421
 
419
- fatal(node, message) { this.context.fatal(node, message); }
422
+ fatal(message, node) { this.context.fatal(node, message); }
420
423
 
421
424
  static fromFileContext(fileContext) {
422
425
  const context = fileContext, ///
@@ -377,9 +377,9 @@ export default class ReleaseContext {
377
377
  types.push(objectType);
378
378
 
379
379
  const type = types.find((type) => {
380
- const matches = type.matchTypeName(typeName);
380
+ const typeNameMatches = type.matchTypeName(typeName);
381
381
 
382
- if (matches) {
382
+ if (typeNameMatches) {
383
383
  return true;
384
384
  }
385
385
  }) || null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { matchStatementModuloBrackets } from "./utilities/match";
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 matchesMetavariableNode = this.metavariableNode.match(metavariableNode);
30
+ const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
31
31
 
32
- return matchesMetavariableNode;
32
+ return metavariableNodeMatches;
33
33
  }
34
34
 
35
35
  unifyStatement(statementNode) {
36
- const statementNodeA = statementNode, ///
37
- statementNodeB = this.statementNode, ///
38
- statementMatches = matchStatementModuloBrackets(statementNodeA, statementNodeB),
39
- matchesStatementNode = statementMatches; ///
36
+ statementNode = stripBracketsFromStatement(statementNode); ///
40
37
 
41
- return matchesStatementNode;
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
- matches = this.statementNode.match(statementNode),
48
- metaLemmaOrMetaTheoremUnified = matches; ///
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;
@@ -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
- matchesType = typeAEqualToTypeB; ///
53
+ typeMatches = typeAEqualToTypeB; ///
53
54
 
54
- return matchesType;
55
+ return typeMatches;
55
56
  }
56
57
 
57
58
  matchTerm(term) {
58
59
  const termA = term, ///
59
- matchesTerm = this.terms.some((term) => {
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 matchesTerm;
69
+ return termMatches;
69
70
  }
70
71
 
71
72
  matchTerms(terms) {
72
- const matchesTerms = terms.every((term) => {
73
- const matchesTerm = this.matchTerm(term);
73
+ const termsMatch = terms.every((term) => {
74
+ const termMatches = this.matchTerm(term);
74
75
 
75
- if (matchesTerm) {
76
+ if (termMatches) {
76
77
  return true;
77
78
  }
78
79
  })
79
80
 
80
- return matchesTerms;
81
+ return termsMatch;
81
82
  }
82
83
 
83
84
  matchTermNode(termNode) {
84
- const termNodeA = termNode, ///
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
- if (termNodeAMatchesTermB) {
91
- return true;
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 matchesTermNode;
95
+ return termNodeMatches;
96
96
  }
97
97
 
98
98
  matchVariableNode(variableNode) {
99
99
  const variableNodeA = variableNode, ///
100
- matchesVariableNode = this.terms.some((term) => {
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 matchesVariableNode;
114
+ return variableNodeMatches;
115
115
  }
116
116
 
117
117
  matchTermNodes(termNodes) {
118
- const matchesTermNodes = termNodes.every((termNode) => {
119
- const matchesTermNode = this.matchTermNode(termNode);
118
+ const termNodesMatch = termNodes.every((termNode) => {
119
+ const termNodeMatches = this.matchTermNode(termNode);
120
120
 
121
- if (matchesTermNode) {
121
+ if (termNodeMatches) {
122
122
  return true;
123
123
  }
124
124
  });
125
125
 
126
- return matchesTermNodes;
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 termMatchesGroundedTerm = term.match(groundedTerm);
135
+ const groundedTermNode = groundedTerm.getNode(),
136
+ groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
136
137
 
137
- if (termMatchesGroundedTerm) {
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 matchesMetavariableNode = this.metavariableNode.match(metavariableNode);
25
+ const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
26
26
 
27
- return matchesMetavariableNode;
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 matches = this.metavariableNode.match(metavariableNode);
15
+ const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
16
16
 
17
- return matches;
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/lineIndex";
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 matchesName = (this.name === name);
28
+ const nameMatches = (this.name === name);
29
29
 
30
- return matchesName;
30
+ return nameMatches;
31
31
  }
32
32
 
33
33
  matchMetaTypeName(metaTypeName) {
34
- const matchesMetaTypeName = (this.name === metaTypeName);
34
+ const metaTypeNameMatches = (this.name === metaTypeName);
35
35
 
36
- return matchesMetaTypeName;
36
+ return metaTypeNameMatches;
37
37
  }
38
38
 
39
39
  matchMetaTypeNode(metaTypeNode) {
40
40
  const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
41
- matchesMetaTypeName = this.matchMetaTypeName(metaTypeName),
42
- matchesMetaTypeNode = matchesMetaTypeName; ///
41
+ metaTypeNameMatches = this.matchMetaTypeName(metaTypeName),
42
+ metaTypeNodeMatches = metaTypeNameMatches; ///
43
43
 
44
- return matchesMetaTypeNode;
44
+ return metaTypeNodeMatches;
45
45
  }
46
46
 
47
47
  asString(tokens) {
@@ -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 { nameFromMetavariableNode } from "./utilities/name";
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 matchesName = (this.name === name);
43
+ const nameMatches = (this.name === name);
44
44
 
45
- return matchesName;
45
+ return nameMatches;
46
46
  }
47
47
 
48
- matchNode(node, localContext) {
48
+ matchMetavariableNode(metavariableNode, localContext) {
49
49
  let matchesNode = false;
50
50
 
51
- const metavariableNode = node, ///
52
- typeNode = typeNodeQuery(metavariableNode);
51
+ const typeNode = typeNodeQuery(metavariableNode);
53
52
 
54
53
  if (typeNode === null) {
55
- const name = nameFromMetavariableNode(metavariableNode);
54
+ const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
55
+ name = metavariableName; ///
56
56
 
57
57
  if (this.name === name) {
58
58
  const termNode = termNodeQuery(metavariableNode);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import { termNodeFromTermString } from "../../utilities/node";
4
+
5
+ const bracketedTermString = "(n)";
6
+
7
+ const bracketedTermNode = termNodeFromTermString(bracketedTermString);
8
+
9
+ export default bracketedTermNode;