occam-verify-cli 0.0.1094 → 0.0.1096

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 (95) hide show
  1. package/lib/assertion/contained.js +21 -5
  2. package/lib/assertion/defined.js +11 -4
  3. package/lib/assertion/subproof.js +16 -10
  4. package/lib/axiom.js +4 -4
  5. package/lib/combinator/bracketed.js +5 -28
  6. package/lib/conclusion.js +7 -1
  7. package/lib/conjecture.js +4 -4
  8. package/lib/consequent.js +7 -1
  9. package/lib/constructor/bracketed.js +5 -28
  10. package/lib/context/bracketed/combinator.js +118 -0
  11. package/lib/context/bracketed/constructor.js +118 -0
  12. package/lib/context/bracketted.js +98 -0
  13. package/lib/context/file.js +44 -40
  14. package/lib/context/local.js +13 -13
  15. package/lib/declaration.js +122 -7
  16. package/lib/frame.js +26 -16
  17. package/lib/judgement.js +8 -23
  18. package/lib/label.js +8 -9
  19. package/lib/lemma.js +4 -4
  20. package/lib/metaLemma.js +41 -7
  21. package/lib/metatheorem.js +37 -2
  22. package/lib/metavariable.js +13 -13
  23. package/lib/mixins/statement/qualified/unify.js +2 -2
  24. package/lib/nodeAndTokens/metavariable.js +5 -6
  25. package/lib/nodeAndTokens/statement.js +7 -20
  26. package/lib/nodeAndTokens/substitution/frame.js +4 -5
  27. package/lib/nodeAndTokens/substitution/statement.js +4 -5
  28. package/lib/nodeAndTokens/substitution/term.js +4 -5
  29. package/lib/nodeAndTokens/term.js +5 -6
  30. package/lib/nodeAndTokens/variable.js +5 -6
  31. package/lib/premise.js +9 -3
  32. package/lib/reference.js +23 -9
  33. package/lib/rule.js +13 -7
  34. package/lib/statement/qualified.js +4 -3
  35. package/lib/statement/unqualified.js +29 -23
  36. package/lib/statement.js +9 -7
  37. package/lib/substitution/frame.js +2 -2
  38. package/lib/substitution/statement.js +4 -4
  39. package/lib/substitution/term.js +2 -2
  40. package/lib/substitutions.js +9 -2
  41. package/lib/topLevelAssertion.js +13 -25
  42. package/lib/unifier/equality.js +5 -5
  43. package/lib/unifier/label.js +146 -0
  44. package/lib/unifier/metaLevel.js +7 -7
  45. package/lib/unifier.js +4 -4
  46. package/lib/variable.js +8 -5
  47. package/package.json +1 -1
  48. package/src/assertion/contained.js +22 -6
  49. package/src/assertion/defined.js +11 -5
  50. package/src/assertion/subproof.js +17 -12
  51. package/src/axiom.js +3 -2
  52. package/src/combinator/bracketed.js +5 -41
  53. package/src/conclusion.js +2 -0
  54. package/src/conjecture.js +3 -2
  55. package/src/consequent.js +2 -0
  56. package/src/constructor/bracketed.js +5 -40
  57. package/src/context/bracketed/combinator.js +23 -0
  58. package/src/context/bracketed/constructor.js +23 -0
  59. package/src/context/bracketted.js +61 -0
  60. package/src/context/file.js +57 -48
  61. package/src/context/local.js +4 -4
  62. package/src/declaration.js +130 -6
  63. package/src/frame.js +30 -15
  64. package/src/judgement.js +7 -35
  65. package/src/label.js +3 -14
  66. package/src/lemma.js +3 -2
  67. package/src/metaLemma.js +60 -12
  68. package/src/metatheorem.js +56 -2
  69. package/src/metavariable.js +19 -13
  70. package/src/mixins/statement/qualified/unify.js +3 -1
  71. package/src/nodeAndTokens/metavariable.js +3 -7
  72. package/src/nodeAndTokens/statement.js +1 -13
  73. package/src/nodeAndTokens/substitution/frame.js +1 -6
  74. package/src/nodeAndTokens/substitution/statement.js +1 -6
  75. package/src/nodeAndTokens/substitution/term.js +1 -6
  76. package/src/nodeAndTokens/term.js +3 -7
  77. package/src/nodeAndTokens/variable.js +3 -7
  78. package/src/premise.js +15 -3
  79. package/src/reference.js +30 -19
  80. package/src/rule.js +7 -5
  81. package/src/statement/qualified.js +3 -3
  82. package/src/statement/unqualified.js +32 -30
  83. package/src/statement.js +9 -9
  84. package/src/substitution/frame.js +1 -2
  85. package/src/substitution/statement.js +3 -6
  86. package/src/substitution/term.js +1 -2
  87. package/src/substitutions.js +7 -1
  88. package/src/topLevelAssertion.js +10 -22
  89. package/src/unifier/equality.js +14 -16
  90. package/src/unifier/label.js +57 -0
  91. package/src/unifier/metaLevel.js +6 -6
  92. package/src/unifier.js +4 -4
  93. package/src/variable.js +13 -7
  94. package/lib/unifier/intrinsicLevel.js +0 -149
  95. package/src/unifier/intrinsicLevel.js +0 -61
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import LocalContext from "./local";
5
+ import shim from "../shim";
6
6
  import metavariableUnifier from "../unifier/metavariable";
7
7
 
8
8
  import { objectType } from "../type";
@@ -30,9 +30,8 @@ import { typesFromJSON,
30
30
  constructorsToConstructorsJSON,
31
31
  metatheoremsToMetatheoremsJSON,
32
32
  metavariablesToMetavariablesJSON } from "../utilities/json";
33
- import local from "./local";
34
33
 
35
- const { push } = arrayUtilities;
34
+ const { push, filter } = arrayUtilities;
36
35
 
37
36
  export default class FileContext {
38
37
  constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, constructors, metatheorems, metavariables) {
@@ -407,11 +406,11 @@ export default class FileContext {
407
406
 
408
407
  findRuleByReference(reference) {
409
408
  const rules = this.getRules(),
410
- metavariableNode = reference.getMetavariableNode(),
409
+ metavariableName = reference.getMetavariableName(),
411
410
  rule = rules.find((rule) => {
412
- const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
411
+ const metavariableNameMatches = rule.matchMetavariableName(metavariableName);
413
412
 
414
- if (metavariableNodeMatches) {
413
+ if (metavariableNameMatches) {
415
414
  return true;
416
415
  }
417
416
  }) || null;
@@ -421,11 +420,11 @@ export default class FileContext {
421
420
 
422
421
  findAxiomByReference(reference) {
423
422
  const axioms = this.getAxioms(),
424
- metavariableNode = reference.getMetavariableNode(),
423
+ metavariableName = reference.getMetavariableName(),
425
424
  axiom = axioms.find((axiom) => {
426
- const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
425
+ const metavariableNameMatches = axiom.matchMetavariableName(metavariableName);
427
426
 
428
- if (metavariableNodeMatches) {
427
+ if (metavariableNameMatches) {
429
428
  return true;
430
429
  }
431
430
  }) || null;
@@ -435,11 +434,11 @@ export default class FileContext {
435
434
 
436
435
  findLemmaByReference(reference) {
437
436
  const lemmas = this.getLemmas(),
438
- metavariableNode = reference.getMetavariableNode(),
437
+ metavariableName = reference.getMetavariableName(),
439
438
  lemma = lemmas.find((lemma) => {
440
- const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
439
+ const metavariableNameMatches = lemma.matchMetavariableName(metavariableName);
441
440
 
442
- if (metavariableNodeMatches) {
441
+ if (metavariableNameMatches) {
443
442
  return true;
444
443
  }
445
444
  }) || null;
@@ -449,11 +448,11 @@ export default class FileContext {
449
448
 
450
449
  findTheoremByReference(reference) {
451
450
  const theorems = this.getTheorems(),
452
- metavariableNode = reference.getMetavariableNode(),
451
+ metavariableName = reference.getMetavariableName(),
453
452
  theorem = theorems.find((theorem) => {
454
- const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
453
+ const metavariableNameMatches = theorem.matchMetavariableName(metavariableName);
455
454
 
456
- if (metavariableNodeMatches) {
455
+ if (metavariableNameMatches) {
457
456
  return true;
458
457
  }
459
458
  }) || null;
@@ -463,11 +462,11 @@ export default class FileContext {
463
462
 
464
463
  findConjectureByReference(reference) {
465
464
  const conjectures = this.getConjectures(),
466
- metavariableNode = reference.getMetavariableNode(),
465
+ metavariableName = reference.getMetavariableName(),
467
466
  conjecture = conjectures.find((conjecture) => {
468
- const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
467
+ const metavariableNameMatches = conjecture.matchMetavariableName(metavariableName);
469
468
 
470
- if (metavariableNodeMatches) {
469
+ if (metavariableNameMatches) {
471
470
  return true;
472
471
  }
473
472
  }) || null;
@@ -475,30 +474,38 @@ export default class FileContext {
475
474
  return conjecture;
476
475
  }
477
476
 
478
- findMetaLemmaByReference(reference, specificContext) {
479
- const metaLemmas = this.getMetaLemmas(),
480
- metaLemma = metaLemmas.find((metaLemma) => {
481
- const referenceUnified = metaLemma.unifyReference(reference, specificContext);
477
+ findMetaLemmasByReference(reference) {
478
+ const metaLemmas = this.getMetaLemmas();
482
479
 
483
- if (referenceUnified) {
484
- return true;
485
- }
486
- }) || null;
480
+ filter(metaLemmas, (metaLemma) => {
481
+ const { Substitutions } = shim,
482
+ context = this, ///
483
+ substitutions = Substitutions.fromNothing(),
484
+ referenceUnified = metaLemma.unifyReference(reference, substitutions, context);
487
485
 
488
- return metaLemma;
486
+ if (referenceUnified) {
487
+ return true;
488
+ }
489
+ });
490
+
491
+ return metaLemmas;
489
492
  }
490
493
 
491
- findMetatheoremByReference(reference, specificContext) {
492
- const metatheorems = this.getMetatheorems(),
493
- metatheorem = metatheorems.find((metatheorem) => {
494
- const referenceUnified = metatheorem.unifyReference(reference, specificContext);
494
+ findMetatheoremsByReference(reference) {
495
+ const metatheorems = this.getMetatheorems();
495
496
 
496
- if (referenceUnified) {
497
- return true;
498
- }
499
- }) || null;
497
+ filter(metatheorems, (metatheorem) => {
498
+ const { Substitutions } = shim,
499
+ context = this, ///
500
+ substitutions = Substitutions.fromNothing(),
501
+ referenceUnified = metatheorem.unifyReference(reference, substitutions, context);
500
502
 
501
- return metatheorem;
503
+ if (referenceUnified) {
504
+ return true;
505
+ }
506
+ });
507
+
508
+ return metatheorems;
502
509
  }
503
510
 
504
511
  findVariableByVariableName(variableName) {
@@ -542,13 +549,13 @@ export default class FileContext {
542
549
  }
543
550
 
544
551
  findMetavariableByMetavariableNode(metavariableNode, specificContext) {
545
- const metavariableNodeB = metavariableNode, ///
552
+ const specificMetavariableNode = metavariableNode, ///
546
553
  generalContext = this, ///
547
554
  metavariables = this.getMetavariables(),
548
555
  metavariable = metavariables.find((metavariable) => {
549
- const metavariableA = metavariable, ///
550
- metavariableNodeA = metavariableA.getNode(), ///
551
- metavariableUnified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, generalContext, specificContext);
556
+ const generalMetavariable = metavariable, ///
557
+ generalMetavariableNode = generalMetavariable.getNode(), ///
558
+ metavariableUnified = metavariableUnifier.unify(generalMetavariableNode, specificMetavariableNode, generalContext, specificContext);
552
559
 
553
560
  if (metavariableUnified) {
554
561
  return true;
@@ -586,18 +593,20 @@ export default class FileContext {
586
593
  return conjecturePresent;
587
594
  }
588
595
 
589
- isMetaLemmaPresentByReference(reference, specificContext) {
590
- const metaLemma = this.findMetaLemmaByReference(reference, specificContext),
591
- metaLemmaPresent = (metaLemma !== null);
596
+ areMetaLemmaPresentByReference(reference) {
597
+ const metaLemmas = this.findMetaLemmasByReference(reference),
598
+ metaLemmasLength = metaLemmas.length,
599
+ metaLemmasPresent = (metaLemmasLength > 0);
592
600
 
593
- return metaLemmaPresent;
601
+ return metaLemmasPresent;
594
602
  }
595
603
 
596
- isMetatheoremPresentByReference(reference, specificContext) {
597
- const metatheorem = this.findMetatheoremByReference(reference, specificContext),
598
- metatheoremPresent = (metatheorem !== null);
604
+ areMetatheoremPresentByReference(reference) {
605
+ const metatheorems = this.findMetatheoremsByReference(reference),
606
+ metatheoremsLength = metatheorems.length, ///
607
+ metatheoremsPresent = (metatheoremsLength > 0);
599
608
 
600
- return metatheoremPresent;
609
+ return metatheoremsPresent;
601
610
  }
602
611
 
603
612
  nodeAsString(node, tokens = null) {
@@ -340,9 +340,9 @@ class LocalContext {
340
340
 
341
341
  findConjectureByReference(reference) { return this.context.findConjectureByReference(reference); }
342
342
 
343
- findMetaLemmaByReference(reference, specificContext) { return this.context.findMetaLemmaByReference(reference, specificContext); }
343
+ findMetaLemmasByReference(reference) { return this.context.findMetaLemmasByReference(reference); }
344
344
 
345
- findMetatheoremByReference(reference, specificContext) { return this.context.findMetatheoremByReference(reference, specificContext); }
345
+ findMetatheoremsByReference(reference) { return this.context.findMetatheoremsByReference(reference); }
346
346
 
347
347
  isAxiomPresentByReference(reference) { return this.context.isAxiomPresentByReference(reference); }
348
348
 
@@ -352,9 +352,9 @@ class LocalContext {
352
352
 
353
353
  isConjecturePresentByReference(reference) { return this.context.isConjecturePresentByReference(reference); }
354
354
 
355
- isMetaLemmaPresentByReference(reference, specificContext) { return this.context.isMetaLemmaPresentByReference(reference, specificContext); }
355
+ areMetaLemmaPresentByReference(reference) { return this.context.areMetaLemmaPresentByReference(reference); }
356
356
 
357
- isMetatheoremPresentByReference(reference, specificContext) { return this.context.isMetatheoremPresentByReference(reference, specificContext); }
357
+ areMetatheoremPresentByReference(reference) { return this.context.areMetatheoremPresentByReference(reference); }
358
358
 
359
359
  nodeAsString(node, tokens = null) {
360
360
  if (tokens === null) {
@@ -93,30 +93,154 @@ class Declaration {
93
93
  return substitutionUnified;
94
94
  }
95
95
 
96
- verify(assignments, stated, context) {
96
+ unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
97
+ let metaLemmaMetatheoremUnified = false;
98
+
99
+ const declarationString = this.string, ///
100
+ metalemmaMetatheoremString = metaLemmaMetatheorem.getString();
101
+
102
+ context.trace(`Unifying the '${metalemmaMetatheoremString}' meta-lemma or metatheorem with the '${declarationString}' declaration...`);
103
+
104
+ const { Substitutions } = shim,
105
+ substitutions = Substitutions.fromNothing(),
106
+ referenceUnified = metaLemmaMetatheorem.unifyReference(this.reference, substitutions, context);
107
+
108
+ if (referenceUnified) {
109
+ const statementUnified = metaLemmaMetatheorem.unifyStatement(this.statement, substitutions, context);
110
+
111
+ if (statementUnified) {
112
+ metaLemmaMetatheoremUnified = true;
113
+ }
114
+ }
115
+
116
+ if (metaLemmaMetatheoremUnified) {
117
+ context.debug(`...unified the '${metalemmaMetatheoremString}' meta-lemma or metatheorem with the '${declarationString}' declaration.`);
118
+ }
119
+
120
+ return metaLemmaMetatheoremUnified;
121
+ }
122
+
123
+ verify(frame, assignments, stated, context) {
97
124
  let verified = false;
98
125
 
99
126
  const declarationString = this.string; ///
100
127
 
101
128
  context.trace(`Verifying the '${declarationString}' declaration...`);
102
129
 
130
+ const statementVerified = this.verifyStatement(this.statement, assignments, stated, context);
131
+
132
+ if (statementVerified) {
133
+ let verifiedWhenStated = false,
134
+ verifiedWhenDerived = false;
135
+
136
+ if (stated) {
137
+ verifiedWhenStated = this.verifyWhenStated(context);
138
+ } else {
139
+ verifiedWhenDerived = this.verifyWhenDerived(frame, context);
140
+ }
141
+
142
+ verified = (verifiedWhenStated || verifiedWhenDerived);
143
+ }
144
+
145
+ if (verified) {
146
+ context.debug(`...verified the '${declarationString}' declaration.`);
147
+ }
148
+
149
+ return verified;
150
+ }
151
+
152
+ verifyStatement(statement, assignments, stated, context) {
103
153
  stated = true; ///
104
154
 
105
155
  assignments = null; ///
106
156
 
157
+ const statementVerified = statement.verify(assignments, stated, context);
158
+
159
+ return statementVerified;
160
+ }
161
+
162
+ verifyWhenStated(context) {
163
+ let verifiedWhenStated;
164
+
165
+ const declarationString = this.string; ///
166
+
167
+ context.trace(`Verifying the '${declarationString}' declaration when stated...`);
168
+
107
169
  const referenceVerified = this.reference.verify(context);
108
170
 
109
171
  if (referenceVerified) {
110
- const statementVerified = this.statement.verify(assignments, stated, context);
172
+ verifiedWhenStated = true;
173
+ } else {
174
+ const metaLemmas = context.findMetaLemmasByReference(this.reference),
175
+ metatheorems = context.findMetatheoremsByReference(this.reference),
176
+ metaLemmaMetatheorems = [
177
+ ...metaLemmas,
178
+ ...metatheorems
179
+ ],
180
+ metaLemmaMetatheoremUnified = metaLemmaMetatheorems.every((metaLemmaMetatheorem) => {
181
+ const metaLemmaMetatheoremUnified = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
182
+
183
+ if (metaLemmaMetatheoremUnified) {
184
+ return true;
185
+ }
186
+ });
187
+
188
+ verifiedWhenStated = metaLemmaMetatheoremUnified; ///
189
+ }
111
190
 
112
- verified = statementVerified; ///
191
+ if (verifiedWhenStated) {
192
+ context.debug(`...verified the '${declarationString}' declaration when stated.`);
113
193
  }
114
194
 
115
- if (verified) {
116
- context.debug(`...verified the '${declarationString}' declaration.`);
195
+ return verifiedWhenStated;
196
+ }
197
+
198
+ verifyWhenDerived(frame, context) {
199
+ let verifiedWhenDerived;
200
+
201
+ const declarationString = this.string; ///
202
+
203
+ context.trace(`Verifying the '${declarationString}' declaration when derived...`);
204
+
205
+ const referenceVerified = this.reference.verify(context);
206
+
207
+ if (referenceVerified) {
208
+ verifiedWhenDerived = true;
209
+ } else {
210
+ const metaLemmas = context.findMetaLemmasByReference(this.reference),
211
+ metatheorems = context.findMetatheoremsByReference(this.reference),
212
+ metaLemmaMetatheorems = [
213
+ ...metaLemmas,
214
+ ...metatheorems
215
+ ],
216
+ metaLemmaMetatheoremsLength = metaLemmaMetatheorems.length;
217
+
218
+ if (metaLemmaMetatheoremsLength > 0) {
219
+ const metaLemmaMetatheoremsUnified = metaLemmaMetatheorems.every((metaLemmaMetatheorem) => {
220
+ let metaLemmaMetatheoremUnified = true;
221
+
222
+ if (metaLemmaMetatheoremUnified) {
223
+ metaLemmaMetatheoremUnified = frame.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
224
+ }
225
+
226
+ if (metaLemmaMetatheoremUnified) {
227
+ metaLemmaMetatheoremUnified = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
228
+ }
229
+
230
+ if (metaLemmaMetatheoremUnified) {
231
+ return true;
232
+ }
233
+ });
234
+
235
+ verifiedWhenDerived = metaLemmaMetatheoremsUnified; ///
236
+ }
117
237
  }
118
238
 
119
- return verified;
239
+ if (verifiedWhenDerived) {
240
+ context.debug(`...verified the '${declarationString}' declaration when derived.`);
241
+ }
242
+
243
+ return verifiedWhenDerived;
120
244
  }
121
245
 
122
246
  static fromDeclarationNode(declarationNode, context) {
package/src/frame.js CHANGED
@@ -89,9 +89,10 @@ class Frame {
89
89
  unifySubstitution(substitution, context) {
90
90
  let substitutionUnified = false;
91
91
 
92
- const substitutionString = substitution.getString();
92
+ const frameString = this.string, ///
93
+ substitutionString = substitution.getString();
93
94
 
94
- context.trace(`Unifying the '${substitutionString}' substitution...`)
95
+ context.trace(`Unifying the '${substitutionString}' substitution with the '${frameString}' frame...`)
95
96
 
96
97
  if (!substitutionUnified) {
97
98
  substitutionUnified = this.declarations.some((declaration) => {
@@ -114,18 +115,19 @@ class Frame {
114
115
  }
115
116
 
116
117
  if (substitutionUnified) {
117
- context.debug(`...unified the '${substitutionString}' substitution...`)
118
+ context.debug(`...unified the '${substitutionString}' substitution with the '${frameString}' frame...`)
118
119
  }
119
120
 
120
121
  return substitutionUnified;
121
122
  }
122
123
 
123
- unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, context) {
124
+ unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
124
125
  let metaLemmaMetatheoremUnified;
125
126
 
126
- const metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
127
+ const frameString = this.string, ///
128
+ metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
127
129
 
128
- context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem...`);
130
+ context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame...`);
129
131
 
130
132
  const substitutions = metaLemmaMetatheorem.getSubstitutions(),
131
133
  substitutionsUnified = substitutions.everySubstitution((substitution) => {
@@ -139,7 +141,7 @@ class Frame {
139
141
  metaLemmaMetatheoremUnified = substitutionsUnified; ///
140
142
 
141
143
  if (metaLemmaMetatheoremUnified) {
142
- context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem.`);
144
+ context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame.`);
143
145
  }
144
146
 
145
147
  return metaLemmaMetatheoremUnified;
@@ -148,9 +150,10 @@ class Frame {
148
150
  unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
149
151
  let axiomLemmaTheoremOrConjectureUnified;
150
152
 
151
- const axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
153
+ const frameString = this.string, ///
154
+ axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
152
155
 
153
- context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture...`);
156
+ context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame...`);
154
157
 
155
158
  const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
156
159
  substitutionsUnified = substitutions.everySubstitution((substitution) => {
@@ -164,7 +167,7 @@ class Frame {
164
167
  axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
165
168
 
166
169
  if (axiomLemmaTheoremOrConjectureUnified) {
167
- context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture.`);
170
+ context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame.`);
168
171
  }
169
172
 
170
173
  return axiomLemmaTheoremOrConjectureUnified;
@@ -177,11 +180,7 @@ class Frame {
177
180
 
178
181
  context.trace(`Verifying the '${frameString}' frame...`);
179
182
 
180
- const declarationsVerified = this.declarations.every((declaration) => {
181
- const declarationVerified = declaration.verify(assignments, stated, context);
182
-
183
- return declarationVerified;
184
- });
183
+ const declarationsVerified = this.verifyDeclarations(this.declarations, assignments, stated, context);
185
184
 
186
185
  if (declarationsVerified) {
187
186
  const metavariablesVerified = this.metavariables.every((metavariable) => {
@@ -213,6 +212,22 @@ class Frame {
213
212
  return verified;
214
213
  }
215
214
 
215
+ verifyDeclarations(declarations, assignments, stated, context) {
216
+ stated = true; ///
217
+
218
+ assignments = null; ///
219
+
220
+ const frame = null; ///
221
+
222
+ const declarationsVerified = declarations.every((declaration) => {
223
+ const declarationVerified = declaration.verify(frame, assignments, stated, context);
224
+
225
+ return declarationVerified;
226
+ });
227
+
228
+ return declarationsVerified;
229
+ }
230
+
216
231
  verifyWhenStated(assignments, context) {
217
232
  let verifiedWhenStated = false;
218
233
 
package/src/judgement.js CHANGED
@@ -32,7 +32,7 @@ class Judgement {
32
32
  matchMetavariableNode(metavariableNode) { return this.frame.matchMetavariableNode(metavariableNode); }
33
33
 
34
34
  verify(assignments, stated, context) {
35
- let verified;
35
+ let verified = false;
36
36
 
37
37
  const judgementString = this.string; ///
38
38
 
@@ -41,7 +41,7 @@ class Judgement {
41
41
  const frameVerified = this.frame.verify(assignments, stated, context);
42
42
 
43
43
  if (frameVerified) {
44
- const declarationVerified = this.declaration.verify(assignments, stated, context);
44
+ const declarationVerified = this.declaration.verify(this.frame, assignments, stated, context);
45
45
 
46
46
  if (declarationVerified) {
47
47
  let verifiedWhenStated = false,
@@ -50,12 +50,10 @@ class Judgement {
50
50
  if (stated) {
51
51
  verifiedWhenStated = this.verifyWhenStated(assignments, context);
52
52
  } else {
53
- verifiedWhenDerived = this.verifyWhenDerived(assignments, context);
53
+ verifiedWhenDerived = this.verifyWhenDerived(context);
54
54
  }
55
55
 
56
- if (verifiedWhenStated || verifiedWhenDerived) {
57
- verified = true;
58
- }
56
+ verified = (verifiedWhenStated || verifiedWhenDerived);
59
57
  }
60
58
  }
61
59
 
@@ -90,40 +88,14 @@ class Judgement {
90
88
  return verifiedWhenStated;
91
89
  }
92
90
 
93
- verifyWhenDerived(assignments, context) {
94
- let verifiedWhenDerived = false;
91
+ verifyWhenDerived(context) {
92
+ let verifiedWhenDerived ;
95
93
 
96
94
  const judgementString = this.string; ///
97
95
 
98
96
  context.trace(`Verifying the '${judgementString}' judgement when derived...`);
99
97
 
100
- if (!verifiedWhenDerived) {
101
- const reference = this.declaration.getReference(),
102
- metaLemma = context.findMetaLemmaByReference(reference),
103
- metatheorem = context.findMetatheoremByReference(reference),
104
- metaLemmaMetatheorem = (metaLemma || metatheorem); ///
105
-
106
- if (metaLemmaMetatheorem !== null) {
107
- const metaLemmaMetatheoremUnified = this.frame.unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, context);
108
-
109
- verifiedWhenDerived = metaLemmaMetatheoremUnified; ///
110
- }
111
- }
112
-
113
- if (!verifiedWhenDerived) {
114
- const reference = this.declaration.getReference(),
115
- axiom = context.findAxiomByReference(reference),
116
- lemma = context.findLemmaByReference(reference),
117
- theorem = context.findTheoremByReference(reference),
118
- conjecture = context.findConjectureByReference(reference),
119
- axiomLemmaTheoremOrConjecture = (axiom || lemma || theorem || conjecture);
120
-
121
- if (axiomLemmaTheoremOrConjecture !== null) {
122
- const axiomLemmaTheoremOrConjectureUnified = this.frame.unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context);
123
-
124
- verifiedWhenDerived = axiomLemmaTheoremOrConjectureUnified; ///
125
- }
126
- }
98
+ verifiedWhenDerived = true;
127
99
 
128
100
  if (verifiedWhenDerived) {
129
101
  context.debug(`...verified the '${judgementString}' judgement when derived.`);
package/src/label.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import shim from "./shim";
4
4
  import LocalContext from "./context/local";
5
- import intrinsicLevelUnifier from "./unifier/intrinsicLevel";
5
+ import labelUnifier from "./unifier/label";
6
6
 
7
7
  import { nodeQuery } from "./utilities/query";
8
8
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "./utilities/json";
@@ -20,20 +20,9 @@ class Label {
20
20
 
21
21
  getString() { return this.metavariable.getString(); }
22
22
 
23
- matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
23
+ matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
24
24
 
25
- unifyReference(reference, generalContext, specificContext) {
26
- const { Substitutions } = shim,
27
- metavariableNode = this.metavariable.getNode(),
28
- referenceMetavariable = reference.getMetavariable(),
29
- referenceMetavariableNode = referenceMetavariable.getNode(),
30
- metavariableNodeA = referenceMetavariableNode, ///
31
- metavariableNodeB = metavariableNode, ///
32
- substitutions = Substitutions.fromNothing(),
33
- metavariableUnified = intrinsicLevelUnifier.unify(metavariableNodeA, metavariableNodeB, substitutions, generalContext, specificContext);
34
-
35
- return metavariableUnified;
36
- }
25
+ matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
37
26
 
38
27
  verifyWhenDeclared(fileContext) {
39
28
  let verifiedAtTopLevel = false;
package/src/lemma.js CHANGED
@@ -9,8 +9,9 @@ class Lemma extends TopLevelAssertion {
9
9
  verify() {
10
10
  let verified;
11
11
 
12
- const fileContext = this.getFileContext(),
13
- lemmaString = this.string; ///
12
+ const lemma = this, ///
13
+ fileContext = this.getFileContext(),
14
+ lemmaString = lemma.getString();
14
15
 
15
16
  (lemmaString === EMPTY_STRING) ?
16
17
  fileContext.trace(`Verifying a lemma...`) :