occam-verify-cli 1.0.405 → 1.0.415

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 (132) hide show
  1. package/lib/constants.js +1 -5
  2. package/lib/context/file.js +7 -8
  3. package/lib/context/local.js +3 -3
  4. package/lib/context/release.js +2 -2
  5. package/lib/context/temporary.js +103 -54
  6. package/lib/mixins/statement/verify.js +2 -2
  7. package/lib/mixins/step/unify.js +2 -2
  8. package/lib/node/argument.js +2 -2
  9. package/lib/node/assumption.js +6 -6
  10. package/lib/node/frame.js +19 -7
  11. package/lib/node/judgement.js +8 -1
  12. package/lib/node/statement.js +34 -15
  13. package/lib/node/substitution/term.js +3 -11
  14. package/lib/node/term.js +20 -8
  15. package/lib/nonTerminalNode.js +3 -3
  16. package/lib/ontology/assertion/contained.js +7 -7
  17. package/lib/ontology/assertion/defined.js +8 -8
  18. package/lib/ontology/assertion/subproof.js +3 -3
  19. package/lib/ontology/assumption.js +49 -45
  20. package/lib/ontology/combinator.js +3 -3
  21. package/lib/ontology/constructor.js +3 -3
  22. package/lib/ontology/declaration/combinator.js +3 -3
  23. package/lib/ontology/declaration/constructor.js +3 -3
  24. package/lib/ontology/equality.js +4 -4
  25. package/lib/ontology/equivalence.js +2 -2
  26. package/lib/ontology/frame.js +37 -12
  27. package/lib/ontology/judgement.js +13 -6
  28. package/lib/ontology/metavariable.js +75 -76
  29. package/lib/ontology/propertyRelation.js +2 -2
  30. package/lib/ontology/reference.js +33 -4
  31. package/lib/ontology/signature.js +2 -2
  32. package/lib/ontology/statement.js +33 -8
  33. package/lib/ontology/step.js +4 -4
  34. package/lib/ontology/substitution/frame.js +13 -15
  35. package/lib/ontology/substitution/statement.js +31 -32
  36. package/lib/ontology/substitution/term.js +26 -25
  37. package/lib/ontology/substitution.js +2 -2
  38. package/lib/ontology/substitutions.js +4 -4
  39. package/lib/ontology/term.js +26 -12
  40. package/lib/ontology/variable.js +2 -2
  41. package/lib/process/equate.js +322 -0
  42. package/lib/process/unify.js +623 -0
  43. package/lib/process/verify.js +612 -0
  44. package/lib/utilities/brackets.js +3 -8
  45. package/lib/utilities/context.js +4 -14
  46. package/lib/utilities/json.js +18 -1
  47. package/lib/utilities/pass.js +68 -0
  48. package/lib/utilities/substitutions.js +11 -16
  49. package/package.json +11 -11
  50. package/src/constants.js +0 -1
  51. package/src/context/file.js +8 -8
  52. package/src/context/local.js +2 -2
  53. package/src/context/release.js +1 -1
  54. package/src/context/temporary.js +124 -54
  55. package/src/mixins/statement/verify.js +3 -1
  56. package/src/mixins/step/unify.js +0 -1
  57. package/src/node/argument.js +1 -1
  58. package/src/node/assumption.js +4 -4
  59. package/src/node/frame.js +19 -5
  60. package/src/node/judgement.js +7 -0
  61. package/src/node/statement.js +35 -13
  62. package/src/node/substitution/term.js +4 -14
  63. package/src/node/term.js +20 -6
  64. package/src/nonTerminalNode.js +1 -1
  65. package/src/ontology/assertion/contained.js +6 -6
  66. package/src/ontology/assertion/defined.js +7 -7
  67. package/src/ontology/assertion/subproof.js +1 -1
  68. package/src/ontology/assumption.js +52 -57
  69. package/src/ontology/combinator.js +1 -1
  70. package/src/ontology/constructor.js +1 -1
  71. package/src/ontology/declaration/combinator.js +2 -3
  72. package/src/ontology/declaration/constructor.js +2 -2
  73. package/src/ontology/equality.js +3 -3
  74. package/src/ontology/equivalence.js +1 -1
  75. package/src/ontology/frame.js +44 -10
  76. package/src/ontology/judgement.js +8 -3
  77. package/src/ontology/metavariable.js +108 -102
  78. package/src/ontology/propertyRelation.js +3 -2
  79. package/src/ontology/reference.js +39 -1
  80. package/src/ontology/signature.js +3 -3
  81. package/src/ontology/statement.js +38 -4
  82. package/src/ontology/step.js +7 -7
  83. package/src/ontology/substitution/frame.js +13 -17
  84. package/src/ontology/substitution/statement.js +45 -48
  85. package/src/ontology/substitution/term.js +19 -19
  86. package/src/ontology/substitution.js +3 -2
  87. package/src/ontology/substitutions.js +3 -3
  88. package/src/ontology/term.js +26 -5
  89. package/src/ontology/variable.js +3 -2
  90. package/src/process/equate.js +212 -0
  91. package/src/process/unify.js +634 -0
  92. package/src/process/verify.js +584 -0
  93. package/src/utilities/brackets.js +2 -11
  94. package/src/utilities/context.js +1 -21
  95. package/src/utilities/json.js +19 -0
  96. package/src/utilities/{unifier.js → pass.js} +17 -1
  97. package/src/utilities/substitutions.js +10 -20
  98. package/lib/unifier/equantional.js +0 -170
  99. package/lib/unifier/intrinsicLevel.js +0 -144
  100. package/lib/unifier/metaLevel.js +0 -197
  101. package/lib/unifier/metavariable.js +0 -140
  102. package/lib/unifier/statementWithCombinator.js +0 -177
  103. package/lib/unifier/termWithConstructor.js +0 -145
  104. package/lib/unifier.js +0 -241
  105. package/lib/utilities/arguments.js +0 -28
  106. package/lib/utilities/frame.js +0 -18
  107. package/lib/utilities/metavariable.js +0 -18
  108. package/lib/utilities/statement.js +0 -18
  109. package/lib/utilities/unification.js +0 -109
  110. package/lib/utilities/unifier.js +0 -51
  111. package/lib/utilities/variable.js +0 -18
  112. package/lib/verifier/combinator.js +0 -158
  113. package/lib/verifier/constructor.js +0 -230
  114. package/lib/verifier/topLevel.js +0 -242
  115. package/lib/verifier.js +0 -219
  116. package/src/unifier/equantional.js +0 -90
  117. package/src/unifier/intrinsicLevel.js +0 -52
  118. package/src/unifier/metaLevel.js +0 -151
  119. package/src/unifier/metavariable.js +0 -50
  120. package/src/unifier/statementWithCombinator.js +0 -114
  121. package/src/unifier/termWithConstructor.js +0 -56
  122. package/src/unifier.js +0 -183
  123. package/src/utilities/arguments.js +0 -21
  124. package/src/utilities/frame.js +0 -13
  125. package/src/utilities/metavariable.js +0 -13
  126. package/src/utilities/statement.js +0 -13
  127. package/src/utilities/unification.js +0 -136
  128. package/src/utilities/variable.js +0 -13
  129. package/src/verifier/combinator.js +0 -72
  130. package/src/verifier/constructor.js +0 -96
  131. package/src/verifier/topLevel.js +0 -204
  132. package/src/verifier.js +0 -150
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-verify-cli",
3
3
  "author": "James Smith",
4
- "version": "1.0.405",
4
+ "version": "1.0.415",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
@@ -11,19 +11,19 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.36",
14
- "necessary": "^16.0.3",
15
- "occam-custom-grammars": "^5.0.1323",
16
- "occam-entities": "^1.0.432",
17
- "occam-file-system": "^6.0.447",
18
- "occam-furtle": "^2.0.266",
19
- "occam-grammars": "^1.3.415",
20
- "occam-lexers": "^23.1.22",
21
- "occam-parsers": "^23.1.25",
22
- "occam-query": "^4.1.131"
14
+ "necessary": "^16.0.10",
15
+ "occam-custom-grammars": "^5.0.1326",
16
+ "occam-entities": "^1.0.434",
17
+ "occam-file-system": "^6.0.449",
18
+ "occam-furtle": "^2.0.268",
19
+ "occam-grammars": "^1.3.418",
20
+ "occam-lexers": "^23.1.25",
21
+ "occam-parsers": "^23.1.28",
22
+ "occam-query": "^4.1.134"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@swc/core": "1.13.20",
26
- "watchful-cli": "^1.7.63"
26
+ "watchful-cli": "^1.7.67"
27
27
  },
28
28
  "scripts": {
29
29
  "clean": "rm -rf ./lib",
package/src/constants.js CHANGED
@@ -4,7 +4,6 @@ export const S = "s";
4
4
  export const NOTHING = "";
5
5
  export const MISSING = "missing";
6
6
  export const FUNCTION = "function";
7
- export const TYPE_TYPE = "type";
8
7
  export const UNDEFINED = "undefined";
9
8
  export const PROVISIONAL = "Provisional";
10
9
  export const EMPTY_STRING = "";
@@ -3,9 +3,9 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import ontology from "../ontology";
6
- import topLevelVerifier from "../verifier/topLevel";
7
6
 
8
7
  import { baseType } from "../ontology/type";
8
+ import { verifyFile } from "../process/verify";
9
9
  import { nodeAsTokens, nodeAsString, nodesAsString, tokensAsString } from "../utilities/string";
10
10
  import { typesFromJSON,
11
11
  rulesFromJSON,
@@ -641,9 +641,9 @@ export default class FileContext {
641
641
  findJudgementByMetavariable(metavariable) {
642
642
  const judgements = this.getJudgements(),
643
643
  judgement = judgements.find((judgement) => {
644
- const judgementSimple = judgement.isSimple();
644
+ const judgementSingular = judgement.isSingular();
645
645
 
646
- if (judgementSimple) {
646
+ if (judgementSingular) {
647
647
  const judgementMetavariable = judgement.getMetavariable(),
648
648
  judgementMetavariableEqualToMetavariable = judgementMetavariable.isEqualTo(metavariable);
649
649
 
@@ -861,12 +861,12 @@ export default class FileContext {
861
861
  } else {
862
862
  this.debug(`Verifying the '${this.filePath}' file...`);
863
863
 
864
- const fileContext = this, ///
865
- verifiesAtTopLevel = topLevelVerifier.verify(this.node, fileContext);
864
+ const context = this, ///
865
+ fileNode = this.node; ///
866
+
867
+ verifies = verifyFile(fileNode, context);
866
868
 
867
- if (verifiesAtTopLevel) {
868
- verifies = true;
869
- } else {
869
+ if (!verifies) {
870
870
  this.clear();
871
871
  }
872
872
 
@@ -229,9 +229,9 @@ class LocalContext {
229
229
  findJudgementByMetavariable(metavariable) {
230
230
  const judgements = this.getJudgements(),
231
231
  judgement = judgements.find((judgement) => {
232
- const judgementSimple = judgement.isSimple();
232
+ const judgementSingular = judgement.isSingular();
233
233
 
234
- if (judgementSimple) {
234
+ if (judgementSingular) {
235
235
  const judgementMetavariable = judgement.getMetavariable(),
236
236
  judgementMetavariableEqualToMetavariable = judgementMetavariable.isEqualTo(metavariable);
237
237
 
@@ -526,7 +526,7 @@ function verifyTypePrefixes(typePrefixes, releaseContext) {
526
526
  const typePrefixAName = typePrefixA.getName(),
527
527
  typePrefixBName = typePrefixB.getName();
528
528
 
529
- if (typePrefixAName === typePrefixBName) {
529
+ if (typePrefixAName !== typePrefixBName) {
530
530
  return true;
531
531
  }
532
532
  });
@@ -5,15 +5,15 @@ import { arrayUtilities } from "necessary";
5
5
  const { extract, compress } = arrayUtilities;
6
6
 
7
7
  export default class TemporaryContext {
8
- constructor(context, tokens, terms, frames, statements, assertions, substitutions, reference) {
8
+ constructor(context, tokens, terms, frames, statements, assertions, references, substitutions) {
9
9
  this.context = context;
10
10
  this.tokens = tokens;
11
11
  this.terms = terms;
12
12
  this.frames = frames;
13
13
  this.statements = statements;
14
14
  this.assertions = assertions;
15
+ this.references = references;
15
16
  this.substitutions = substitutions;
16
- this.reference = reference;
17
17
  }
18
18
 
19
19
  getContext() {
@@ -40,111 +40,126 @@ export default class TemporaryContext {
40
40
  return this.assertions;
41
41
  }
42
42
 
43
- getSubstitutions() {
44
- return this.substitutions;
43
+ getReferences() {
44
+ return this.references;
45
45
  }
46
46
 
47
- getReference() {
48
- return this.reference;
47
+ getSubstitutions() {
48
+ return this.substitutions;
49
49
  }
50
50
 
51
51
  addTerm(term) {
52
- const context = this, ///
53
- termNode = term.getNode(),
52
+ const termA = term, ///
53
+ context = this, ///
54
54
  termString = term.getString();
55
55
 
56
56
  extract(this.terms, (term) => {
57
- const termMatchesTermNode = term.matchTermNode(termNode);
57
+ const termB = term, ///
58
+ termAEqualToTermB = termA.isEqualTo(termB);
58
59
 
59
- if (termMatchesTermNode) {
60
+ if (termAEqualToTermB) {
60
61
  return true;
61
62
  }
62
63
  });
63
64
 
64
- context.trace(`ADded the '${termString}' term.`);
65
+ context.trace(`ADded the '${termString}' term to the context.`);
65
66
 
66
67
  this.terms.push(term);
67
68
  }
68
69
 
69
70
  addFrame(frame) {
70
- const context = this, ///
71
- frameNode = frame.getNode(),
71
+ const frameA = frame, ///
72
+ context = this, ///
72
73
  frameString = frame.getString();
73
74
 
74
75
  extract(this.frames, (frame) => {
75
- const frameMatchesFrameNode = frame.matchFrameNode(frameNode);
76
+ const frameB = frame, ///
77
+ frameAEqualToFrameB = frameA.isEqualTo(frameB);
76
78
 
77
- if (frameMatchesFrameNode) {
79
+ if (frameAEqualToFrameB) {
78
80
  return true;
79
81
  }
80
82
  });
81
83
 
82
- context.trace(`Added the '${frameString}' frame.`);
84
+ context.trace(`Added the '${frameString}' frame to the context.`);
83
85
 
84
86
  this.frames.push(frame);
85
87
  }
86
88
 
87
89
  addStatement(statement) {
88
90
  const context = this, ///
89
- statementNode = statement.getNode(),
91
+ statementA = statement, ///
90
92
  statementString = statement.getString();
91
93
 
92
94
  extract(this.statements, (statement) => {
93
- const statementMatchesFrameNode = statement.matchStatementNode(statementNode);
95
+ const statementB = statement, ///
96
+ statementAEqualToFrameB = statementA.isEqualTo(statementB);
94
97
 
95
- if (statementMatchesFrameNode) {
98
+ if (statementAEqualToFrameB) {
96
99
  return true;
97
100
  }
98
101
  });
99
102
 
100
- context.trace(`Added the '${statementString}' statement.`);
103
+ context.trace(`Added the '${statementString}' statement to the context.`);
101
104
 
102
105
  this.statements.push(statement);
103
106
  }
104
107
 
105
108
  addAssertion(assertion) {
106
109
  const context = this, ///
107
- assertionNode = assertion.getNode(),
110
+ assertionA = assertion, ///
108
111
  assertionString = assertion.getString();
109
112
 
110
113
  extract(this.assertions, (assertion) => {
111
- const assertionMatchesFrameNode = assertion.matchAssertionNode(assertionNode);
114
+ const assertionB = assertion, ///
115
+ assertionAEqualToAssertionB = assertionA.isEqualTo(assertionB);
112
116
 
113
- if (assertionMatchesFrameNode) {
117
+ if (assertionAEqualToAssertionB) {
114
118
  return true;
115
119
  }
116
120
  });
117
121
 
118
- context.trace(`Added the '${assertionString}' assertion.`);
122
+ context.trace(`Added the '${assertionString}' assertion to the context.`);
119
123
 
120
124
  this.assertions.push(assertion);
121
125
  }
122
126
 
123
- addSubstitution(substitution) {
127
+ addReference(reference) {
124
128
  const context = this, ///
125
- substitutionNode = substitution.getNode(),
126
- substitutionString = substitution.getString();
129
+ referenceA = reference, ///
130
+ referenceString = reference.getString();
127
131
 
128
- extract(this.substitutions, (substitution) => {
129
- const substitutionMatchesFrameNode = substitution.matchSubstitutionNode(substitutionNode);
132
+ extract(this.references, (reference) => {
133
+ const referenceB = reference, ///
134
+ referenceAEqualToReferenceB = referenceA.isEqualTo(referenceB);
130
135
 
131
- if (substitutionMatchesFrameNode) {
136
+ if (referenceAEqualToReferenceB) {
132
137
  return true;
133
138
  }
134
139
  });
135
140
 
136
- context.trace(`Added the '${substitutionString}' substitution.`);
141
+ context.trace(`Added the '${referenceString}' reference to the context.`);
137
142
 
138
- this.substitutions.push(substitution);
143
+ this.references.push(reference);
139
144
  }
140
145
 
141
- addReference(reference) {
146
+ addSubstitution(substitution) {
142
147
  const context = this, ///
143
- referenceString = reference.getString();
148
+ substitutionA = substitution, ///
149
+ substitutionString = substitution.getString();
144
150
 
145
- this.reference = reference;
151
+ extract(this.substitutions, (substitution) => {
152
+ const substitutionB = substitution, ///
153
+ substituionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
146
154
 
147
- context.trace(`Added the '${referenceString}' reference.`);
155
+ if (substituionAEqualToSubstitutionB) {
156
+ return true;
157
+ }
158
+ });
159
+
160
+ context.trace(`Added the '${substitutionString}' substitution to the context.`);
161
+
162
+ this.substitutions.push(substitution);
148
163
  }
149
164
 
150
165
  findTermByTermNode(termNode) {
@@ -171,6 +186,18 @@ export default class TemporaryContext {
171
186
  return frame;
172
187
  }
173
188
 
189
+ findStatementByStatementNode(statementNode) {
190
+ const statement = this.statements.find((statement) => {
191
+ const statementMatchesStatementNode = statement.matchStatementNode(statementNode);
192
+
193
+ if (statementMatchesStatementNode) {
194
+ return true;
195
+ }
196
+ }) || null;
197
+
198
+ return statement;
199
+ }
200
+
174
201
  findAssertionByAssertionNode(assertionNode) {
175
202
  const assertion = this.assertions.find((assertion) => {
176
203
  const assertionMatchesAssertionNode = assertion.matchAssertionNode(assertionNode);
@@ -183,21 +210,21 @@ export default class TemporaryContext {
183
210
  return assertion;
184
211
  }
185
212
 
186
- findStatementByStatementNode(statementNode) {
187
- const statement = this.statements.find((statement) => {
188
- const statementMatchesStatementNode = statement.matchStatementNode(statementNode);
213
+ findReferenceByMetavariableNode(metavariableNode) {
214
+ const reference = this.references.find((reference) => {
215
+ const referenceMatcheMetavariableNode = reference.matchMetavariableNode(metavariableNode);
189
216
 
190
- if (statementMatchesStatementNode) {
217
+ if (referenceMatcheMetavariableNode) {
191
218
  return true;
192
219
  }
193
220
  }) || null;
194
221
 
195
- return statement;
222
+ return reference;
196
223
  }
197
224
 
198
- findSubtitutionBySubtitutionNode(substitutionNode) {
225
+ findSubstitutionBySubstitutionNode(substitutionNode) {
199
226
  const substitution = this.substitutions.find((substitution) => {
200
- const substitutionMatchesSubtitutionNode = substitution.matchSubtitutionNode(substitutionNode);
227
+ const substitutionMatchesSubtitutionNode = substitution.matchSubstitutionNode(substitutionNode);
201
228
 
202
229
  if (substitutionMatchesSubtitutionNode) {
203
230
  return true;
@@ -381,11 +408,12 @@ export default class TemporaryContext {
381
408
 
382
409
  error(message, node = null) { this.context.error(message, node); }
383
410
 
384
- marge(context) {
411
+ merge(context) {
385
412
  const terms = context.getTerms(),
386
413
  frames = context.getFrames(),
387
414
  statements = context.getStatements(),
388
415
  assertions = context.getAssertions(),
416
+ references = context.getReferences(),
389
417
  substitutions = context.getSubstitutions();
390
418
 
391
419
  this.terms = [
@@ -408,21 +436,63 @@ export default class TemporaryContext {
408
436
  ...assertions
409
437
  ];
410
438
 
439
+ this.references = [
440
+ ...this.references,
441
+ ...references
442
+ ];
443
+
411
444
  this.substitutions = [
412
445
  ...this.substitutions,
413
446
  ...substitutions
414
447
  ];
415
448
 
416
449
  compress(this.terms, (termA, termB) => {
417
- const termANode = termA.getNode(),
418
- termBNode = termB.getNode(),
419
- termANodeMatchesTermBNode = termANode.match(termBNode);
450
+ const termAEqualToTermB = termA.isEqualTo(termB);
451
+
452
+ if (!termAEqualToTermB) {
453
+ return true;
454
+ }
455
+ });
456
+
457
+ compress(this.frames, (frameA, frameB) => {
458
+ const frameAEqualToFrameB = frameA.isEqualTo(frameB);
459
+
460
+ if (!frameAEqualToFrameB) {
461
+ return true;
462
+ }
463
+ });
464
+
465
+ compress(this.statements, (statementA, statementB) => {
466
+ const statementAEqualToStatementB = statementA.isEqualTo(statementB);
420
467
 
421
- if (termAMatchesTermB) {
468
+ if (!statementAEqualToStatementB) {
422
469
  return true;
423
470
  }
424
471
  });
425
472
 
473
+ compress(this.assertions, (assertionA, assertionB) => {
474
+ const assertionAEqualToAssertionB = assertionA.isEqualTo(assertionB);
475
+
476
+ if (!assertionAEqualToAssertionB) {
477
+ return true;
478
+ }
479
+ });
480
+
481
+ compress(this.references, (referenceA, referenceB) => {
482
+ const referenceAEqualToReferenceB = referenceA.isEqualTo(referenceB);
483
+
484
+ if (!referenceAEqualToReferenceB) {
485
+ return true;
486
+ }
487
+ });
488
+
489
+ compress(this.substitutions, (substitutionA, substitutionB) => {
490
+ const substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
491
+
492
+ if (!substitutionAEqualToSubstitutionB) {
493
+ return true;
494
+ }
495
+ });
426
496
  }
427
497
 
428
498
  static fromNothing(context) {
@@ -431,9 +501,9 @@ export default class TemporaryContext {
431
501
  tokens = null,
432
502
  statements = [],
433
503
  assertions = [],
504
+ references = [],
434
505
  substitutions = [],
435
- reference = null,
436
- temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
506
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, references, substitutions);
437
507
 
438
508
  return temporaryContext;
439
509
  }
@@ -442,9 +512,9 @@ export default class TemporaryContext {
442
512
  const tokens = null,
443
513
  statements = [],
444
514
  assertions = [],
515
+ references = [],
445
516
  substitutions = [],
446
- reference = null,
447
- temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
517
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, references, substitutions);
448
518
 
449
519
  return temporaryContext;
450
520
  }
@@ -454,9 +524,9 @@ export default class TemporaryContext {
454
524
  frames = [],
455
525
  statements = [],
456
526
  assertions = [],
527
+ references = [],
457
528
  substitutions = [],
458
- reference = null,
459
- temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
529
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, references, substitutions);
460
530
 
461
531
  return temporaryContext;
462
532
  }
@@ -26,7 +26,9 @@ function verifyAsMetavariableAndSubstitution(statement, assignments, stated, con
26
26
 
27
27
  if (metavariableVerifies) {
28
28
  const { TermSubstitution, FrameSubstitution } = ontology,
29
- substitution = TermSubstitution.fromStatement(statement, context) || FrameSubstitution.fromStatement(statement, context);
29
+ frameSubstitution = FrameSubstitution.fromStatement(statement, context),
30
+ termSubstitution = TermSubstitution.fromStatement(statement, context),
31
+ substitution = (termSubstitution || frameSubstitution);
30
32
 
31
33
  if (substitution !== null) {
32
34
  const substitutionVerifies = substitution.verify(context);
@@ -54,7 +54,6 @@ function unifyWithReference(statement, reference, satisfiesAssertion, substituti
54
54
 
55
55
  const { StatementSubstitution } = ontology,
56
56
  metavariable = reference.getMetavariable(),
57
- specificContext = context, ///
58
57
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
59
58
  substitution = statementSubstitution; ///
60
59
 
@@ -21,7 +21,7 @@ export default class ArgumentNode extends NonTerminalNode {
21
21
 
22
22
  getSingularTermNode() {
23
23
  const ruleName = TERM_RULE_NAME,
24
- singularTermNode = this.getSingularTNodeByRuleName(ruleName);
24
+ singularTermNode = this.getSingularNodeByRuleName(ruleName);
25
25
 
26
26
  return singularTermNode;
27
27
  }
@@ -5,16 +5,16 @@ import DocumentNode from "../nonTerminalNode";
5
5
  import { STATEMENT_RULE_NAME, METAVARIABLE_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class AssumptionpNode extends DocumentNode {
8
- isSimple() {
9
- let simple = false;
8
+ isSingular() {
9
+ let singular = false;
10
10
 
11
11
  const statementNode = this.getStatementNode();
12
12
 
13
13
  if (statementNode === null) {
14
- simple = true;
14
+ singular = true;
15
15
  }
16
16
 
17
- return simple;
17
+ return singular;
18
18
  }
19
19
 
20
20
  getStatementNode() {
package/src/node/frame.js CHANGED
@@ -5,16 +5,16 @@ import NonTerminalNode from "../nonTerminalNode";
5
5
  import { ASSUMPTION_RULE_NAME, METAVARIABLE_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class FrameNode extends NonTerminalNode {
8
- isSimple() {
9
- let simple = false;
8
+ isSingular() {
9
+ let singular = false;
10
10
 
11
11
  const singularAssumptionNode = this.getSingularAssumptionNode();
12
12
 
13
13
  if (singularAssumptionNode !== null) {
14
- simple = singularAssumptionNode.isSimple();
14
+ singular = singularAssumptionNode.isSingular();
15
15
  }
16
16
 
17
- return simple;
17
+ return singular;
18
18
  }
19
19
 
20
20
  getAssumptionNodes() {
@@ -24,6 +24,20 @@ export default class FrameNode extends NonTerminalNode {
24
24
  return declarationNodes;
25
25
  }
26
26
 
27
+ getMetavariableName() {
28
+ let metavariableName = null;
29
+
30
+ const singular = this.isSingular();
31
+
32
+ if (singular) {
33
+ const singularMetavariableNode = this.getSingularMetavariableNode();
34
+
35
+ metavariableName = singularMetavariableNode.getMetavariableName();
36
+ }
37
+
38
+ return metavariableName;
39
+ }
40
+
27
41
  getMetavariableNodes() {
28
42
  const ruleName = METAVARIABLE_RULE_NAME,
29
43
  metavariableNodes = this.getNodesByRuleName(ruleName);
@@ -33,7 +47,7 @@ export default class FrameNode extends NonTerminalNode {
33
47
 
34
48
  getSingularAssumptionNode() {
35
49
  const ruleName = ASSUMPTION_RULE_NAME,
36
- singularAssumptionNode = this.getSingularTNodeByRuleName(ruleName);
50
+ singularAssumptionNode = this.getSingularNodeByRuleName(ruleName);
37
51
 
38
52
  return singularAssumptionNode;
39
53
  }
@@ -5,6 +5,13 @@ import NonTerminalNode from "../nonTerminalNode";
5
5
  import { FRAME_RULE_NAME, ASSUMPTION_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class JudgementNode extends NonTerminalNode {
8
+ isSingular() {
9
+ const frameNode = this.getFrameNode(),
10
+ singular = frameNode.isSingular();
11
+
12
+ return singular;
13
+ }
14
+
8
15
  getFrameNode() {
9
16
  const ruleName = FRAME_RULE_NAME,
10
17
  frameNode = this.getNodeByRuleName(ruleName);
@@ -19,16 +19,38 @@ import { TERM_RULE_NAME,
19
19
  STATEMENT_SUBSTITUTION_RULE_NAME } from "../ruleNames";
20
20
 
21
21
  export default class StatementNode extends NonTerminalNode {
22
- isSimple() {
23
- let simple = false;
22
+ getMetavariableName() {
23
+ let metavariableName = null;
24
24
 
25
- const metavariableNode = this.getMetavariableNode();
25
+ const singular = this.isSingular();
26
26
 
27
- if (metavariableNode !== null) {
28
- simple = true;
27
+ if (singular) {
28
+ const singularMetavariableNode = this.getSingularMetavariableNode();
29
+
30
+ metavariableName = singularMetavariableNode.getMetavariableName();
31
+ }
32
+
33
+ return metavariableName;
34
+ }
35
+
36
+ getSubstitutionNode() {
37
+ const frameSubstitutionNode = this.getFrameSubstitutionNode(),
38
+ termSubstitutionNode = this.getTermSubstitutionNode(),
39
+ substitutionNode = (frameSubstitutionNode || termSubstitutionNode);
40
+
41
+ return substitutionNode;
42
+ }
43
+
44
+ isSingular() {
45
+ let singular = false;
46
+
47
+ const singularMetavariableNode = this.getSingularMetavariableNode();
48
+
49
+ if (singularMetavariableNode !== null) {
50
+ singular = true;
29
51
  }
30
52
 
31
- return simple;
53
+ return singular;
32
54
  }
33
55
 
34
56
  getTermNodes() {
@@ -59,13 +81,6 @@ export default class StatementNode extends NonTerminalNode {
59
81
  return judgementNode;
60
82
  }
61
83
 
62
- getMetavariableNode() {
63
- const ruleName = METAVARIABLE_RULE_NAME,
64
- metavariableNode = this.getNodeByRuleName(ruleName);
65
-
66
- return metavariableNode;
67
- }
68
-
69
84
  getTypeAssertionNode() {
70
85
  const ruleName = TYPE_ASSERTION_RULE_NAME,
71
86
  typeAssertionNode = this.getNodeByRuleName(ruleName);
@@ -134,6 +149,13 @@ export default class StatementNode extends NonTerminalNode {
134
149
  return satisfiedAssertionNode;
135
150
  }
136
151
 
152
+ getSingularMetavariableNode() {
153
+ const ruleName = METAVARIABLE_RULE_NAME,
154
+ singularMetavariableNode = this.getSingularNodeByRuleName(ruleName);
155
+
156
+ return singularMetavariableNode;
157
+ }
158
+
137
159
  getSingularMetaArgumentNode() {
138
160
  const ruleName = META_ARGUMENT_RULE_NAME,
139
161
  singularMetaArgumentNode = this.getNodeByRuleName(ruleName);
@@ -20,27 +20,17 @@ export default class TermSubstitutionNode extends SubstitutionNode {
20
20
  }
21
21
 
22
22
  getLastVariableNode() {
23
- let lastVariableNode = null;
24
-
25
23
  const lastTermNode = this.getLastTermNode(),
26
- singularVariableNode = lastTermNode.getSingularVariableNode();
27
-
28
- if (singularVariableNode !== null) {
29
- lastVariableNode = singularVariableNode; ///
30
- }
24
+ singularVariableNode = lastTermNode.getSingularVariableNode(),
25
+ lastVariableNode = singularVariableNode; ///
31
26
 
32
27
  return lastVariableNode;
33
28
  }
34
29
 
35
30
  getFirstVariableNode() {
36
- let firstVariableNode = null;
37
-
38
31
  const firstTermNode = this.getFirstTermNode(),
39
- singularVariableNode = firstTermNode.getSingularVariableNode();
40
-
41
- if (singularVariableNode !== null) {
42
- firstVariableNode = singularVariableNode; ///
43
- }
32
+ singularVariableNode = firstTermNode.getSingularVariableNode(),
33
+ firstVariableNode = singularVariableNode; ///
44
34
 
45
35
  return firstVariableNode;
46
36
  }