occam-verify-cli 0.0.1074 → 0.0.1075

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 (133) hide show
  1. package/lib/assertion/type.js +4 -5
  2. package/lib/assignment/variable.js +2 -2
  3. package/lib/axiom.js +9 -12
  4. package/lib/combinator/bracketed.js +3 -2
  5. package/lib/combinator.js +6 -6
  6. package/lib/conclusion.js +2 -3
  7. package/lib/conjecture.js +10 -15
  8. package/lib/consequent.js +2 -3
  9. package/lib/constructor/bracketed.js +3 -2
  10. package/lib/constructor.js +6 -6
  11. package/lib/context/file.js +48 -102
  12. package/lib/context/local.js +21 -20
  13. package/lib/declaration/combinator.js +5 -5
  14. package/lib/declaration/constructor.js +5 -5
  15. package/lib/declaration/metavariable.js +4 -5
  16. package/lib/declaration/type.js +3 -3
  17. package/lib/declaration/variable.js +5 -5
  18. package/lib/declaration.js +6 -2
  19. package/lib/derivation.js +6 -2
  20. package/lib/equality.js +6 -2
  21. package/lib/frame.js +11 -13
  22. package/lib/index.js +13 -1
  23. package/lib/judgement.js +11 -8
  24. package/lib/label.js +6 -7
  25. package/lib/lemma.js +10 -15
  26. package/lib/metaLemma.js +15 -15
  27. package/lib/metatheorem.js +9 -14
  28. package/lib/metavariable.js +17 -23
  29. package/lib/mixins/statement/qualified/unify.js +2 -2
  30. package/lib/mixins/statement/verify.js +8 -12
  31. package/lib/mixins/term/verify.js +3 -3
  32. package/lib/premise.js +2 -3
  33. package/lib/proof.js +8 -4
  34. package/lib/proofStep.js +3 -7
  35. package/lib/reference.js +3 -3
  36. package/lib/rule.js +11 -16
  37. package/lib/statement/qualified.js +6 -2
  38. package/lib/statement.js +5 -5
  39. package/lib/subDerivation.js +6 -2
  40. package/lib/subproof.js +10 -7
  41. package/lib/substitution/statementForMetavariable.js +14 -15
  42. package/lib/substitution.js +13 -13
  43. package/lib/substitutions.js +51 -47
  44. package/lib/supposition.js +2 -3
  45. package/lib/term.js +5 -5
  46. package/lib/theorem.js +10 -15
  47. package/lib/topLevelAssertion.js +3 -3
  48. package/lib/type.js +5 -5
  49. package/lib/unifier/equality.js +2 -2
  50. package/lib/unifier/metaLevel.js +6 -6
  51. package/lib/unifier/metavariable.js +5 -5
  52. package/lib/unifier/statementWithCombinator.js +2 -2
  53. package/lib/utilities/brackets.js +2 -2
  54. package/lib/utilities/node.js +2 -7
  55. package/lib/utilities/nominal.js +26 -0
  56. package/lib/utilities/subproof.js +2 -2
  57. package/lib/utilities/tokens.js +3 -7
  58. package/lib/variable.js +5 -5
  59. package/lib/verifier/metaLevel.js +2 -2
  60. package/lib/verifier/statementAsCombinator.js +2 -2
  61. package/lib/verifier/termAsConstructor.js +2 -2
  62. package/lib/verifier/topLevel.js +9 -15
  63. package/package.json +1 -1
  64. package/src/assertion/type.js +2 -2
  65. package/src/assignment/variable.js +2 -1
  66. package/src/axiom.js +6 -8
  67. package/src/combinator/bracketed.js +6 -3
  68. package/src/combinator.js +4 -4
  69. package/src/conclusion.js +2 -2
  70. package/src/conjecture.js +8 -11
  71. package/src/consequent.js +2 -2
  72. package/src/constructor/bracketed.js +6 -3
  73. package/src/constructor.js +4 -4
  74. package/src/context/file.js +46 -84
  75. package/src/context/local.js +15 -17
  76. package/src/declaration/combinator.js +5 -4
  77. package/src/declaration/constructor.js +5 -4
  78. package/src/declaration/metavariable.js +3 -4
  79. package/src/declaration/type.js +2 -2
  80. package/src/declaration/variable.js +5 -4
  81. package/src/declaration.js +7 -1
  82. package/src/derivation.js +7 -1
  83. package/src/equality.js +7 -1
  84. package/src/frame.js +10 -9
  85. package/src/index.js +12 -0
  86. package/src/judgement.js +11 -5
  87. package/src/label.js +5 -5
  88. package/src/lemma.js +8 -11
  89. package/src/metaLemma.js +13 -11
  90. package/src/metatheorem.js +6 -10
  91. package/src/metavariable.js +18 -34
  92. package/src/mixins/statement/qualified/unify.js +1 -2
  93. package/src/mixins/statement/verify.js +19 -18
  94. package/src/mixins/term/verify.js +3 -2
  95. package/src/premise.js +2 -2
  96. package/src/proof.js +10 -3
  97. package/src/proofStep.js +4 -6
  98. package/src/reference.js +3 -2
  99. package/src/rule.js +10 -12
  100. package/src/statement/qualified.js +7 -1
  101. package/src/statement.js +3 -3
  102. package/src/subDerivation.js +8 -2
  103. package/src/subproof.js +12 -5
  104. package/src/substitution/statementForMetavariable.js +12 -12
  105. package/src/substitution.js +9 -9
  106. package/src/substitutions.js +42 -34
  107. package/src/supposition.js +2 -2
  108. package/src/term.js +3 -3
  109. package/src/theorem.js +8 -11
  110. package/src/topLevelAssertion.js +3 -2
  111. package/src/type.js +3 -3
  112. package/src/unifier/equality.js +1 -1
  113. package/src/unifier/metaLevel.js +8 -10
  114. package/src/unifier/metavariable.js +5 -5
  115. package/src/unifier/statementWithCombinator.js +5 -5
  116. package/src/utilities/brackets.js +2 -2
  117. package/src/utilities/node.js +1 -10
  118. package/src/utilities/nominal.js +14 -0
  119. package/src/utilities/subproof.js +2 -2
  120. package/src/utilities/tokens.js +2 -9
  121. package/src/variable.js +3 -3
  122. package/src/verifier/metaLevel.js +2 -2
  123. package/src/verifier/statementAsCombinator.js +3 -3
  124. package/src/verifier/termAsConstructor.js +2 -2
  125. package/src/verifier/topLevel.js +15 -14
  126. package/lib/assignment/metavariable.js +0 -62
  127. package/lib/unifier/intrinsicLevel.js +0 -144
  128. package/lib/utilities/unify.js +0 -24
  129. package/lib/verifier/intrinsicLevel.js +0 -140
  130. package/src/assignment/metavariable.js +0 -30
  131. package/src/unifier/intrinsicLevel.js +0 -54
  132. package/src/utilities/unify.js +0 -23
  133. package/src/verifier/intrinsicLevel.js +0 -42
@@ -2,6 +2,8 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
+ import metavariableUnifier from "../unifier/metavariable";
6
+
5
7
  import { objectType } from "../type";
6
8
  import { frameMetaType, referenceMetaType, statementMetaType } from "../metaType";
7
9
  import { nodeAsTokens, nodeAsString, nodesAsString, tokensAsString } from "../utilities/string";
@@ -302,6 +304,16 @@ export default class FileContext {
302
304
  return this.metavariables;
303
305
  }
304
306
 
307
+ getMetavariableNames(includeRelease = true) {
308
+ const metavariableNames = this.metavariables.map((metavariable) => {
309
+ const metavariableName = metavariable.getName();
310
+
311
+ return metavariableName;
312
+ });
313
+
314
+ return metavariableNames;
315
+ }
316
+
305
317
  setReleaseContext(releaseContext) {
306
318
  this.releaseContext = releaseContext;
307
319
  }
@@ -314,58 +326,6 @@ export default class FileContext {
314
326
  this.tokens = tokens;
315
327
  }
316
328
 
317
- setNode(node) {
318
- this.node = node;
319
- }
320
-
321
- setTypes(types) {
322
- this.types = types;
323
- }
324
-
325
- setRules(rules) {
326
- this.rules = rules;
327
- }
328
-
329
- setAxioms(axioms) {
330
- this.axioms = axioms;
331
- }
332
-
333
- setLemmas(lemmas) {
334
- this.lemmas = lemmas;
335
- }
336
-
337
- setTheorems(theorems) {
338
- this.theorems = theorems;
339
- }
340
-
341
- setVariables(variables) {
342
- this.variables = variables;
343
- }
344
-
345
- setMetaLemmas(metaLemmas) {
346
- this.metaLemmas = metaLemmas;
347
- }
348
-
349
- setConjectures(conjectures) {
350
- this.conjectures = conjectures;
351
- }
352
-
353
- setCombinators(combinators) {
354
- this.combinators = combinators;
355
- }
356
-
357
- setConstructors(constructors) {
358
- this.constructors = constructors;
359
- }
360
-
361
- setMetatheorems(metatheorems) {
362
- this.metatheorems = metatheorems;
363
- }
364
-
365
- setMetavariables(metavariables) {
366
- this.metavariables = metavariables;
367
- }
368
-
369
329
  findTypeByTypeName(typeName) {
370
330
  let types = this.getTypes();
371
331
 
@@ -436,6 +396,13 @@ export default class FileContext {
436
396
  return metavariablePresent;
437
397
  }
438
398
 
399
+ isMetavariablePresentByMetavariableNode(metavariableNode, localContext) {
400
+ const metavariable = this.findMetavariableByMetavariableNode(metavariableNode, localContext),
401
+ metavariablePresent = (metavariable !== null);
402
+
403
+ return metavariablePresent;
404
+ }
405
+
439
406
  findRuleByReference(reference) {
440
407
  const rules = this.getRules(),
441
408
  metavariableNode = reference.getMetavariableNode(),
@@ -537,9 +504,9 @@ export default class FileContext {
537
504
  findVariableByVariableName(variableName) {
538
505
  const variables = this.getVariables(),
539
506
  variable = variables.find((variable) => {
540
- const nameMatches = variable.matchVariableName(variableName);
507
+ const variableNameMatches = variable.matchVariableName(variableName);
541
508
 
542
- if (nameMatches) {
509
+ if (variableNameMatches) {
543
510
  return true;
544
511
  }
545
512
  }) || null;
@@ -547,12 +514,12 @@ export default class FileContext {
547
514
  return variable;
548
515
  }
549
516
 
550
- findJudgementByMetavariableName(metavariableName) {
517
+ findJudgementByMetavariableNode(metavariableNode) {
551
518
  const judgements = this.getJudgements(),
552
519
  judgement = judgements.find((judgement) => {
553
- const judgementMatchesMetavariableName = judgement.matchMetavariableName(metavariableName);
520
+ const judgementMatchesMetavariableNode = judgement.matchMetavariableNode(metavariableNode);
554
521
 
555
- if (judgementMatchesMetavariableName) {
522
+ if (judgementMatchesMetavariableNode) {
556
523
  return true;
557
524
  }
558
525
  }) || null;
@@ -561,11 +528,28 @@ export default class FileContext {
561
528
  }
562
529
 
563
530
  findMetavariableByMetavariableName(metavariableName) {
564
- const metavariables = this.getMetavariables(),
531
+ const metavariableNameB = metavariableName, ///
532
+ metavariableNames = this.getMetavariableNames(),
533
+ metavariable = metavariableNames.find((metavariableName) => {
534
+ const metavariableNameA = metavariableName; ///
535
+
536
+ if (metavariableNameA === metavariableNameB) {
537
+ return true;
538
+ }
539
+ }) || null;
540
+
541
+ return metavariable;
542
+ }
543
+
544
+ findMetavariableByMetavariableNode(metavariableNode, localContext) {
545
+ const metavariableNodeB = metavariableNode, ///
546
+ metavariables = this.getMetavariables(),
565
547
  metavariable = metavariables.find((metavariable) => {
566
- const nameMatches = metavariable.matchMetavariableName(metavariableName);
548
+ const metavariableA = metavariable, ///
549
+ metavariableNodeA = metavariableA.getNode(), ///
550
+ metavariableUnified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, localContext);
567
551
 
568
- if (nameMatches) {
552
+ if (metavariableUnified) {
569
553
  return true;
570
554
  }
571
555
  }) || null;
@@ -636,18 +620,7 @@ export default class FileContext {
636
620
  }
637
621
 
638
622
  addVariable(variable) {
639
- let variableAdded = false;
640
-
641
- const variableName = variable.getName(),
642
- variablePresent = this.isVariablePresentByVariableName(variableName);
643
-
644
- if (!variablePresent) {
645
- this.variables.push(variable);
646
-
647
- variableAdded = true;
648
- }
649
-
650
- return variableAdded;
623
+ this.variables.push(variable);
651
624
  }
652
625
 
653
626
  addMetaLemma(metaLemma) {
@@ -671,18 +644,7 @@ export default class FileContext {
671
644
  }
672
645
 
673
646
  addMetavariable(metavariable) {
674
- let metavariableAdded = false;
675
-
676
- const metavariableName = metavariable.getName(),
677
- metavariablePresent = this.isMetavariablePresentByMetavariableName(metavariableName);
678
-
679
- if (!metavariablePresent) {
680
- this.metavariables.push(metavariable);
681
-
682
- metavariableAdded = true;
683
- }
684
-
685
- return metavariableAdded;
647
+ this.metavariables.push(metavariable);
686
648
  }
687
649
 
688
650
  trace(message) { this.releaseContext.trace(message, this.filePath); }
@@ -160,11 +160,10 @@ class LocalContext {
160
160
  return equalityAdded;
161
161
  }
162
162
 
163
- addVariable(variable) {
163
+ addVariable(variable, nested = true) {
164
164
  let variableAdded = false;
165
165
 
166
- const nested = false,
167
- variableName = variable.getNode(),
166
+ const variableName = variable.getNode(),
168
167
  variablePresent = this.isVariablePresentByVariableName(variableName, nested);
169
168
 
170
169
  if (!variablePresent) {
@@ -200,9 +199,8 @@ class LocalContext {
200
199
  let judgementAdded = false;
201
200
 
202
201
  const metavariableNode = judgement.getMetavariableNode(),
203
- metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
204
- metavariableDefinedByMetavariableName = this.isMetavariableDefinedByMetavariableName(metavariableName),
205
- judgementPresent = metavariableDefinedByMetavariableName; ///
202
+ metavariableDefined = this.isMetavariableDefinedByMetavariableNode(metavariableNode),
203
+ judgementPresent = metavariableDefined; ///
206
204
 
207
205
  if (!judgementPresent) {
208
206
  this.judgements.push(judgement);
@@ -276,7 +274,7 @@ class LocalContext {
276
274
 
277
275
  isLabelPresentByMetavariableNode(metavariableNode) { return this.context.isLabelPresentByMetavariableNode(metavariableNode); }
278
276
 
279
- isMetavariablePresentByMetavariableName(metavariableName) { return this.context.isMetavariablePresentByMetavariableName(metavariableName); }
277
+ isMetavariablePresentByMetavariableNode(metavariableNode, localContext) { return this.context.isMetavariablePresentByMetavariableNode(metavariableNode, localContext); }
280
278
 
281
279
  isVariablePresentByVariableName(variableName, nested = true) {
282
280
  const variable = this.findVariableByVariableName(variableName, nested),
@@ -285,25 +283,25 @@ class LocalContext {
285
283
  return variablePresent;
286
284
  }
287
285
 
288
- isJudgementPresentByMetavariableName(metavariableName) {
289
- const judgement = this.findJudgementByMetavariableName(metavariableName),
286
+ isJudgementPresentByMetavariableNode(metavariableNode) {
287
+ const judgement = this.findJudgementByMetavariableNode(metavariableNode),
290
288
  judgementPresent = (judgement !== null);
291
289
 
292
290
  return judgementPresent;
293
291
  }
294
292
 
295
- isMetavariableDefinedByMetavariableName(metavariableName) {
296
- const judgementPresent = this.isJudgementPresentByMetavariableName(metavariableName),
297
- metavariableDefinedByMetavariableName = judgementPresent; ///
293
+ isMetavariableDefinedByMetavariableNode(metavariableNode) {
294
+ const judgementPresent = this.isJudgementPresentByMetavariableNode(metavariableNode),
295
+ metavariableDefined = judgementPresent; ///
298
296
 
299
- return metavariableDefinedByMetavariableName
297
+ return metavariableDefined
300
298
  }
301
299
 
302
300
  findMetaTypeByMetaTypeName(metaTypeName) { return this.context.findMetaTypeByMetaTypeName(metaTypeName); }
303
301
 
304
302
  findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
305
303
 
306
- findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
304
+ findMetavariableByMetavariableNode(metavariableNode, localContext) { return this.context.findMetavariableByMetavariableNode(metavariableNode, localContext); }
307
305
 
308
306
  findVariableByVariableName(variableName, nested = true) {
309
307
  const variables = this.getVariables(nested),
@@ -318,12 +316,12 @@ class LocalContext {
318
316
  return variable;
319
317
  }
320
318
 
321
- findJudgementByMetavariableName(metavariableName) {
319
+ findJudgementByMetavariableNode(metavariableNode) {
322
320
  const judgements = this.getJudgements(),
323
321
  judgement = judgements.find((judgement) => {
324
- const judgementMatchesMetavariableName = judgement.matchMetavariableName(metavariableName);
322
+ const judgementMatchesMetavariableNode = judgement.matchMetavariableNode(metavariableNode);
325
323
 
326
- if (judgementMatchesMetavariableName) {
324
+ if (judgementMatchesMetavariableNode) {
327
325
  return true;
328
326
  }
329
327
  }) || null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import Combinator from "../combinator";
3
+ import shim from "../shim";
4
4
 
5
5
  export default class CombinatorDeclaration {
6
6
  constructor(fileContext, combinator) {
@@ -25,9 +25,9 @@ export default class CombinatorDeclaration {
25
25
 
26
26
  this.fileContext.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
27
27
 
28
- const combinatorVerifiedAtTopLevel = this.combinator.verifyAtTopLevel(this.fileContext);
28
+ const combinatorVerifiedWhenDeclared = this.combinator.verifyWhenDeclared(this.fileContext);
29
29
 
30
- if (combinatorVerifiedAtTopLevel) {
30
+ if (combinatorVerifiedWhenDeclared) {
31
31
  this.fileContext.addCombinator(this.combinator);
32
32
 
33
33
  verified = true;
@@ -41,7 +41,8 @@ export default class CombinatorDeclaration {
41
41
  }
42
42
 
43
43
  static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
44
- const combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
44
+ const { Combinator } = shim,
45
+ combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
45
46
  combinatorDeclaration = new CombinatorDeclaration(fileContext, combinator);
46
47
 
47
48
  return combinatorDeclaration;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import Constructor from "../constructor";
3
+ import shim from "../shim";
4
4
 
5
5
  export default class ConstructorDeclaration {
6
6
  constructor(fileContext, constructor) {
@@ -25,9 +25,9 @@ export default class ConstructorDeclaration {
25
25
 
26
26
  this.fileContext.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
27
27
 
28
- const constructorVerifiedAtTopLevel = this.constructor.verifyAtTopLevel(this.fileContext);
28
+ const constructorVerifiedWhenDeclared = this.constructor.verifyWhenDeclared(this.fileContext);
29
29
 
30
- if (constructorVerifiedAtTopLevel) {
30
+ if (constructorVerifiedWhenDeclared) {
31
31
  this.fileContext.addConstructor(this.constructor);
32
32
 
33
33
  verified = true;
@@ -41,7 +41,8 @@ export default class ConstructorDeclaration {
41
41
  }
42
42
 
43
43
  static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
44
- const constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, fileContext),
44
+ const { Constructor } = shim,
45
+ constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, fileContext),
45
46
  constructorDeclaration = new ConstructorDeclaration(fileContext, constructor);
46
47
 
47
48
  return constructorDeclaration;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "../shim";
4
- import Metavariable from "../metavariable";
5
4
 
6
5
  import { nodeQuery } from "../utilities/query";
7
6
 
@@ -33,9 +32,9 @@ export default class MetavariableDeclaration {
33
32
 
34
33
  this.fileContext.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
35
34
 
36
- const metavariableVerifiedAtTopLevel = this.metavariable.verifyAtTopLevel(this.fileContext);
35
+ const metavariableVerifiedWhenDeclared = this.metavariable.verifyWhenDeclared(this.fileContext);
37
36
 
38
- if (metavariableVerifiedAtTopLevel) {
37
+ if (metavariableVerifiedWhenDeclared) {
39
38
  this.fileContext.addMetavariable(this.metavariable);
40
39
 
41
40
  verified = true;
@@ -49,7 +48,7 @@ export default class MetavariableDeclaration {
49
48
  }
50
49
 
51
50
  static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
52
- const { MetaType } = shim,
51
+ const { MetaType, Metavariable } = shim,
53
52
  metaTypeNode = metaTypeNodeQuery(metavariableDeclarationNode),
54
53
  metaType = MetaType.fromMetaTypeNode(metaTypeNode, fileContext),
55
54
  metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
@@ -25,9 +25,9 @@ export default class TypeDeclaration {
25
25
 
26
26
  this.fileContext.trace(`Verifying the '${typeDeclarationString}' type declaration...`);
27
27
 
28
- const typeVerifiedAtTopLevel = this.type.verifyAtTopLevel(this.fileContext);
28
+ const typeVerifiedWhenDeclared = this.type.verifyWhenDeclared(this.fileContext);
29
29
 
30
- if (typeVerifiedAtTopLevel) {
30
+ if (typeVerifiedWhenDeclared) {
31
31
  this.fileContext.addType(this.type);
32
32
 
33
33
  verified = true;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import Variable from "../variable";
3
+ import shim from "../shim";
4
4
 
5
5
  import { nodeQuery } from "../utilities/query";
6
6
  import { typeNameFromTypeNode } from "../utilities/name";
@@ -33,9 +33,9 @@ export default class VariableDeclaration {
33
33
 
34
34
  this.fileContext.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
35
35
 
36
- const variableVerifiedAtTopLevel = this.variable.verifyAtTopLevel(this.fileContext);
36
+ const variableVerifiedWhenDeclared = this.variable.verifyWhenDeclared(this.fileContext);
37
37
 
38
- if (variableVerifiedAtTopLevel) {
38
+ if (variableVerifiedWhenDeclared) {
39
39
  this.fileContext.addVariable(this.variable);
40
40
 
41
41
  verified = true;
@@ -49,7 +49,8 @@ export default class VariableDeclaration {
49
49
  }
50
50
 
51
51
  static fromVariableDeclarationNode(variableDeclarationNode, fileContext) {
52
- const typeNode = typeNodeQuery(variableDeclarationNode),
52
+ const { Variable } = shim,
53
+ typeNode = typeNodeQuery(variableDeclarationNode),
53
54
  variable = Variable.fromVariableDeclarationNode(variableDeclarationNode, fileContext),
54
55
  string = stringFromVariableAndTypeNode(variable, typeNode),
55
56
  variableDeclaration = new VariableDeclaration(fileContext, string, variable);
@@ -9,7 +9,7 @@ import { stripBracketsFromStatementNode } from "./utilities/brackets";
9
9
  const referenceNodeQuery = nodeQuery("/declaration/reference"),
10
10
  statementNodeQuery = nodeQuery("/declaration/statement");
11
11
 
12
- export default class Declaration {
12
+ class Declaration {
13
13
  constructor(string, reference, statement) {
14
14
  this.string = string;
15
15
  this.reference = reference;
@@ -141,3 +141,9 @@ export default class Declaration {
141
141
  return declaration;
142
142
  }
143
143
  }
144
+
145
+ Object.assign(shim, {
146
+ Declaration
147
+ });
148
+
149
+ export default Declaration;
package/src/derivation.js CHANGED
@@ -10,7 +10,7 @@ const { last } = arrayUtilities;
10
10
 
11
11
  const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
12
12
 
13
- export default class Derivation {
13
+ class Derivation {
14
14
  constructor(proofSteps) {
15
15
  this.proofSteps = proofSteps;
16
16
  }
@@ -52,3 +52,9 @@ export default class Derivation {
52
52
  return derivation;
53
53
  }
54
54
  }
55
+
56
+ Object.assign(shim, {
57
+ Derivation
58
+ });
59
+
60
+ export default Derivation;
package/src/equality.js CHANGED
@@ -11,7 +11,7 @@ const variableNodeQuery = nodeQuery("/term/variable!"),
11
11
  leftTermNodeQuery = nodeQuery("/equality/term[0]"),
12
12
  rightTermNodeQuery = nodeQuery("/equality/term[1]");
13
13
 
14
- export default class Equality {
14
+ class Equality {
15
15
  constructor(string,leftTerm, rightTerm) {
16
16
  this.string = string;
17
17
  this.leftTerm = leftTerm;
@@ -220,3 +220,9 @@ export default class Equality {
220
220
  return equality;
221
221
  }
222
222
  }
223
+
224
+ Object.assign(shim, {
225
+ Equality
226
+ });
227
+
228
+ export default Equality;
package/src/frame.js CHANGED
@@ -3,8 +3,6 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import shim from "./shim";
6
- import Declaration from "./declaration";
7
- import Metavariable from "./metavariable";
8
6
 
9
7
  import { FRAME_META_TYPE_NAME } from "./metaTypeNames";
10
8
  import { nodeQuery, nodesQuery } from "./utilities/query";
@@ -76,16 +74,16 @@ class Frame {
76
74
  return frameNodeMatches;
77
75
  }
78
76
 
79
- matchMetavariableName(metavariableName) {
80
- let metavariableNameMatches = false;
77
+ matchMetavariableNode(metavariableNode) {
78
+ let metavariableNodeMatches = false;
81
79
 
82
80
  const metavariable = this.getMetavariable();
83
81
 
84
82
  if (metavariable !== null) {
85
- metavariableNameMatches = metavariable.matchMetavariableName(metavariableName);
83
+ metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode);
86
84
  }
87
85
 
88
- return metavariableNameMatches;
86
+ return metavariableNodeMatches;
89
87
  }
90
88
 
91
89
  unifySubstitution(substitution, localContext) {
@@ -259,7 +257,8 @@ class Frame {
259
257
  let frame = null;
260
258
 
261
259
  if (frameNode !== null) {
262
- const declarationNodes = declarationNodesQuery(frameNode),
260
+ const { Declaration, Metavariable } = shim,
261
+ declarationNodes = declarationNodesQuery(frameNode),
263
262
  metavariableNodes = metavariableNodesQuery(frameNode),
264
263
  declarations = declarationNodes.map((declarationNode) => {
265
264
  const declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
@@ -289,7 +288,8 @@ class Frame {
289
288
  const metavariableNode = metavariableNodeQuery(frameNode);
290
289
 
291
290
  if (metavariableNode !== null) {
292
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
291
+ const { Metavariable } = shim,
292
+ metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
293
293
  declarations = [],
294
294
  metavariables = [
295
295
  metavariable
@@ -313,7 +313,8 @@ class Frame {
313
313
  const metavariableNode = metavariableNodeQuery(frameNode);
314
314
 
315
315
  if (metavariableNode !== null) {
316
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
316
+ const { Metavariable } = shim,
317
+ metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
317
318
  declarations = [],
318
319
  metavariables = [
319
320
  metavariable
package/src/index.js CHANGED
@@ -6,20 +6,32 @@ import Rule from "./rule";
6
6
  import Label from "./label";
7
7
  import Axiom from "./axiom";
8
8
  import Lemma from "./lemma";
9
+ import Frame from "./frame";
10
+ import Proof from "./proof";
9
11
  import Premise from "./premise";
10
12
  import Theorem from "./theorem";
13
+ import Equality from "./equality";
11
14
  import MetaType from "./metaType";
15
+ import Subproof from "./subproof";
12
16
  import Variable from "./variable";
13
17
  import Statement from "./statement";
14
18
  import ProofStep from "./proofStep";
19
+ import Judgement from "./judgement";
20
+ import MetaLemma from "./metaLemma";
15
21
  import Consequent from "./consequent";
16
22
  import Conjecture from "./conjecture";
17
23
  import Combinator from "./combinator";
18
24
  import Conclusion from "./conclusion";
25
+ import Derivation from "./derivation";
26
+ import Declaration from "./declaration";
19
27
  import Constructor from "./constructor";
20
28
  import Supposition from "./supposition";
21
29
  import Metatheorem from "./metatheorem";
22
30
  import Metavariable from "./metavariable";
31
+ import Substitution from "./substitution";
32
+ import Substitutions from "./substitutions";
33
+ import SubDerivation from "./subDerivation";
34
+ import QualifiedStatement from "./statement/qualified";
23
35
  import UnqualifiedStatement from "./statement/unqualified";
24
36
 
25
37
  export { default as Log } from "./log";
package/src/judgement.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import Frame from "./frame";
4
- import Declaration from "./declaration";
3
+ import shim from "./shim";
5
4
  import JudgementAssignment from "./assignment/judgement";
6
5
 
7
6
  import { nodeQuery } from "./utilities/query";
@@ -9,7 +8,7 @@ import { nodeQuery } from "./utilities/query";
9
8
  const frameNodeQuery = nodeQuery("/judgement/frame"),
10
9
  declarationNodeQuery = nodeQuery("/judgement/declaration");
11
10
 
12
- export default class Judgement {
11
+ class Judgement {
13
12
  constructor(string, frame, declaration) {
14
13
  this.string = string;
15
14
  this.frame = frame;
@@ -30,7 +29,7 @@ export default class Judgement {
30
29
 
31
30
  getMetavariableNode() { return this.frame.getMetavariableNode(); }
32
31
 
33
- matchMetavariableName(metavariableName) { return this.frame.matchMetavariableName(metavariableName); }
32
+ matchMetavariableNode(metavariableNode) { return this.frame.matchMetavariableNode(metavariableNode); }
34
33
 
35
34
  verify(assignments, stated, localContext) {
36
35
  let verified;
@@ -117,7 +116,8 @@ export default class Judgement {
117
116
  let judgement = null;
118
117
 
119
118
  if (judgementNode !== null) {
120
- const frameNode = frameNodeQuery(judgementNode),
119
+ const { Frame, Declaration } = shim,
120
+ frameNode = frameNodeQuery(judgementNode),
121
121
  declarationNode = declarationNodeQuery(judgementNode),
122
122
  node = judgementNode, ///
123
123
  string = localContext.nodeAsString(node),
@@ -130,3 +130,9 @@ export default class Judgement {
130
130
  return judgement;
131
131
  }
132
132
  }
133
+
134
+ Object.assign(shim, {
135
+ Judgement
136
+ });
137
+
138
+ export default Judgement;
package/src/label.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import shim from "./shim";
4
4
  import LocalContext from "./context/local";
5
- import Metavariable from "./metavariable";
6
5
 
7
6
  import { nodeQuery } from "./utilities/query";
8
7
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "./utilities/json";
@@ -22,12 +21,12 @@ class Label {
22
21
 
23
22
  matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
24
23
 
25
- verifyAtTopLevel(fileContext) {
24
+ verifyWhenDeclared(fileContext) {
26
25
  let verifiedAtTopLevel = false;
27
26
 
28
27
  const labelString = this.getString(); ///
29
28
 
30
- fileContext.trace(`Verifying the '${labelString}' label at top level...`);
29
+ fileContext.trace(`Verifying the '${labelString}' label when declared...`);
31
30
 
32
31
  const metavariableNode = this.metavariable.getNode(),
33
32
  labelPresent = fileContext.isLabelPresentByMetavariableNode(metavariableNode);
@@ -39,7 +38,7 @@ class Label {
39
38
  }
40
39
 
41
40
  if (verifiedAtTopLevel) {
42
- fileContext.debug(`...verified the '${labelString}' label at top level.`);
41
+ fileContext.debug(`...verified the '${labelString}' label when declared.`);
43
42
  }
44
43
 
45
44
  return verifiedAtTopLevel;
@@ -63,7 +62,8 @@ class Label {
63
62
  }
64
63
 
65
64
  static fromLabelNode(labelNode, fileContext) {
66
- const metavariableNode = metavariableNodeQuery(labelNode),
65
+ const { Metavariable } = shim,
66
+ metavariableNode = metavariableNodeQuery(labelNode),
67
67
  localContext = LocalContext.fromFileContext(fileContext),
68
68
  metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
69
69
  label = new Label(metavariable);