occam-verify-cli 0.0.950 → 0.0.952

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.
@@ -4,15 +4,15 @@ import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
4
4
 
5
5
  import FileContext from "./file";
6
6
 
7
- import { push } from "../utilities/array";
8
7
  import { objectType } from "../type";
8
+ import { tail, push, leftDifference } from "../utilities/array";
9
9
  import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
10
10
 
11
11
  const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
12
12
  { florenceParserFromCombinedCustomGrammar } = parsersUtilities;
13
13
 
14
14
  export default class ReleaseContext {
15
- constructor(log, json, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts) {
15
+ constructor(log, json, name, entries, lexer, parser, verified, fileContexts, customGrammar, loggingDisabled, dependencyReleaseContexts) {
16
16
  this.log = log;
17
17
  this.json = json;
18
18
  this.name = name;
@@ -20,8 +20,9 @@ export default class ReleaseContext {
20
20
  this.lexer = lexer;
21
21
  this.parser = parser;
22
22
  this.verified = verified;
23
- this.customGrammar = customGrammar;
24
23
  this.fileContexts = fileContexts;
24
+ this.customGrammar = customGrammar;
25
+ this.loggingDisabled = loggingDisabled;
25
26
  this.dependencyReleaseContexts = dependencyReleaseContexts;
26
27
  }
27
28
 
@@ -53,18 +54,66 @@ export default class ReleaseContext {
53
54
  return this.verified;
54
55
  }
55
56
 
57
+ getFileContexts() {
58
+ return this.fileContexts;
59
+ }
60
+
56
61
  getCustomGrammar() {
57
62
  return this.customGrammar;
58
63
  }
59
64
 
60
- getFileContexts() {
61
- return this.fileContexts;
65
+ isLoggingDisabled() {
66
+ return this.loggingDisabled;
62
67
  }
63
68
 
64
69
  getDependencyReleaseContexts() {
65
70
  return this.dependencyReleaseContexts;
66
71
  }
67
72
 
73
+ setLog(log) {
74
+ this.log = log;
75
+ }
76
+
77
+ setJSON(json) {
78
+ this.json = json;
79
+ }
80
+
81
+ setName(name) {
82
+ this.name = name;
83
+ }
84
+
85
+ setEntries(entries) {
86
+ this.entries = entries;
87
+ }
88
+
89
+ setLexer(lexer) {
90
+ this.lexer = lexer;
91
+ }
92
+
93
+ setParser(parser) {
94
+ this.parser = parser;
95
+ }
96
+
97
+ setVerified(verified) {
98
+ this.verified = verified;
99
+ }
100
+
101
+ setFileContexts(fileContexts) {
102
+ this.fileContexts = fileContexts;
103
+ }
104
+
105
+ setCustomGrammar(customGrammar) {
106
+ this.customGrammar = customGrammar;
107
+ }
108
+
109
+ setLoggingDisabled(loggingDisabled) {
110
+ this.loggingDisabled = loggingDisabled;
111
+ }
112
+
113
+ setDependencyReleaseContexts(dependencyReleaseContexts) {
114
+ this.dependencyReleaseContexts = dependencyReleaseContexts;
115
+ }
116
+
68
117
  getLabels(includeDependencies = true) {
69
118
  const labels = [];
70
119
 
@@ -356,53 +405,87 @@ export default class ReleaseContext {
356
405
 
357
406
  matchShortenedVersion(shortenedVersion) { return this.entries.matchShortenedVersion(shortenedVersion); }
358
407
 
359
- setVerified(verified) {
360
- this.verified = verified;
408
+ disableLogging() {
409
+ const loggingDisabled = true;
410
+
411
+ this.setLoggingDisabled(loggingDisabled);
412
+ }
413
+
414
+ enableLogging() {
415
+ const loggingDisabled = false;
416
+
417
+ this.setLoggingDisabled(loggingDisabled);
361
418
  }
362
419
 
363
- tokenise(content) { return this.lexer.tokenise(content); }
420
+ trace(message, node = null, tokens = null, filePath = null) {
421
+ if (this.loggingDisabled) {
422
+ return;
423
+ }
424
+
425
+ this.log.trace(message, node, tokens, filePath);
426
+ }
427
+
428
+ debug(message, node = null, tokens = null, filePath = null) {
429
+ if (this.loggingDisabled) {
430
+ return;
431
+ }
432
+
433
+ this.log.debug(message, node, tokens, filePath);
434
+ }
364
435
 
365
- parse(tokens) { return this.parser.parse(tokens); }
436
+ info(message, node = null, tokens = null, filePath = null) {
437
+ if (this.loggingDisabled) {
438
+ return;
439
+ }
366
440
 
367
- trace(message, node = null, tokens = null, filePath = null) { this.log.trace(message, node, tokens, filePath); }
441
+ this.log.info(message, node, tokens, filePath);
442
+ }
368
443
 
369
- debug(message, node = null, tokens = null, filePath = null) { this.log.debug(message, node, tokens, filePath); }
444
+ warning(message, node = null, tokens = null, filePath = null) {
445
+ if (this.loggingDisabled) {
446
+ return;
447
+ }
370
448
 
371
- info(message, node = null, tokens = null, filePath = null) { this.log.info(message, node, tokens, filePath); }
449
+ this.log.warning(message, node, tokens, filePath);
450
+ }
372
451
 
373
- warning(message, node = null, tokens = null, filePath = null) { this.log.warning(message, node, tokens, filePath); }
452
+ error(message, node = null, tokens = null, filePath = null) {
453
+ if (this.loggingDisabled) {
454
+ return;
455
+ }
374
456
 
375
- error(message, node = null, tokens = null, filePath = null) { this.log.error(message, node, tokens, filePath); }
457
+ this.log.error(message, node, tokens, filePath);
458
+ }
376
459
 
377
- fatal(message, node = null, tokens = null, filePath = null) { this.log.fatal(message, node, tokens, filePath); }
460
+ fatal(message, node = null, tokens = null, filePath = null) {
461
+ if (this.loggingDisabled) {
462
+ return;
463
+ }
378
464
 
379
- initialise(releaseContexts) {
380
- releaseContexts = releaseContexts.slice(); ///
465
+ this.log.fatal(message, node, tokens, filePath);
466
+ }
381
467
 
468
+ verify(releaseContexts) {
382
469
  const combinedCustomGrammar = combinedCustomGrammarFromReleaseContexts(releaseContexts),
383
- florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar),
384
- florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
470
+ florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar),
471
+ florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar);
385
472
 
386
473
  this.lexer = florenceLexer; ///
387
474
 
388
475
  this.parser = florenceParser; ///
389
476
 
390
- const releaseContext = releaseContexts.shift(),
391
- dependencyReleaseContexts = releaseContexts; ///
392
-
393
- this.dependencyReleaseContexts = dependencyReleaseContexts;
477
+ this.dependencyReleaseContexts = tail(releaseContexts)
394
478
 
395
479
  if (this.json !== null) {
396
- const fileContextsJSON = this.json; ///
480
+ const releaseContext = this;
397
481
 
398
- fileContextsJSON.forEach((fileContextJSON) => {
399
- const json = fileContextJSON, ///
400
- fileContext = FileContext.fromJSONAndReleaseContext(json, releaseContext);
482
+ releaseContext.disableLogging();
401
483
 
402
- fileContext.initialise(json);
484
+ this.fileContexts = fileContextsFromJSON(this.json, releaseContext);
403
485
 
404
- this.fileContexts.push(fileContext);
405
- });
486
+ verifyFileContexts(this.fileContexts, releaseContext);
487
+
488
+ releaseContext.enableLogging();
406
489
 
407
490
  this.verified = true;
408
491
  }
@@ -423,11 +506,59 @@ export default class ReleaseContext {
423
506
  const lexer = null,
424
507
  parser = null,
425
508
  verified = false,
426
- customGrammar = customGrammarFromNameAndEntries(name, entries),
427
509
  fileContexts = [],
510
+ customGrammar = customGrammarFromNameAndEntries(name, entries),
511
+ loggingDisabled = false,
428
512
  dependencyReleaseContexts = null,
429
- releaseContext = new ReleaseContext(log, json, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts);
513
+ releaseContext = new ReleaseContext(log, json, name, entries, lexer, parser, verified, fileContexts, customGrammar, loggingDisabled, dependencyReleaseContexts);
430
514
 
431
515
  return releaseContext;
432
516
  }
433
- }
517
+ }
518
+
519
+ function verifyFileContexts(fileContexts, releaseContext) {
520
+ fileContexts = [ ///
521
+ ...fileContexts
522
+ ];
523
+
524
+ for (;;) {
525
+ const fileContextsLength = fileContexts.length;
526
+
527
+ if (fileContextsLength === 0) {
528
+ break;
529
+ }
530
+
531
+ const verifiedFileContexts = [];
532
+
533
+ fileContexts.forEach((fileContext) => {
534
+ const verified = fileContext.verify(releaseContext);
535
+
536
+ if (verified) {
537
+ const verifiedFileContext = fileContext; ///
538
+
539
+ verifiedFileContexts.push(verifiedFileContext);
540
+ }
541
+ });
542
+
543
+ const verifiedFileContextsLength = verifiedFileContexts.length,
544
+ fileVerified = (verifiedFileContextsLength > 0);
545
+
546
+ if (!fileVerified) {
547
+ break;
548
+ }
549
+
550
+ leftDifference(fileContexts, verifiedFileContexts);
551
+ }
552
+ }
553
+
554
+ function fileContextsFromJSON(json, releaseContext) {
555
+ const fileContextsJSON = json, ///
556
+ fileContexts = fileContextsJSON.map((fileContextJSON) => {
557
+ const json = fileContextJSON, ///
558
+ fileContext = FileContext.fromJSONAndReleaseContext(json, releaseContext);
559
+
560
+ return fileContext;
561
+ });
562
+
563
+ return fileContexts;
564
+ }
@@ -16,23 +16,23 @@ export default class Declaration {
16
16
  return this.statementNode;
17
17
  }
18
18
 
19
- matchSubstitution(substitution) {
19
+ unifySubstitution(substitution) {
20
20
  const statementNode = substitution.getStatementNode(),
21
21
  metavariableNode = substitution.getMetavariableNode(),
22
- matchesStatementNode = this.matchStatementNode(statementNode),
23
- matchesMetavariableNode = this.matchMetavariableNode(metavariableNode),
24
- matchesSubstitution = (matchesMetavariableNode && matchesStatementNode);
22
+ statementUnified = this.unifyStatement(statementNode),
23
+ metavariableUnified = this.unifyMetavariable(metavariableNode),
24
+ substitutionUnified = (metavariableUnified && statementUnified);
25
25
 
26
- return matchesSubstitution;
26
+ return substitutionUnified;
27
27
  }
28
28
 
29
- matchMetavariableNode(metavariableNode) {
29
+ unifyMetavariable(metavariableNode) {
30
30
  const matchesMetavariableNode = this.metavariableNode.match(metavariableNode);
31
31
 
32
32
  return matchesMetavariableNode;
33
33
  }
34
34
 
35
- matchStatementNode(statementNode) {
35
+ unifyStatement(statementNode) {
36
36
  const statementNodeA = statementNode, ///
37
37
  statementNodeB = this.statementNode, ///
38
38
  statementMatches = matchStatementModuloBrackets(statementNodeA, statementNodeB),
@@ -41,13 +41,13 @@ export default class Declaration {
41
41
  return matchesStatementNode;
42
42
  }
43
43
 
44
- matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem) {
44
+ unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem) {
45
45
  const consequent = metaLemmaMetatheorem.getConsequent(),
46
46
  statementNode = consequent.getStatementNode(),
47
47
  matches = this.statementNode.match(statementNode),
48
- matchesMetaLemmaOrMetaTheorem = matches; ///
48
+ metaLemmaOrMetaTheoremUnified = matches; ///
49
49
 
50
- return matchesMetaLemmaOrMetaTheorem;
50
+ return metaLemmaOrMetaTheoremUnified;
51
51
  }
52
52
 
53
53
  static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
package/src/frame.js CHANGED
@@ -36,29 +36,30 @@ export default class Frame {
36
36
  push(this.declarations, declarations);
37
37
  }
38
38
 
39
- matchSubstitution(substitution) {
40
- const matchesSubstitution = this.declarations.some((declaration) => {
41
- const declarationMatchesSubstitution = declaration.matchSubstitution(substitution);
39
+ unifySubstitution(substitution) {
40
+ const substitutionUnified = this.declarations.some((declaration) => {
41
+ const substitutionUnifiedAgainstDeclaration = declaration.unifySubstitution(substitution);
42
42
 
43
- if (declarationMatchesSubstitution) {
43
+ if (substitutionUnifiedAgainstDeclaration) {
44
44
  return true;
45
45
  }
46
46
  });
47
47
 
48
- return matchesSubstitution;
48
+ return substitutionUnified;
49
49
  }
50
50
 
51
- matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem) {
51
+ unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem) {
52
52
  const substitutions = metaLemmaMetatheorem.getSubstitutions(),
53
- matchesMetaLemmaOrMetaTheorem = substitutions.everySubstitution((substitution) => {
54
- const frameMatchesSubstitution = this.matchSubstitution(substitution);
53
+ substitutionsUnified = substitutions.everySubstitution((substitution) => {
54
+ const substitutionUnified = this.unifySubstitution(substitution);
55
55
 
56
- if (frameMatchesSubstitution) {
56
+ if (substitutionUnified) {
57
57
  return true;
58
58
  }
59
- });
59
+ }),
60
+ metaLemmaOrMetaTheoremUnified = substitutionsUnified; ///
60
61
 
61
- return matchesMetaLemmaOrMetaTheorem;
62
+ return metaLemmaOrMetaTheoremUnified;
62
63
  }
63
64
 
64
65
  static fromDeclarations(declarations) {
package/src/judgement.js CHANGED
@@ -27,7 +27,7 @@ export default class Judgement {
27
27
  return matchesMetavariableNode;
28
28
  }
29
29
 
30
- matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem) { return this.frame.matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem); }
30
+ unifyMetaLemmaOrmetatheorem(metaLemmaMetatheorem) { return this.frame.unifyMetaLemmaOrmetatheorem(metaLemmaMetatheorem); }
31
31
 
32
32
  static fromJudgementNodeFrameAndMetavariableNode(judgementNode, frame, metavariableNode) {
33
33
  const node = judgementNode,
@@ -65,9 +65,9 @@ export default class Metavariable {
65
65
  } else if ((termNode === null) && (this.termType === null)) {
66
66
  matchesNode = true;
67
67
  } else if ((termNode !== null) && (this.termType !== null)) {
68
- const termVerifiedAgainstTermType = verifyTermAgainstTermType(termNode, this.termType, localContext);
68
+ const termUnifiedAgainstTermType = unifyTermAgainstTermType(termNode, this.termType, localContext);
69
69
 
70
- matchesNode = termVerifiedAgainstTermType; ///
70
+ matchesNode = termUnifiedAgainstTermType; ///
71
71
  }
72
72
  }
73
73
  }
@@ -128,28 +128,29 @@ export default class Metavariable {
128
128
  }
129
129
  }
130
130
 
131
- export function verifyTermAgainstTermType(termNode, termType, localContext) {
132
- let termVerifiedAgainstTermType;
131
+ export function unifyTermAgainstTermType(termNode, termType, localContext) {
132
+ let termUnifiedAgainstTermType;
133
133
 
134
134
  const type = termType, ///
135
- terms = [];
135
+ terms = [],
136
+ termVerified = verifyTerm(termNode, terms, localContext, () => {
137
+ let verifiedAhead = false;
136
138
 
137
- termVerifiedAgainstTermType = verifyTerm(termNode, terms, localContext, () => {
138
- let verifiedAhead = false;
139
+ const firstTerm = first(terms),
140
+ term = firstTerm, ///
141
+ termType = term.getType(),
142
+ termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
139
143
 
140
- const firstTerm = first(terms),
141
- term = firstTerm, ///
142
- termType = term.getType(),
143
- termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
144
+ if (termTypeEqualToOrSubTypeOfType) {
145
+ verifiedAhead = true;
146
+ }
144
147
 
145
- if (termTypeEqualToOrSubTypeOfType) {
146
- verifiedAhead = true;
147
- }
148
+ return verifiedAhead;
149
+ });
148
150
 
149
- return verifiedAhead;
150
- });
151
+ termUnifiedAgainstTermType = termVerified; ///
151
152
 
152
- return termVerifiedAgainstTermType;
153
+ return termUnifiedAgainstTermType;
153
154
  }
154
155
 
155
156
  function termTypeFromMetavariableNode(metavariableNode, fileContext) {
@@ -42,7 +42,7 @@ export default function initialiseReleaseContext(dependency, dependentName, depe
42
42
  if (releaseContextInitialised) {
43
43
  const releaseContexts = retrieveReleaseContexts(releaseContext, releaseContextMap);
44
44
 
45
- releaseContext.initialise(releaseContexts);
45
+ releaseContext.verify(releaseContexts);
46
46
  }
47
47
  }
48
48
  }
@@ -38,14 +38,14 @@ export default class StatementForMetavariableSubstitution extends Substitution {
38
38
  return node;
39
39
  }
40
40
 
41
- matchStatementNode(statementNode, substitutions, localContextA, localContextB) {
41
+ unifyStatement(statementNode, substitutions, localContextA, localContextB) {
42
42
  let statementNodeMatches;
43
43
 
44
44
  const substitution = this.substitution, ///
45
45
  statementNodeA = statementNode, ///
46
46
  statementNodeB = this.statementNode; ///
47
47
 
48
- statementNodeMatches = matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
48
+ statementNodeMatches = unifyStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
49
49
 
50
50
  if (!statementNodeMatches) {
51
51
  const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
@@ -53,7 +53,7 @@ export default class StatementForMetavariableSubstitution extends Substitution {
53
53
  if (bracketedStatementChildNode !== null) {
54
54
  const statementNodeA = bracketedStatementChildNode; ///
55
55
 
56
- statementNodeMatches = matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
56
+ statementNodeMatches = unifyStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
57
57
  }
58
58
  }
59
59
 
@@ -153,19 +153,18 @@ export default class StatementForMetavariableSubstitution extends Substitution {
153
153
  }
154
154
  }
155
155
 
156
- function matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
157
- let statementNodeMatches;
156
+ function unifyStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
157
+ let statementUnified;
158
158
 
159
159
  if (substitution === null) {
160
160
  const statementNodeAMatchesStatementNodeB = statementNodeB.match(statementNodeA);
161
161
 
162
- statementNodeMatches = statementNodeAMatchesStatementNodeB; ///
162
+ statementUnified = statementNodeAMatchesStatementNodeB; ///
163
163
  } else {
164
- const statementVerifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
164
+ const statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
165
165
 
166
- statementNodeMatches = statementVerifiedAgainstStatement; ///
166
+ statementUnified = statementUnifiedAgainstStatement; ///
167
167
  }
168
168
 
169
- return statementNodeMatches;
170
-
169
+ return statementUnified;
171
170
  }
@@ -25,14 +25,14 @@ class EqualityUnifier extends Unifier {
25
25
  nodeQueryA: termNodeQuery,
26
26
  nodeQueryB: termNodeQuery,
27
27
  unify: (termNodeA, termNodeB, localContext) => {
28
- let termVerifiedAgainstTerm;
28
+ let termUnifiedAgainstTerm;
29
29
 
30
30
  const leftTermNode = termNodeA, ///
31
31
  rightTermNode = termNodeB; ///
32
32
 
33
- termVerifiedAgainstTerm = unifyTermAgainstTerm(leftTermNode, rightTermNode, localContext);
33
+ termUnifiedAgainstTerm = unifyTermAgainstTerm(leftTermNode, rightTermNode, localContext);
34
34
 
35
- if (!termVerifiedAgainstTerm) {
35
+ if (!termUnifiedAgainstTerm) {
36
36
  const nonTerminalNodeA = termNodeA, ///
37
37
  nonTerminalNodeB = termNodeB, ///
38
38
  nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
@@ -41,10 +41,10 @@ class EqualityUnifier extends Unifier {
41
41
  childNodesB = nonTerminalNodeBChildNodes, ///
42
42
  childNodesVerified = equalityUnifier.unifyChildNodes(childNodesA, childNodesB, localContext);
43
43
 
44
- termVerifiedAgainstTerm = childNodesVerified; ///
44
+ termUnifiedAgainstTerm = childNodesVerified; ///
45
45
  }
46
46
 
47
- return termVerifiedAgainstTerm;
47
+ return termUnifiedAgainstTerm;
48
48
  }
49
49
  }
50
50
  ];
@@ -31,7 +31,7 @@ class MetaLevelUnifier extends Unifier {
31
31
  nodeQueryA: statementNodeQuery,
32
32
  nodeQueryB: statementNodeQuery,
33
33
  unify: (statementNodeA, statementNodeB, substitutions, localContextA, localContextB) => {
34
- let statementVerifiedAgainstStatement;
34
+ let statementUnifiedAgainstStatement;
35
35
 
36
36
  const metavariableNodeA = metavariableNodeQuery(statementNodeA);
37
37
 
@@ -39,7 +39,7 @@ class MetaLevelUnifier extends Unifier {
39
39
  const substitutionNodeA = substitutionNodeQuery(statementNodeA),
40
40
  metavariableUnifiedAgainstStatement = unifyMetavariableAgainstStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB);
41
41
 
42
- statementVerifiedAgainstStatement = metavariableUnifiedAgainstStatement; ///
42
+ statementUnifiedAgainstStatement = metavariableUnifiedAgainstStatement; ///
43
43
  } else {
44
44
  const nonTerminalNodeA = statementNodeA, ///
45
45
  nonTerminalNodeB = statementNodeB, ///
@@ -49,10 +49,10 @@ class MetaLevelUnifier extends Unifier {
49
49
  childNodesB = nonTerminalNodeBChildNodes, ///
50
50
  childNodesVerified = metaLevelUnifier.unifyChildNodes(childNodesA, childNodesB, substitutions, localContextA, localContextB);
51
51
 
52
- statementVerifiedAgainstStatement = childNodesVerified; ///
52
+ statementUnifiedAgainstStatement = childNodesVerified; ///
53
53
  }
54
54
 
55
- return statementVerifiedAgainstStatement;
55
+ return statementUnifiedAgainstStatement;
56
56
  }
57
57
  },
58
58
  {
@@ -9,7 +9,7 @@ const metavariableNodeQuery = nodeQuery("/statement/metavariable"),
9
9
  metaTypeTerminalNodeQuery = nodeQuery("/metaType/@meta-type!");
10
10
 
11
11
  export default function unifyStatementAgainstMetaType(statementNode, metaTypeNode, localContext) {
12
- let statementVerifiedAgainstMetaType = false;
12
+ let statementUnifiedAgainstMetaType = false;
13
13
 
14
14
  const metaTypeTerminalNode = metaTypeTerminalNodeQuery(metaTypeNode),
15
15
  metaTypeTerminalNodeContent = metaTypeTerminalNode.getContent(),
@@ -26,7 +26,7 @@ export default function unifyStatementAgainstMetaType(statementNode, metaTypeNod
26
26
  const metavariableMetaTypeName = metavariable.getMetaTypeName();
27
27
 
28
28
  if (metavariableMetaTypeName === metaTypeName) {
29
- statementVerifiedAgainstMetaType = true;
29
+ statementUnifiedAgainstMetaType = true;
30
30
  }
31
31
  }
32
32
  }
@@ -40,11 +40,11 @@ export default function unifyStatementAgainstMetaType(statementNode, metaTypeNod
40
40
  assignments = [],
41
41
  statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
42
42
 
43
- statementVerifiedAgainstMetaType = statementVerified;
43
+ statementUnifiedAgainstMetaType = statementVerified;
44
44
 
45
45
  break;
46
46
  }
47
47
  }
48
48
 
49
- return statementVerifiedAgainstMetaType;
49
+ return statementUnifiedAgainstMetaType;
50
50
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- export const { first, second, last, extract, push, match, prune, filter, compress, separate } = arrayUtilities;
5
+ export const { first, second, last, extract, tail, push, match, prune, filter, compress, separate } = arrayUtilities;
6
6
 
7
7
  export function reverse(array) {
8
8
  array = [ ///
@@ -15,7 +15,9 @@ export default function verifyVariableDeclaration(variableDeclarationNode, fileC
15
15
 
16
16
  const typeNode = typeNodeQuery(variableDeclarationNode),
17
17
  variableNode = variableNodeQuery(variableDeclarationNode),
18
- typeString = fileContext.nodeAsString(typeNode),
18
+ typeString = (typeNode === null) ?
19
+ EMPTY_STRING :
20
+ fileContext.nodeAsString(typeNode),
19
21
  variableString = fileContext.nodeAsString(variableNode);
20
22
 
21
23
  (typeString === EMPTY_STRING) ?
@@ -70,10 +70,10 @@ function verifyDerivedJudgement(judgementNode, assignments, derived, localContex
70
70
  metaLemmaMetatheorem = (metaLemma || metatheorem); ///
71
71
 
72
72
  if (metaLemmaMetatheorem !== null) {
73
- const declarationMatchesMetaLemmaMetatheorem = declaration.matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem),
74
- judgementMatchesMetaLemmaMetatheorem = judgement.matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem);
73
+ const metaLemmaMetatheoremUnifiedAgainstDeclaration = declaration.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem),
74
+ metaLemmaMetatheoremUnifiedAgainstJudgement = judgement.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem);
75
75
 
76
- derivedJudgementVerified = (declarationMatchesMetaLemmaMetatheorem && judgementMatchesMetaLemmaMetatheorem);
76
+ derivedJudgementVerified = (metaLemmaMetatheoremUnifiedAgainstDeclaration && metaLemmaMetatheoremUnifiedAgainstJudgement);
77
77
  } else {
78
78
  const metavariableString = localContext.nodeAsString(metavariableNode);
79
79
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { nodeQuery } from "../utilities/query";
4
4
  import { nameFromMetavariableNode } from "../utilities/name";
5
- import { verifyTermAgainstTermType } from "../metavariable";
5
+ import { unifyTermAgainstTermType } from "../metavariable";
6
6
 
7
7
  const termNodeQuery = nodeQuery("/metavariable/argument/term"),
8
8
  typeNodeQuery = nodeQuery("/metavariable/argument/type");
@@ -43,9 +43,9 @@ export default function verifyMetavariable(metavariableNode, localContext) {
43
43
 
44
44
  localContext.debug(`No term was found when the metavariable's term type is '${termTypeName}'.`, termNode);
45
45
  } else {
46
- const termVerifiedAgainstTermType = verifyTermAgainstTermType(termNode, termType, localContext);
46
+ const termUnifiedAgainstTermType = unifyTermAgainstTermType(termNode, termType, localContext);
47
47
 
48
- metavariableVerified = termVerifiedAgainstTermType; ///
48
+ metavariableVerified = termUnifiedAgainstTermType; ///
49
49
  }
50
50
  }
51
51
  }
@@ -194,13 +194,13 @@ function unifyQualifiedStatementAAgainstReference(qualifiedStatementNode, substi
194
194
  statementNodeB = statementNode, ///
195
195
  substitutionNodeA = null,
196
196
  metavariableNodeA = metavariableNode, ///
197
- metavariableVerifiedAgainstStatement = unifyMetavariableAgainstStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB, () => {
197
+ metavariableUnifiedAgainstStatement = unifyMetavariableAgainstStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB, () => {
198
198
  const verifiedAhead = true;
199
199
 
200
200
  return verifiedAhead;
201
201
  });
202
202
 
203
- qualifiedStatementUnifiedAgainstReference = metavariableVerifiedAgainstStatement; ///
203
+ qualifiedStatementUnifiedAgainstReference = metavariableUnifiedAgainstStatement; ///
204
204
  }
205
205
 
206
206
  if (qualifiedStatementUnifiedAgainstReference) {