occam-verify-cli 0.0.1074 → 0.0.1077

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 (141) hide show
  1. package/lib/assertion/contained.js +6 -4
  2. package/lib/assertion/defined.js +2 -2
  3. package/lib/assertion/subproof.js +46 -30
  4. package/lib/assertion/type.js +4 -5
  5. package/lib/assignment/variable.js +2 -2
  6. package/lib/axiom.js +9 -12
  7. package/lib/combinator/bracketed.js +3 -2
  8. package/lib/combinator.js +6 -6
  9. package/lib/conclusion.js +2 -3
  10. package/lib/conjecture.js +10 -15
  11. package/lib/consequent.js +2 -3
  12. package/lib/constructor/bracketed.js +3 -2
  13. package/lib/constructor.js +6 -6
  14. package/lib/context/file.js +48 -102
  15. package/lib/context/local.js +21 -20
  16. package/lib/declaration/combinator.js +5 -5
  17. package/lib/declaration/constructor.js +5 -5
  18. package/lib/declaration/metavariable.js +4 -5
  19. package/lib/declaration/type.js +3 -3
  20. package/lib/declaration/variable.js +5 -5
  21. package/lib/declaration.js +10 -9
  22. package/lib/derivation.js +6 -2
  23. package/lib/equality.js +6 -2
  24. package/lib/frame.js +11 -13
  25. package/lib/index.js +13 -1
  26. package/lib/judgement.js +11 -8
  27. package/lib/label.js +6 -7
  28. package/lib/lemma.js +10 -15
  29. package/lib/metaLemma.js +15 -15
  30. package/lib/metatheorem.js +9 -14
  31. package/lib/metavariable.js +22 -27
  32. package/lib/mixins/statement/qualified/unify.js +2 -2
  33. package/lib/mixins/statement/unify.js +2 -2
  34. package/lib/mixins/statement/verify.js +20 -54
  35. package/lib/mixins/term/verify.js +3 -3
  36. package/lib/premise.js +24 -21
  37. package/lib/proof.js +8 -4
  38. package/lib/proofStep.js +62 -28
  39. package/lib/reference.js +3 -3
  40. package/lib/rule.js +17 -24
  41. package/lib/statement/qualified.js +8 -4
  42. package/lib/statement.js +5 -5
  43. package/lib/subDerivation.js +6 -2
  44. package/lib/subproof.js +10 -7
  45. package/lib/substitution/statementForMetavariable.js +36 -27
  46. package/lib/substitution.js +13 -13
  47. package/lib/substitutions.js +73 -49
  48. package/lib/supposition.js +30 -23
  49. package/lib/term.js +5 -5
  50. package/lib/theorem.js +10 -15
  51. package/lib/topLevelAssertion.js +12 -6
  52. package/lib/type.js +5 -5
  53. package/lib/unifier/equality.js +2 -2
  54. package/lib/unifier/metaLevel.js +6 -6
  55. package/lib/unifier/metavariable.js +5 -5
  56. package/lib/unifier/statementWithCombinator.js +2 -2
  57. package/lib/utilities/brackets.js +2 -2
  58. package/lib/utilities/node.js +2 -7
  59. package/lib/utilities/nominal.js +26 -0
  60. package/lib/utilities/subproof.js +2 -2
  61. package/lib/utilities/tokens.js +3 -7
  62. package/lib/variable.js +6 -6
  63. package/lib/verifier/statementAsCombinator.js +4 -11
  64. package/lib/verifier/termAsConstructor.js +4 -4
  65. package/lib/verifier/topLevel.js +9 -15
  66. package/package.json +1 -1
  67. package/src/assertion/contained.js +7 -5
  68. package/src/assertion/defined.js +2 -2
  69. package/src/assertion/subproof.js +61 -42
  70. package/src/assertion/type.js +2 -2
  71. package/src/assignment/variable.js +2 -1
  72. package/src/axiom.js +6 -8
  73. package/src/combinator/bracketed.js +6 -3
  74. package/src/combinator.js +4 -4
  75. package/src/conclusion.js +2 -2
  76. package/src/conjecture.js +8 -11
  77. package/src/consequent.js +2 -2
  78. package/src/constructor/bracketed.js +6 -3
  79. package/src/constructor.js +4 -4
  80. package/src/context/file.js +46 -84
  81. package/src/context/local.js +15 -17
  82. package/src/declaration/combinator.js +5 -4
  83. package/src/declaration/constructor.js +5 -4
  84. package/src/declaration/metavariable.js +3 -4
  85. package/src/declaration/type.js +2 -2
  86. package/src/declaration/variable.js +5 -4
  87. package/src/declaration.js +12 -9
  88. package/src/derivation.js +7 -1
  89. package/src/equality.js +7 -1
  90. package/src/frame.js +10 -9
  91. package/src/index.js +12 -0
  92. package/src/judgement.js +11 -5
  93. package/src/label.js +5 -5
  94. package/src/lemma.js +8 -11
  95. package/src/metaLemma.js +13 -11
  96. package/src/metatheorem.js +6 -10
  97. package/src/metavariable.js +23 -42
  98. package/src/mixins/statement/qualified/unify.js +1 -2
  99. package/src/mixins/statement/unify.js +2 -2
  100. package/src/mixins/statement/verify.js +35 -88
  101. package/src/mixins/term/verify.js +3 -2
  102. package/src/premise.js +41 -33
  103. package/src/proof.js +10 -3
  104. package/src/proofStep.js +91 -32
  105. package/src/reference.js +3 -2
  106. package/src/rule.js +17 -24
  107. package/src/statement/qualified.js +9 -5
  108. package/src/statement.js +3 -3
  109. package/src/subDerivation.js +8 -2
  110. package/src/subproof.js +12 -5
  111. package/src/substitution/statementForMetavariable.js +45 -30
  112. package/src/substitution.js +9 -9
  113. package/src/substitutions.js +75 -45
  114. package/src/supposition.js +50 -35
  115. package/src/term.js +3 -3
  116. package/src/theorem.js +8 -11
  117. package/src/topLevelAssertion.js +16 -7
  118. package/src/type.js +3 -3
  119. package/src/unifier/equality.js +1 -1
  120. package/src/unifier/metaLevel.js +8 -10
  121. package/src/unifier/metavariable.js +5 -5
  122. package/src/unifier/statementWithCombinator.js +5 -5
  123. package/src/utilities/brackets.js +2 -2
  124. package/src/utilities/node.js +1 -10
  125. package/src/utilities/nominal.js +14 -0
  126. package/src/utilities/subproof.js +2 -2
  127. package/src/utilities/tokens.js +2 -9
  128. package/src/variable.js +4 -4
  129. package/src/verifier/statementAsCombinator.js +4 -18
  130. package/src/verifier/termAsConstructor.js +4 -4
  131. package/src/verifier/topLevel.js +15 -14
  132. package/lib/assignment/metavariable.js +0 -62
  133. package/lib/unifier/intrinsicLevel.js +0 -144
  134. package/lib/utilities/unify.js +0 -24
  135. package/lib/verifier/intrinsicLevel.js +0 -140
  136. package/lib/verifier/metaLevel.js +0 -147
  137. package/src/assignment/metavariable.js +0 -30
  138. package/src/unifier/intrinsicLevel.js +0 -54
  139. package/src/utilities/unify.js +0 -23
  140. package/src/verifier/intrinsicLevel.js +0 -42
  141. package/src/verifier/metaLevel.js +0 -54
@@ -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;
@@ -100,17 +100,14 @@ export default class Declaration {
100
100
 
101
101
  localContext.trace(`Verifying the '${declarationString}' declaration...`);
102
102
 
103
- stated = true;
103
+ stated = true; ///
104
104
 
105
- assignments = null;
105
+ assignments = null; ///
106
106
 
107
- const referenceVerified = this.reference.verify(localContext);
107
+ const referenceVerified = this.reference.verify(localContext),
108
+ statementVerified = this.statement.verify(assignments, stated, localContext);
108
109
 
109
- if (referenceVerified) {
110
- const statementVerified = this.statement.verify(assignments, stated, localContext);
111
-
112
- verified = statementVerified; ///
113
- }
110
+ verified = (referenceVerified && statementVerified);
114
111
 
115
112
  if (verified) {
116
113
  localContext.debug(`...verified the '${declarationString}' declaration.`);
@@ -141,3 +138,9 @@ export default class Declaration {
141
138
  return declaration;
142
139
  }
143
140
  }
141
+
142
+ Object.assign(shim, {
143
+ Declaration
144
+ });
145
+
146
+ 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);
package/src/lemma.js CHANGED
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
- import Label from "./label";
5
- import Proof from "./proof";
6
- import Consequent from "./consequent";
7
- import Supposition from "./supposition";
8
4
  import LocalContext from "./context/local";
9
- import Substitutions from "./substitutions";
10
5
  import TopLevelAssertion from "./topLevelAssertion";
11
6
 
12
7
  import { EMPTY_STRING } from "./constants";
@@ -28,15 +23,15 @@ class Lemma extends TopLevelAssertion {
28
23
  this.fileContext.trace(`Verifying a lemma...`) :
29
24
  this.fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
30
25
 
31
- const labelsVerifiedAtTopLevel = this.labels.every((label) => {
32
- const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
26
+ const labelsVerifiedWhenDeclared = this.labels.every((label) => {
27
+ const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
33
28
 
34
- if (labelVVerifiedAtTopLevel) {
29
+ if (labelVVerifiedWhenDeclared) {
35
30
  return true;
36
31
  }
37
32
  });
38
33
 
39
- if (labelsVerifiedAtTopLevel) {
34
+ if (labelsVerifiedWhenDeclared) {
40
35
  const localContext = LocalContext.fromFileContext(this.fileContext),
41
36
  suppositionsVerified = this.suppositions.every((supposition) => {
42
37
  const suppositionVerified = supposition.verify(localContext);
@@ -50,7 +45,8 @@ class Lemma extends TopLevelAssertion {
50
45
  const consequentVerified = this.consequent.verify(localContext);
51
46
 
52
47
  if (consequentVerified) {
53
- const substitutions = Substitutions.fromNothing(),
48
+ const { Substitutions } = shim,
49
+ substitutions = Substitutions.fromNothing(),
54
50
  proofVerified = this.proof.verify(substitutions, this.consequent, localContext);
55
51
 
56
52
  if (proofVerified) {
@@ -74,7 +70,8 @@ class Lemma extends TopLevelAssertion {
74
70
  }
75
71
 
76
72
  static fromLemmaNode(lemmaNode, fileContext) {
77
- const proofNode = proofNodeQuery(lemmaNode),
73
+ const { Label, Proof, Supposition, Consequent } = shim,
74
+ proofNode = proofNodeQuery(lemmaNode),
78
75
  labelNodes = labelNodesQuery(lemmaNode),
79
76
  consequentNode = consequentNodeQuery(lemmaNode),
80
77
  suppositionNodes = suppositionNodesQuery(lemmaNode),
package/src/metaLemma.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import Label from "./label";
4
- import Proof from "./proof";
5
- import Consequent from "./consequent";
6
- import Supposition from "./supposition";
3
+ import shim from "./shim";
7
4
  import LocalContext from "./context/local";
8
- import Substitutions from "./substitutions";
9
5
  import TopLevelAssertion from "./topLevelAssertion";
10
6
 
11
7
  import { EMPTY_STRING } from "./constants";
@@ -17,7 +13,7 @@ const proofNodeQuery = nodeQuery("/metaLemma/proof"),
17
13
  consequentNodeQuery = nodeQuery("/metaLemma/consequent"),
18
14
  suppositionNodesQuery = nodesQuery("/metaLemma/supposition");
19
15
 
20
- export default class MetaLemma extends TopLevelAssertion {
16
+ class MetaLemma extends TopLevelAssertion {
21
17
  constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
22
18
  super(fileContext, string, labels, suppositions, consequent, proof);
23
19
 
@@ -37,15 +33,15 @@ export default class MetaLemma extends TopLevelAssertion {
37
33
  this.fileContext.trace(`Verifying a meta-lemma...`) :
38
34
  this.fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
39
35
 
40
- const labelsVerifiedAtTopLevel = this.labels.every((label) => {
41
- const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
36
+ const labelsVerifiedWhenDeclared = this.labels.every((label) => {
37
+ const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
42
38
 
43
- if (labelVVerifiedAtTopLevel) {
39
+ if (labelVVerifiedWhenDeclared) {
44
40
  return true;
45
41
  }
46
42
  });
47
43
 
48
- if (labelsVerifiedAtTopLevel) {
44
+ if (labelsVerifiedWhenDeclared) {
49
45
  const localContext = LocalContext.fromFileContext(this.fileContext),
50
46
  suppositionsVerified = this.suppositions.every((supposition) => {
51
47
  const suppositionVerified = supposition.verify(localContext);
@@ -82,7 +78,8 @@ export default class MetaLemma extends TopLevelAssertion {
82
78
  }
83
79
 
84
80
  static fromMetaLemmaNode(metaLemmaNode, fileContext) {
85
- const proofNode = proofNodeQuery(metaLemmaNode),
81
+ const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
82
+ proofNode = proofNodeQuery(metaLemmaNode),
86
83
  labelNodes = labelNodesQuery(metaLemmaNode),
87
84
  consequentNode = consequentNodeQuery(metaLemmaNode),
88
85
  suppositionNodes = suppositionNodesQuery(metaLemmaNode),
@@ -106,3 +103,8 @@ export default class MetaLemma extends TopLevelAssertion {
106
103
  }
107
104
  }
108
105
 
106
+ Object.assign(shim, {
107
+ MetaLemma
108
+ });
109
+
110
+ export default MetaLemma;
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
- import Label from "./label";
5
- import Proof from "./proof";
6
- import Consequent from "./consequent";
7
- import Supposition from "./supposition";
8
4
  import LocalContext from "./context/local";
9
- import Substitutions from "./substitutions";
10
5
  import TopLevelAssertion from "./topLevelAssertion";
11
6
 
12
7
  import { nodeQuery, nodesQuery } from "./utilities/query";
@@ -43,15 +38,15 @@ class Metatheorem extends TopLevelAssertion {
43
38
 
44
39
  this.fileContext.trace(`Verifying the '${metatheoremString}' metatheorem...`);
45
40
 
46
- const labelsVerifiedAtTopLevel = this.labels.every((label) => {
47
- const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
41
+ const labelsVerifiedWhenDeclared = this.labels.every((label) => {
42
+ const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
48
43
 
49
- if (labelVVerifiedAtTopLevel) {
44
+ if (labelVVerifiedWhenDeclared) {
50
45
  return true;
51
46
  }
52
47
  });
53
48
 
54
- if (labelsVerifiedAtTopLevel) {
49
+ if (labelsVerifiedWhenDeclared) {
55
50
  const localContext = LocalContext.fromFileContext(this.fileContext),
56
51
  suppositionsVerified = this.suppositions.every((supposition) => {
57
52
  const suppositionVerified = supposition.verify(localContext);
@@ -117,7 +112,8 @@ class Metatheorem extends TopLevelAssertion {
117
112
  }
118
113
 
119
114
  static fromMetatheoremNode(metatheoremNode, fileContext) {
120
- const proofNode = proofNodeQuery(metatheoremNode),
115
+ const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
116
+ proofNode = proofNodeQuery(metatheoremNode),
121
117
  labelNodes = labelNodesQuery(metatheoremNode),
122
118
  consequentNode = consequentNodeQuery(metatheoremNode),
123
119
  suppositionNodes = suppositionNodesQuery(metatheoremNode),