occam-verify-cli 0.0.1035 → 0.0.1037

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 (47) hide show
  1. package/lib/assertion/subproof.js +73 -49
  2. package/lib/assertion/type.js +5 -5
  3. package/lib/context/file.js +6 -20
  4. package/lib/context/release.js +24 -84
  5. package/lib/equality.js +5 -5
  6. package/lib/metavariable.js +51 -6
  7. package/lib/mixins/statement/verify.js +3 -3
  8. package/lib/premise.js +23 -32
  9. package/lib/substitution/statementForMetavariable.js +12 -4
  10. package/lib/substitution/termForVariable.js +2 -2
  11. package/lib/supposition.js +48 -57
  12. package/lib/unifier/metaLevel.js +3 -4
  13. package/lib/unifier/statementWithCombinator.js +1 -2
  14. package/lib/variable.js +13 -6
  15. package/lib/verify/assertion/subproof.js +1 -49
  16. package/package.json +1 -1
  17. package/src/assertion/subproof.js +95 -56
  18. package/src/assertion/type.js +4 -4
  19. package/src/context/file.js +2 -48
  20. package/src/context/release.js +27 -65
  21. package/src/equality.js +4 -4
  22. package/src/metavariable.js +69 -6
  23. package/src/mixins/statement/verify.js +3 -2
  24. package/src/premise.js +32 -46
  25. package/src/substitution/statementForMetavariable.js +20 -3
  26. package/src/substitution/termForVariable.js +1 -1
  27. package/src/supposition.js +64 -78
  28. package/src/unifier/metaLevel.js +11 -5
  29. package/src/unifier/statementWithCombinator.js +0 -1
  30. package/src/variable.js +12 -5
  31. package/src/verify/assertion/subproof.js +0 -63
  32. package/lib/unify/conclusionWithStatement.js +0 -34
  33. package/lib/unify/consequentWithStatement.js +0 -34
  34. package/lib/unify/metavariableWithStatement.js +0 -40
  35. package/lib/unify/suppositionWithProffStep.js +0 -41
  36. package/lib/unify/suppositionsWithProofSteps.js +0 -31
  37. package/lib/unify/unqualifiedStatement.js +0 -25
  38. package/lib/verify/file.js +0 -35
  39. package/lib/verify/subDerivation.js +0 -31
  40. package/src/unify/conclusionWithStatement.js +0 -34
  41. package/src/unify/consequentWithStatement.js +0 -34
  42. package/src/unify/metavariableWithStatement.js +0 -40
  43. package/src/unify/suppositionWithProffStep.js +0 -54
  44. package/src/unify/suppositionsWithProofSteps.js +0 -23
  45. package/src/unify/unqualifiedStatement.js +0 -24
  46. package/src/verify/file.js +0 -29
  47. package/src/verify/subDerivation.js +0 -24
@@ -2,12 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return verifySubproofAssertion;
9
- }
10
- });
11
5
  var _metaLevel = /*#__PURE__*/ _interop_require_default(require("../../verifier/metaLevel"));
12
6
  function _interop_require_default(obj) {
13
7
  return obj && obj.__esModule ? obj : {
@@ -18,47 +12,5 @@ var verifySubproofAssertionFunctions = [
18
12
  verifyDerivedSubproofAssertion,
19
13
  verifyStatedSubproofAssertion
20
14
  ];
21
- function verifySubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
22
- var subproofAssertionVerified = false;
23
- var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
24
- assignments = null; ///
25
- stated = true; ///
26
- localContext.trace("Verifying the '".concat(subproofAssertionString, "' subproof assertion..."), subproofAssertionNode);
27
- var verified = _metaLevel.default.verify(subproofAssertionNode, assignments, stated, localContext);
28
- if (verified) {
29
- subproofAssertionVerified = verifySubproofAssertionFunctions.some(function(verifySubproofAssertionFunction) {
30
- var subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments, stated, localContext);
31
- if (subproofAssertionVerified) {
32
- return true;
33
- }
34
- });
35
- }
36
- if (subproofAssertionVerified) {
37
- localContext.debug("...verified the '".concat(subproofAssertionString, "' subproof assertion."), subproofAssertionNode);
38
- }
39
- return subproofAssertionVerified;
40
- }
41
- function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
42
- var derivedSubproofAssertionVerified;
43
- if (!stated) {
44
- var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
45
- localContext.trace("Verifying the '".concat(subproofAssertionString, "' derived subproof assertion..."), subproofAssertionNode);
46
- derivedSubproofAssertionVerified = false;
47
- localContext.debug("The '".concat(subproofAssertionString, "' derived subproof assertion cannot be verified."), subproofAssertionNode);
48
- }
49
- return derivedSubproofAssertionVerified;
50
- }
51
- function verifyStatedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
52
- var statedSubproofAssertionVerified;
53
- if (stated) {
54
- var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
55
- localContext.trace("Verifying the '".concat(subproofAssertionString, "' stated subproof assertion..."), subproofAssertionNode);
56
- statedSubproofAssertionVerified = true;
57
- if (statedSubproofAssertionVerified) {
58
- localContext.debug("...verified the '".concat(subproofAssertionString, "' stated subproof assertion."), subproofAssertionNode);
59
- }
60
- }
61
- return statedSubproofAssertionVerified;
62
- }
63
15
 
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy92ZXJpZnkvYXNzZXJ0aW9uL3N1YnByb29mLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgbWV0YUxldmVsVmVyaWZpZXIgZnJvbSBcIi4uLy4uL3ZlcmlmaWVyL21ldGFMZXZlbFwiO1xuXG5jb25zdCB2ZXJpZnlTdWJwcm9vZkFzc2VydGlvbkZ1bmN0aW9ucyA9IFtcbiAgdmVyaWZ5RGVyaXZlZFN1YnByb29mQXNzZXJ0aW9uLFxuICB2ZXJpZnlTdGF0ZWRTdWJwcm9vZkFzc2VydGlvblxuXTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdmVyaWZ5U3VicHJvb2ZBc3NlcnRpb24oc3VicHJvb2ZBc3NlcnRpb25Ob2RlLCBhc3NpZ25tZW50cywgc3RhdGVkLCBsb2NhbENvbnRleHQpIHtcbiAgbGV0IHN1YnByb29mQXNzZXJ0aW9uVmVyaWZp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ldGFMZXZlbFwiO1xuXG5jb25zdCB2ZXJpZnlTdWJwcm9vZkFzc2VydGlvbkZ1bmN0aW9ucyA9IFtcbiAgdmVyaWZ5RGVyaXZlZFN1YnByb29mQXNzZXJ0aW9uLFxuICB2ZXJpZnlTdGF0ZWRTdWJwcm9vZkFzc2VydGlvblxuXTtcblxuIl0sIm5hbWVzIjpbInZlcmlmeVN1YnByb29mQXNzZXJ0aW9uRnVuY3Rpb25zIiwidmVyaWZ5RGVyaXZlZFN1YnByb29mQXNzZXJ0aW9uIiwidmVyaWZ5U3RhdGVkU3VicHJvb2ZBc3NlcnRpb24iXSwibWFwcGluZ3MiOiJBQUFBOzs7O2dFQUU4Qjs7Ozs7O0FBRTlCLElBQU1BLG1DQUFtQztJQUN2Q0M7SUFDQUM7Q0FDRCJ9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-verify-cli",
3
3
  "author": "James Smith",
4
- "version": "0.0.1035",
4
+ "version": "0.0.1037",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
@@ -3,25 +3,20 @@
3
3
  import shim from "../shim";
4
4
  import LocalContext from "../context/local";
5
5
  import metaLevelUnifier from "../unifier/metaLevel";
6
+ import metaLevelVerifier from "../verifier/metaLevel";
6
7
 
7
8
  import { front, last, match } from "../utilities/array";
8
9
  import { nodeQuery, nodesQuery } from "../utilities/query";
9
10
 
10
- const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement"),
11
- statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
11
+ const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
12
12
  subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
13
13
 
14
14
  export default class SubproofAssertion {
15
- constructor(fileContext, string, statements) {
16
- this.fileContext = fileContext;
15
+ constructor(string, statements) {
17
16
  this.string = string;
18
17
  this.statements = statements;
19
18
  }
20
19
 
21
- getFileContext() {
22
- return this.fileContext;
23
- }
24
-
25
20
  getString() {
26
21
  return this.string;
27
22
  }
@@ -30,7 +25,70 @@ export default class SubproofAssertion {
30
25
  return this.statements;
31
26
  }
32
27
 
33
- unifySubproof(subproof, substitutions, localContext) {
28
+ verify(assignments, stated, localContext) {
29
+ let verified;
30
+
31
+ const subproofAssertionString = this.string; ///
32
+
33
+ localContext.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`);
34
+
35
+ let verifiedWhenStated = false,
36
+ verifiedWhenDerived = false;
37
+
38
+ if (stated) {
39
+ verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
40
+ } else {
41
+ verifiedWhenDerived = this.verifyWhenDerived(localContext);
42
+ }
43
+
44
+ if (verifiedWhenStated || verifiedWhenDerived) {
45
+ assignments = null; ///
46
+
47
+ stated = true; ///
48
+
49
+ const subproofAssertionNode = this.node; ///
50
+
51
+ verified = metaLevelVerifier.verify(subproofAssertionNode, assignments, stated, localContext);
52
+ }
53
+
54
+ if (verified) {
55
+ localContext.debug(`...verified the '${subproofAssertionString}' subproof assertion.`);
56
+ }
57
+
58
+ return verified;
59
+ }
60
+
61
+ verifyWhenStated(localContext) {
62
+ let verifiedWhenStated;
63
+
64
+ const subproofAssertionString = this.string; ///
65
+
66
+ localContext.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`);
67
+
68
+ verifiedWhenStated = true;
69
+
70
+ if (verifiedWhenStated) {
71
+ localContext.debug(`...verified the '${subproofAssertionString}' stated subproof assertion.`);
72
+ }
73
+
74
+ return verifiedWhenStated;
75
+ }
76
+
77
+ verifyWhenDerived(localContext) {
78
+ let derivedSubproofAssertionVerified;
79
+
80
+ const subproofAssertionString = this.string; ///
81
+
82
+ localContext.trace(`Verifying the '${subproofAssertionString}' derived subproof assertion...`);
83
+
84
+ derivedSubproofAssertionVerified = false;
85
+
86
+ localContext.debug(`The '${subproofAssertionString}' derived subproof assertion cannot be verified.`);
87
+
88
+ return derivedSubproofAssertionVerified;
89
+ }
90
+
91
+ unifySubproof(subproof, substitutions, fileContext, localContext) {
34
92
  let subproofUnified;
35
93
 
36
94
  const subproofString = subproof.getString(),
@@ -44,7 +102,7 @@ export default class SubproofAssertion {
44
102
  subproofStatementNode = subproofStatement.getNode(),
45
103
  nodeA = statementNode, ///
46
104
  nodeB = subproofStatementNode, ///
47
- fileContextA = this.fileContext, ///
105
+ fileContextA = fileContext, ///
48
106
  localContextA = LocalContext.fromFileContext(fileContextA),
49
107
  localContextB = localContext, ///
50
108
  unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
@@ -61,59 +119,40 @@ export default class SubproofAssertion {
61
119
  return subproofUnified;
62
120
  }
63
121
 
64
- toJSON() {
65
- const statementStings = this.statements.map((statement) => {
66
- const statementString = statement.getString();
67
-
68
- return statementString;
69
- }),
70
- statements = statementStings, ///
71
- json = {
72
- statements
73
- };
74
-
75
- return json;
76
- }
77
-
78
- static fromJSON(json, fileContext) {
79
- let { statements } = json;
122
+ static fromStatement(statement, fileContext) {
123
+ let subproofAssertion = null;
80
124
 
81
- const statementsJSON = statements; ///
125
+ const statementNode = statement.getNode(),
126
+ subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
82
127
 
83
- statements = statementsJSON.map((statementJSON) => {
84
- const json = statementJSON,
85
- statement = Statement.fromJSON(json, fileContext);
128
+ if (subproofAssertionNode !== null) {
129
+ const { Statement } = shim,
130
+ statementNodes = statementNodesQuery(subproofAssertionNode),
131
+ statementString = statement.getString(),
132
+ localContext = LocalContext.fromFileContext(fileContext),
133
+ statements = statementNodes.map((statementNode) => {
134
+ const statement = Statement.fromStatementNode(statementNode, localContext);
86
135
 
87
- return statement;
88
- });
136
+ return statement;
137
+ }),
138
+ string = statementString; ///
89
139
 
90
- const string = stringFromStatements(statements),
91
- subproofAssertion = new SubproofAssertion(fileContext, string, statements);
140
+ subproofAssertion = new SubproofAssertion(string, statements);
141
+ }
92
142
 
93
143
  return subproofAssertion;
94
144
  }
95
145
 
96
- static fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext) {
97
- let subproofAssertion = null;
98
-
99
- if (unqualifiedStatementNode !== null) {
100
- const statementNode = statementNodeQuery(unqualifiedStatementNode),
101
- subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
146
+ static fromSubproofAssertionNode(subproofAssertionNode, localContext) {
147
+ const { Statement } = shim,
148
+ statementNodes = statementNodesQuery(subproofAssertionNode),
149
+ statements = statementNodes.map((statementNode) => {
150
+ const statement = Statement.fromStatementNode(statementNode, localContext);
102
151
 
103
- if (subproofAssertionNode !== null) {
104
- const { Statement } = shim,
105
- localContext = LocalContext.fromFileContext(fileContext),
106
- statementNodes = statementNodesQuery(subproofAssertionNode),
107
- statements = statementNodes.map((statementNode) => {
108
- const statement = Statement.fromStatementNode(statementNode, localContext);
109
-
110
- return statement;
111
- }),
112
- string = stringFromStatements(statements);
113
-
114
- subproofAssertion = new SubproofAssertion(fileContext, string, statements);
115
- }
116
- }
152
+ return statement;
153
+ }),
154
+ string = stringFromStatements(statements),
155
+ subproofAssertion = new SubproofAssertion(string, statements);
117
156
 
118
157
  return subproofAssertion;
119
158
  }
@@ -122,14 +161,14 @@ export default class SubproofAssertion {
122
161
  function stringFromStatements(statements) {
123
162
  const frontStatements = front(statements),
124
163
  lastStatement = last(statements),
125
- frontStatementsString = statementsStringtatements(frontStatements),
164
+ frontStatementsString = statementsStringFromStatements(frontStatements),
126
165
  lastStatementString = lastStatement.getString(),
127
166
  string = `[${frontStatementsString}] ... ${lastStatementString}`;
128
167
 
129
168
  return string;
130
169
  }
131
170
 
132
- function statementsStringtatements(statements) {
171
+ function statementsStringFromStatements(statements) {
133
172
  const statementsString = statements.reduce((statementsString, statement) => {
134
173
  const statementString = statement.getString();
135
174
 
@@ -84,7 +84,7 @@ export default class TypeAssertion {
84
84
 
85
85
  const typeAssertionString = this.string; ///
86
86
 
87
- localContext.trace(`Verifying the stated '${typeAssertionString}' type assertion...`);
87
+ localContext.trace(`Verifying the '${typeAssertionString}' stated type assertion...`);
88
88
 
89
89
  const typeVerified = this.verifyType(localContext);
90
90
 
@@ -115,7 +115,7 @@ export default class TypeAssertion {
115
115
  }
116
116
 
117
117
  if (verifiedWhenStated) {
118
- localContext.debug(`...verified the stated '${typeAssertionString}' type assertion.`);
118
+ localContext.debug(`...verified the '${typeAssertionString}' stated type assertion.`);
119
119
  }
120
120
 
121
121
  return verifiedWhenStated;
@@ -126,7 +126,7 @@ export default class TypeAssertion {
126
126
 
127
127
  const typeAssertionString = this.string; ///
128
128
 
129
- localContext.trace(`Verifying the derived '${typeAssertionString}' type assertion...`);
129
+ localContext.trace(`Verifying the '${typeAssertionString}' derived type assertion...`);
130
130
 
131
131
  const typeVerified = this.verifyType(localContext);
132
132
 
@@ -146,7 +146,7 @@ export default class TypeAssertion {
146
146
  }
147
147
 
148
148
  if (verifiedWhenDerived) {
149
- localContext.debug(`...verified the derived '${typeAssertionString}' type assertion.`);
149
+ localContext.debug(`...verified the '${typeAssertionString}' derived type assertion.`);
150
150
  }
151
151
 
152
152
  return verifiedWhenDerived;
@@ -54,7 +54,7 @@ export default class FileContext {
54
54
  return this.node;
55
55
  }
56
56
 
57
- getFile(filePath) { return this.releaseContext.getFile(filePath); }
57
+ findFile(filePath) { return this.releaseContext.findFile(filePath); }
58
58
 
59
59
  getLexer() { return this.releaseContext.getLexer(); }
60
60
 
@@ -877,28 +877,7 @@ export default class FileContext {
877
877
  });
878
878
  }
879
879
 
880
- static fromJSONAndReleaseContext(json, releaseContext) {
881
- const { filePath } = json,
882
- tokens = null,
883
- node = null,
884
- types = [],
885
- rules = [],
886
- axioms = [],
887
- lemmas = [],
888
- theorems = [],
889
- variables = [],
890
- metaLemmas = [],
891
- conjectures = [],
892
- combinators = [],
893
- constructors = [],
894
- metatheorems = [],
895
- metavariables = [],
896
- fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, metaLemmas, theorems, conjectures, combinators, constructors, metatheorems, metavariables);
897
-
898
- return fileContext;
899
- }
900
-
901
- static fromFileAndReleaseContext(file, releaseContext) {
880
+ static fromFile(file, releaseContext) {
902
881
  const lexer = releaseContext.getLexer(),
903
882
  parser = releaseContext.getParser(),
904
883
  filePath = file.getPath(),
@@ -922,29 +901,4 @@ export default class FileContext {
922
901
 
923
902
  return fileContext;
924
903
  }
925
-
926
- static fromFilePathAndReleaseContext(filePath, releaseContext) {
927
- const file = releaseContext.getFile(filePath),
928
- lexer = releaseContext.getLexer(),
929
- parser = releaseContext.getParser(),
930
- fileContent = file.getContent(),
931
- content = fileContent, ////
932
- tokens = lexer.tokenise(content),
933
- node = parser.parse(tokens),
934
- types = [],
935
- rules = [],
936
- axioms = [],
937
- lemmas = [],
938
- theorems = [],
939
- variables = [],
940
- metaLemmas = [],
941
- conjectures = [],
942
- combinators = [],
943
- constructors = [],
944
- metatheorems = [],
945
- metavariables = [],
946
- fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, metaLemmas, theorems, conjectures, combinators, constructors, metatheorems, metavariables);
947
-
948
- return fileContext;
949
- }
950
904
  }
@@ -15,7 +15,7 @@ const { isFilePathNominalFilePath } = filePathUtilities,
15
15
  { nominalParserFromCombinedCustomGrammar } = parsersUtilities;
16
16
 
17
17
  export default class ReleaseContext {
18
- constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, verifiedFileContexts, dependencyReleaseContexts) {
18
+ constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts) {
19
19
  this.log = log;
20
20
  this.name = name;
21
21
  this.json = json;
@@ -26,7 +26,6 @@ export default class ReleaseContext {
26
26
  this.initialised = initialised;
27
27
  this.fileContexts = fileContexts;
28
28
  this.customGrammar = customGrammar;
29
- this.verifiedFileContexts = verifiedFileContexts;
30
29
  this.dependencyReleaseContexts = dependencyReleaseContexts;
31
30
  }
32
31
 
@@ -70,52 +69,20 @@ export default class ReleaseContext {
70
69
  return this.customGrammar;
71
70
  }
72
71
 
73
- getVerifiedFileContexts() {
74
- return this.verifiedFileContexts;
75
- }
76
-
77
72
  getDependencyReleaseContexts() {
78
73
  return this.dependencyReleaseContexts;
79
74
  }
80
75
 
81
- setLog(log) {
82
- this.log = log;
83
- }
84
-
85
- setName(name) {
86
- this.name = name;
87
- }
88
-
89
- setEntries(entries) {
90
- this.entries = entries;
91
- }
92
-
93
- setLexer(lexer) {
94
- this.lexer = lexer;
95
- }
96
-
97
- setParser(parser) {
98
- this.parser = parser;
99
- }
100
-
101
- setVerified(verified) {
102
- this.verified = verified;
103
- }
104
-
105
- setInitialised(initialised) {
106
- return this.initialised = initialised;
107
- }
76
+ isReleased() {
77
+ const released = (this.json !== null);
108
78
 
109
- setFileContexts(fileContexts) {
110
- this.fileContexts = fileContexts;
79
+ return released;
111
80
  }
112
81
 
113
- setCustomGrammar(customGrammar) {
114
- this.customGrammar = customGrammar;
115
- }
82
+ findFile(filePath) {
83
+ const file = this.entries.getFile(filePath);
116
84
 
117
- setDependencyReleaseContexts(dependencyReleaseContexts) {
118
- this.dependencyReleaseContexts = dependencyReleaseContexts;
85
+ return file;
119
86
  }
120
87
 
121
88
  findFileContext(filePath) {
@@ -130,12 +97,6 @@ export default class ReleaseContext {
130
97
  return fileContext;
131
98
  }
132
99
 
133
- isReleased() {
134
- const released = (this.json !== null);
135
-
136
- return released;
137
- }
138
-
139
100
  getLabels(includeDependencies = true) {
140
101
  const labels = [];
141
102
 
@@ -438,9 +399,11 @@ export default class ReleaseContext {
438
399
 
439
400
  this.parser = nominalParser; ///
440
401
 
402
+ clear(this.fileContexts);
403
+
441
404
  released ?
442
- fileContextsFromJSONAndReleaseContext(this.json, this.fileContexts, releaseContext) :
443
- fileContextsFromEntriesAndReleaseContext(this.entries, this.fileContexts, releaseContext);
405
+ fileContextsFromJSONAndEntries(this.json, this.entries, this.fileContexts, releaseContext) :
406
+ fileContextsFromEntries(this.entries, this.fileContexts, releaseContext);
444
407
 
445
408
  this.initialised = true;
446
409
  }
@@ -448,11 +411,12 @@ export default class ReleaseContext {
448
411
  verify() {
449
412
  let verified = false;
450
413
 
451
- clear(this.verifiedFileContexts);
452
-
453
- const fileContextsVerified = verifyFileContexts(this.fileContexts, this.verifiedFileContexts);
414
+ const verifiedFileContexts = [],
415
+ fileContextsVerified = verifyFileContexts(this.fileContexts, verifiedFileContexts);
454
416
 
455
417
  if (fileContextsVerified) {
418
+ this.fileContexts = verifiedFileContexts; ///
419
+
456
420
  this.verified = true;
457
421
 
458
422
  verified = true;
@@ -462,12 +426,12 @@ export default class ReleaseContext {
462
426
  }
463
427
 
464
428
  toJSON() {
465
- const verifiedFileContextsJSON = this.verifiedFileContexts.map((verifiedFileContext) => {
466
- const verifiedFileContextJSON = verifiedFileContext.toJSON();
429
+ const fileContextsJSON = this.fileContexts.map((fileContext) => {
430
+ const fileContextJSON = fileContext.toJSON();
467
431
 
468
- return verifiedFileContextJSON;
432
+ return fileContextJSON;
469
433
  }),
470
- json = verifiedFileContextsJSON; ///
434
+ json = fileContextsJSON; ///
471
435
 
472
436
  return json;
473
437
  }
@@ -479,20 +443,20 @@ export default class ReleaseContext {
479
443
  initialised = false,
480
444
  fileContexts = [],
481
445
  customGrammar = customGrammarFromNameAndEntries(name, entries),
482
- verifiedFileContexts = [],
483
446
  dependencyReleaseContexts = null,
484
- releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, verifiedFileContexts, dependencyReleaseContexts);
447
+ releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts);
485
448
 
486
449
  return releaseContext;
487
450
  }
488
451
  }
489
452
 
490
- function fileContextsFromJSONAndReleaseContext(json, fileContexts, releaseContext) {
453
+ function fileContextsFromJSONAndEntries(json, entries, fileContexts, releaseContext) {
491
454
  const fileContextsJSON = json; ///
492
455
 
493
456
  fileContextsJSON.forEach((fileContextJSON) => {
494
- const json = fileContextJSON,
495
- fileContext = FileContext.fromJSONAndReleaseContext(json, releaseContext);
457
+ const { filePath } = fileContextJSON,
458
+ file = entries.getFile(filePath),
459
+ fileContext = FileContext.fromFile(file, releaseContext);
496
460
 
497
461
  fileContext.initialise(fileContextJSON);
498
462
 
@@ -500,19 +464,17 @@ function fileContextsFromJSONAndReleaseContext(json, fileContexts, releaseContex
500
464
  });
501
465
  }
502
466
 
503
- function fileContextsFromEntriesAndReleaseContext(entries, fileContexts, releaseContext) {
467
+ function fileContextsFromEntries(entries, fileContexts, releaseContext) {
504
468
  entries.forEachFile((file) => {
505
469
  const filePath = file.getPath(),
506
470
  filePathNominalFilePath = isFilePathNominalFilePath(filePath);
507
471
 
508
472
  if (filePathNominalFilePath) {
509
- const fileContext = FileContext.fromFileAndReleaseContext(file, releaseContext);
473
+ const fileContext = FileContext.fromFile(file, releaseContext);
510
474
 
511
475
  fileContexts.push(fileContext);
512
476
  }
513
477
  });
514
-
515
- return fileContexts;
516
478
  }
517
479
 
518
480
  function verifyFileContexts(fileContexts, verifiedFileContexts) {
@@ -562,7 +524,7 @@ function verifyFileContext(fileContext) {
562
524
 
563
525
  if (tokens === null) {
564
526
  const filePath = fileContext.getFilePath(),
565
- file = fileContext.getFile(filePath),
527
+ file = fileContext.findFile(filePath),
566
528
  lexer = fileContext.getLexer(),
567
529
  parser = fileContext.getParser(),
568
530
  content = file.getContent(),
package/src/equality.js CHANGED
@@ -121,14 +121,14 @@ export default class Equality {
121
121
 
122
122
  const equalityString = this.string; ///
123
123
 
124
- localContext.trace(`Verifying the stated '${equalityString}' equality...`);
124
+ localContext.trace(`Verifying the '${equalityString}' stated equality...`);
125
125
 
126
126
  const termsVerified = this.verifyTerms(localContext);
127
127
 
128
128
  verifiedWhenStated = termsVerified; ///
129
129
 
130
130
  if (verifiedWhenStated) {
131
- localContext.debug(`...verified the stated '${equalityString}' equality.`);
131
+ localContext.debug(`...verified the '${equalityString}' stated equality.`);
132
132
  }
133
133
 
134
134
  return verifiedWhenStated;
@@ -139,7 +139,7 @@ export default class Equality {
139
139
 
140
140
  const equalityString = this.string; ///
141
141
 
142
- localContext.trace(`Verifying the derived '${equalityString}' equality...`);
142
+ localContext.trace(`Verifying the '${equalityString}' derived equality...`);
143
143
 
144
144
  const termsVerified = this.verifyTerms(localContext);
145
145
 
@@ -150,7 +150,7 @@ export default class Equality {
150
150
  }
151
151
 
152
152
  if (verifiedWhenDerived) {
153
- localContext.debug(`...verified the derived '${equalityString}' equality.`);
153
+ localContext.debug(`...verified the '${equalityString}' derived equality.`);
154
154
  }
155
155
 
156
156
  return verifiedWhenDerived;