occam-verify-cli 0.0.526 → 0.0.529

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 (221) hide show
  1. package/README.md +4 -0
  2. package/bin/abbreviations.js +5 -1
  3. package/bin/action/help.js +4 -0
  4. package/bin/action/verify.js +35 -13
  5. package/bin/actions.js +11 -6
  6. package/bin/defaults.js +4 -0
  7. package/bin/options.js +4 -0
  8. package/bin/utilities/releaseContext.js +5 -7
  9. package/lib/assertion/type.js +10 -40
  10. package/lib/axiom.js +8 -8
  11. package/lib/axiomLemmaTheoremConjecture.js +190 -0
  12. package/lib/combinator.js +4 -3
  13. package/lib/conclusion.js +8 -7
  14. package/lib/conjecture.js +141 -0
  15. package/lib/consequence.js +6 -5
  16. package/lib/constants.js +11 -27
  17. package/lib/constructor.js +5 -4
  18. package/lib/context/file.js +88 -73
  19. package/lib/context/metaproof.js +51 -20
  20. package/lib/context/proof.js +48 -114
  21. package/lib/context/release/directory.js +25 -6
  22. package/lib/context/release/file.js +38 -25
  23. package/lib/context/release.js +32 -51
  24. package/lib/equality.js +79 -51
  25. package/lib/index.js +4 -16
  26. package/lib/kinds.js +5 -1
  27. package/lib/label.js +4 -3
  28. package/lib/lemma.js +8 -8
  29. package/lib/log.js +146 -0
  30. package/lib/matcher.js +25 -75
  31. package/lib/metaTypeNames.js +13 -0
  32. package/lib/mixins/file.js +62 -2
  33. package/lib/mixins/logging.js +13 -13
  34. package/lib/node/metastatement/bracketed.js +16 -0
  35. package/lib/node/statement/bracketed.js +16 -0
  36. package/lib/node/statement/combinator/bracketed.js +17 -0
  37. package/lib/node/statement/combinator/equality.js +17 -0
  38. package/lib/node/statement/equality.js +16 -0
  39. package/lib/ocmbinator/bracketed.js +3 -4
  40. package/lib/ocmbinator/equality.js +3 -4
  41. package/lib/premise.js +13 -12
  42. package/lib/rule.js +5 -5
  43. package/lib/ruleNames.js +1 -9
  44. package/lib/step/metaproof.js +28 -25
  45. package/lib/step/proof.js +23 -1
  46. package/lib/substitution/metastatementForMetavariable.js +16 -13
  47. package/lib/substitution/statementForMetavariable.js +16 -13
  48. package/lib/substitution/termForVariable.js +76 -0
  49. package/lib/supposition.js +7 -6
  50. package/lib/theorem.js +8 -8
  51. package/lib/type.js +12 -5
  52. package/lib/utilities/metaproof.js +60 -0
  53. package/lib/utilities/node.js +56 -0
  54. package/lib/utilities/proof.js +60 -0
  55. package/lib/utilities/releaseContext.js +24 -12
  56. package/lib/utilities/string.js +3 -38
  57. package/lib/variable.js +4 -38
  58. package/lib/{matcher → verifier}/metastatementForMetavariable/conclusion.js +12 -12
  59. package/lib/{matcher → verifier}/metastatementForMetavariable/premise.js +12 -12
  60. package/lib/verifier/metastatementForMetavariable.js +198 -0
  61. package/lib/{matcher → verifier}/statementForMetavariable/conclusion.js +12 -12
  62. package/lib/{matcher → verifier}/statementForMetavariable/premise.js +12 -12
  63. package/lib/verifier/statementForMetavariable.js +203 -0
  64. package/lib/{matcher/statementForVariable → verifier/termForVariable}/consequence.js +13 -13
  65. package/lib/{matcher/statementForVariable → verifier/termForVariable}/supposition.js +13 -13
  66. package/lib/verifier/termForVariable.js +198 -0
  67. package/lib/verifier.js +92 -0
  68. package/lib/verify/assertion/type.js +62 -41
  69. package/lib/verify/axiom.js +3 -6
  70. package/lib/verify/conclusion.js +2 -4
  71. package/lib/verify/conjecture.js +54 -0
  72. package/lib/verify/consequence.js +2 -4
  73. package/lib/verify/declaration/combinator.js +1 -3
  74. package/lib/verify/declaration/constructor.js +1 -3
  75. package/lib/verify/declaration/topLevel.js +7 -5
  76. package/lib/verify/declaration/type.js +1 -3
  77. package/lib/verify/declaration/variable.js +1 -3
  78. package/lib/verify/derivation.js +1 -5
  79. package/lib/verify/label.js +1 -3
  80. package/lib/verify/lemma.js +3 -6
  81. package/lib/verify/metastatement/qualified.js +2 -5
  82. package/lib/verify/metastatement/unqualified.js +2 -5
  83. package/lib/verify/metastatement.js +1 -3
  84. package/lib/verify/premise.js +2 -4
  85. package/lib/verify/proof.js +3 -5
  86. package/lib/verify/rule.js +3 -6
  87. package/lib/verify/ruleDerivation.js +1 -5
  88. package/lib/verify/ruleProof.js +3 -5
  89. package/lib/verify/statement/qualified.js +40 -13
  90. package/lib/verify/statement/unqualified.js +2 -5
  91. package/lib/verify/statement.js +56 -62
  92. package/lib/verify/statementAsCombinator.js +4 -6
  93. package/lib/verify/supposition.js +2 -4
  94. package/lib/verify/term.js +4 -10
  95. package/lib/verify/termAsConstructor.js +6 -9
  96. package/lib/verify/theorem.js +3 -6
  97. package/lib/verify/type.js +5 -9
  98. package/lib/verify/variable.js +5 -9
  99. package/package.json +1 -1
  100. package/src/assertion/type.js +7 -32
  101. package/src/axiom.js +4 -4
  102. package/src/{axiomLemmaTheorem.js → axiomLemmaTheoremConjecture.js} +9 -9
  103. package/src/combinator.js +3 -3
  104. package/src/conclusion.js +7 -7
  105. package/src/conjecture.js +13 -0
  106. package/src/consequence.js +5 -5
  107. package/src/constants.js +3 -7
  108. package/src/constructor.js +4 -4
  109. package/src/context/file.js +85 -65
  110. package/src/context/metaproof.js +55 -15
  111. package/src/context/proof.js +53 -50
  112. package/src/context/release/directory.js +31 -7
  113. package/src/context/release/file.js +47 -31
  114. package/src/context/release.js +23 -32
  115. package/src/equality.js +108 -61
  116. package/src/index.js +2 -4
  117. package/src/kinds.js +1 -0
  118. package/src/label.js +3 -3
  119. package/src/lemma.js +4 -4
  120. package/src/log.js +116 -0
  121. package/src/matcher.js +32 -24
  122. package/src/metaTypeNames.js +3 -0
  123. package/src/mixins/file.js +46 -1
  124. package/src/mixins/logging.js +6 -6
  125. package/src/node/metastatement/bracketed.js +9 -0
  126. package/src/node/statement/bracketed.js +9 -0
  127. package/src/node/statement/combinator/bracketed.js +10 -0
  128. package/src/node/statement/combinator/equality.js +11 -0
  129. package/src/node/statement/equality.js +10 -0
  130. package/src/ocmbinator/bracketed.js +2 -5
  131. package/src/ocmbinator/equality.js +2 -5
  132. package/src/premise.js +13 -13
  133. package/src/rule.js +4 -4
  134. package/src/ruleNames.js +0 -2
  135. package/src/step/metaproof.js +32 -29
  136. package/src/step/proof.js +28 -0
  137. package/src/substitution/metastatementForMetavariable.js +10 -15
  138. package/src/substitution/statementForMetavariable.js +11 -16
  139. package/src/substitution/termForVariable.js +36 -0
  140. package/src/supposition.js +6 -6
  141. package/src/theorem.js +4 -4
  142. package/src/type.js +17 -7
  143. package/src/utilities/metaproof.js +62 -0
  144. package/src/utilities/node.js +73 -0
  145. package/src/utilities/proof.js +62 -0
  146. package/src/utilities/releaseContext.js +30 -12
  147. package/src/utilities/string.js +4 -53
  148. package/src/variable.js +4 -37
  149. package/src/verifier/metastatementForMetavariable/conclusion.js +9 -0
  150. package/src/verifier/metastatementForMetavariable/premise.js +9 -0
  151. package/src/verifier/metastatementForMetavariable.js +89 -0
  152. package/src/verifier/statementForMetavariable/conclusion.js +9 -0
  153. package/src/verifier/statementForMetavariable/premise.js +9 -0
  154. package/src/verifier/statementForMetavariable.js +105 -0
  155. package/src/verifier/termForVariable/consequence.js +9 -0
  156. package/src/verifier/termForVariable/supposition.js +9 -0
  157. package/src/verifier/termForVariable.js +89 -0
  158. package/src/verifier.js +74 -0
  159. package/src/verify/assertion/type.js +74 -74
  160. package/src/verify/axiom.js +2 -9
  161. package/src/verify/conclusion.js +1 -7
  162. package/src/verify/conjecture.js +67 -0
  163. package/src/verify/consequence.js +1 -7
  164. package/src/verify/declaration/combinator.js +0 -6
  165. package/src/verify/declaration/constructor.js +0 -6
  166. package/src/verify/declaration/topLevel.js +7 -6
  167. package/src/verify/declaration/type.js +0 -6
  168. package/src/verify/declaration/variable.js +0 -6
  169. package/src/verify/derivation.js +0 -12
  170. package/src/verify/label.js +0 -6
  171. package/src/verify/lemma.js +4 -11
  172. package/src/verify/metastatement/qualified.js +1 -8
  173. package/src/verify/metastatement/unqualified.js +1 -8
  174. package/src/verify/metastatement.js +0 -6
  175. package/src/verify/premise.js +1 -7
  176. package/src/verify/proof.js +1 -7
  177. package/src/verify/rule.js +2 -9
  178. package/src/verify/ruleDerivation.js +0 -12
  179. package/src/verify/ruleProof.js +1 -7
  180. package/src/verify/statement/qualified.js +54 -20
  181. package/src/verify/statement/unqualified.js +1 -8
  182. package/src/verify/statement.js +65 -95
  183. package/src/verify/statementAsCombinator.js +3 -9
  184. package/src/verify/supposition.js +1 -7
  185. package/src/verify/term.js +3 -21
  186. package/src/verify/termAsConstructor.js +5 -13
  187. package/src/verify/theorem.js +2 -9
  188. package/src/verify/type.js +4 -13
  189. package/src/verify/variable.js +4 -13
  190. package/bin/callbacks.js +0 -48
  191. package/lib/axiomLemmaTheorem.js +0 -190
  192. package/lib/callbacks.js +0 -75
  193. package/lib/context/release/combinator.js +0 -64
  194. package/lib/jsonTypes.js +0 -30
  195. package/lib/matcher/metastatementForMetavariable.js +0 -201
  196. package/lib/matcher/statementForMetavariable.js +0 -201
  197. package/lib/matcher/statementForVariable.js +0 -201
  198. package/lib/mixins/callbacks.js +0 -27
  199. package/lib/substitution/statementForVariable.js +0 -86
  200. package/lib/utilities/json.js +0 -187
  201. package/lib/utilities/substitution.js +0 -61
  202. package/lib/utilities/version.js +0 -32
  203. package/lib/versionChanges.js +0 -34
  204. package/src/callbacks.js +0 -39
  205. package/src/context/release/combinator.js +0 -39
  206. package/src/jsonTypes.js +0 -6
  207. package/src/matcher/metastatementForMetavariable/conclusion.js +0 -9
  208. package/src/matcher/metastatementForMetavariable/premise.js +0 -9
  209. package/src/matcher/metastatementForMetavariable.js +0 -99
  210. package/src/matcher/statementForMetavariable/conclusion.js +0 -9
  211. package/src/matcher/statementForMetavariable/premise.js +0 -9
  212. package/src/matcher/statementForMetavariable.js +0 -99
  213. package/src/matcher/statementForVariable/consequence.js +0 -9
  214. package/src/matcher/statementForVariable/supposition.js +0 -9
  215. package/src/matcher/statementForVariable.js +0 -99
  216. package/src/mixins/callbacks.js +0 -15
  217. package/src/substitution/statementForVariable.js +0 -64
  218. package/src/utilities/json.js +0 -264
  219. package/src/utilities/substitution.js +0 -79
  220. package/src/utilities/version.js +0 -30
  221. package/src/versionChanges.js +0 -11
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ import Equality from "../equality";
3
4
  import fileMixins from "../mixins/file";
4
5
  import loggingMixins from "../mixins/logging";
5
- import callbacksMixins from "../mixins/callbacks";
6
6
 
7
7
  import { push, last } from "../utilities/array";
8
+ import { MAXIMUM_INDEXES_LENGTH } from "../constants";
8
9
 
9
10
  class ProofContext {
10
11
  constructor(context, variables, proofSteps) {
@@ -17,6 +18,18 @@ class ProofContext {
17
18
  return this.context;
18
19
  }
19
20
 
21
+ getVariables() {
22
+ const variables = [];
23
+
24
+ push(variables, this.variables);
25
+
26
+ const contextVariables = this.context.getVariables();
27
+
28
+ push(variables, contextVariables);
29
+
30
+ return variables;
31
+ }
32
+
20
33
  getProofSteps() {
21
34
  let proofSteps = this.context.getProofSteps();
22
35
 
@@ -28,34 +41,34 @@ class ProofContext {
28
41
  return proofSteps;
29
42
  }
30
43
 
31
- getTypes() { return this.context.getTypes(); }
32
-
33
- getAxioms() { return this.context.getAxioms(); }
34
-
35
- getLemmas() { return this.context.getLemmas(); }
36
-
37
- getTheorems() { return this.context.getTheorems(); }
38
-
39
- getCombinators() { return this.context.getCombinators(); }
44
+ getLastProofStep() {
45
+ let lastProofStep = null;
40
46
 
41
- getConstructors() { return this.context.getConstructors(); }
47
+ const proofStepsLength = this.proofSteps.length;
42
48
 
43
- getVariables() {
44
- const variables = [];
49
+ if (proofStepsLength > 0) {
50
+ lastProofStep = last(this.proofSteps);
51
+ }
45
52
 
46
- push(variables, this.variables);
53
+ return lastProofStep;
54
+ }
47
55
 
48
- const contextVariables = this.context.getVariables();
56
+ getMetavariables() { return this.context.getMetavariables(); }
49
57
 
50
- push(variables, contextVariables);
58
+ getEqualities() {
59
+ const equalities = [],
60
+ start = -MAXIMUM_INDEXES_LENGTH, ///
61
+ proofSteps = this.proofSteps.slice(start); ///
51
62
 
52
- return variables;
53
- }
63
+ proofSteps.forEach((proofStep) => {
64
+ const equality = Equality.fromProofStep(proofStep);
54
65
 
55
- getLastProofStep() {
56
- const lastProofStep = last(this.proofSteps);
66
+ if (equality !== null) {
67
+ equalities.push(equality);
68
+ }
69
+ });
57
70
 
58
- return lastProofStep;
71
+ return equalities;
59
72
  }
60
73
 
61
74
  addVariable(variable) {
@@ -67,15 +80,19 @@ class ProofContext {
67
80
  }
68
81
 
69
82
  matchStatement(statementNode) {
70
- let statementMatches;
83
+ let statementMatches = false;
71
84
 
72
- statementMatches = this.proofSteps.some((proofStep) => {
73
- statementMatches = proofStep.matchStatement(statementNode);
85
+ if (!statementMatches) {
86
+ const proofStepMatchesStatement = this.proofSteps.some((proofStep) => {
87
+ const proofStepMatchesStatement = proofStep.match(statementNode);
74
88
 
75
- if (statementMatches) {
76
- return true;
77
- }
78
- });
89
+ if (proofStepMatchesStatement) {
90
+ return true;
91
+ }
92
+ });
93
+
94
+ statementMatches = proofStepMatchesStatement; ///
95
+ }
79
96
 
80
97
  if (!statementMatches) {
81
98
  statementMatches = this.context.matchStatement(statementNode);
@@ -100,31 +117,11 @@ class ProofContext {
100
117
 
101
118
  isVariablePresentByVariableName(variableName) {
102
119
  const variable = this.findVariableByVariableName(variableName),
103
- variablePresent = (variable !== null);
120
+ variablePresent = (variable !== null);
104
121
 
105
122
  return variablePresent;
106
123
  }
107
124
 
108
- findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
109
-
110
- findLabelByTypeName(labelName) { return this.context.findLabelByTypeName(labelName); }
111
-
112
- findRuleByReferenceName(referenceName) { return this.context.findRuleByReferenceName(referenceName); }
113
-
114
- findAxiomByReferenceName(referenceName) { return this.context.findAxiomByReferenceName(referenceName); }
115
-
116
- findLemmaByReferenceName(referenceName) { return this.context.findLemmaByReferenceName(referenceName); }
117
-
118
- findTheoremByReferenceName(referenceName) { return this.context.findTheoremByReferenceName(referenceName); }
119
-
120
- isLabelPresentByLabelName(labelName) { return this.context.isLabelPresentByLabelName(labelName); }
121
-
122
- isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
123
-
124
- nodeAsString(node) { return this.context.nodeAsString(node); }
125
-
126
- nodesAsString(node) { return this.context.nodesAsString(node); }
127
-
128
125
  static fromFileContext(fileContext) {
129
126
  const context = fileContext, ///
130
127
  variables = [],
@@ -147,6 +144,12 @@ class ProofContext {
147
144
 
148
145
  Object.assign(ProofContext.prototype, fileMixins);
149
146
  Object.assign(ProofContext.prototype, loggingMixins);
150
- Object.assign(ProofContext.prototype, callbacksMixins);
151
147
 
152
148
  export default ProofContext;
149
+
150
+ function equalitiesFromProofSteps(proofSteps, context) {
151
+ let equalities = [];
152
+
153
+
154
+ return equalities;
155
+ }
@@ -6,8 +6,8 @@ import { push } from "../../utilities/array";
6
6
  import { customGrammarFromNameAndEntries } from "../../utilities/customGrammar";
7
7
 
8
8
  export default class DirectoryReleaseContext extends ReleaseContext {
9
- constructor(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, fileContexts) {
10
- super(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts);
9
+ constructor(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts, fileContexts) {
10
+ super(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts);
11
11
 
12
12
  this.fileContexts = fileContexts;
13
13
  }
@@ -149,6 +149,30 @@ export default class DirectoryReleaseContext extends ReleaseContext {
149
149
  return theorems;
150
150
  }
151
151
 
152
+ getConjectures(includeDependencies = true) {
153
+ const conjectures = [];
154
+
155
+ this.fileContexts.forEach((fileContext) => {
156
+ const includeRelease = false,
157
+ fileContextConjectures = fileContext.getConjectures(includeRelease);
158
+
159
+ push(conjectures, fileContextConjectures);
160
+ });
161
+
162
+ if (includeDependencies) {
163
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
164
+
165
+ dependencyReleaseContexts.forEach((releaseContext) => {
166
+ const includeDependencies = false,
167
+ releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
168
+
169
+ push(conjectures, releaseContextConjectures);
170
+ });
171
+ }
172
+
173
+ return conjectures;
174
+ }
175
+
152
176
  getCombinators(includeDependencies = true) {
153
177
  const combinators = [];
154
178
 
@@ -213,14 +237,14 @@ export default class DirectoryReleaseContext extends ReleaseContext {
213
237
  return json;
214
238
  }
215
239
 
216
- static fromLogNameEntriesAndCallbacks(log, name, entries, callbacks) {
217
- const verified = false,
240
+ static fromLogNameAndEntries(log, name, entries) {
241
+ const lexer = null,
242
+ parser = null,
243
+ verified = false,
218
244
  customGrammar = customGrammarFromNameAndEntries(name, entries),
219
- florenceLexer = null,
220
- florenceParser = null,
221
245
  dependencyReleaseContexts = null,
222
246
  fileContexts = [],
223
- directoryReleaseContext = new DirectoryReleaseContext(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, fileContexts);
247
+ directoryReleaseContext = new DirectoryReleaseContext(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts, fileContexts);
224
248
 
225
249
  return directoryReleaseContext;
226
250
  }
@@ -2,29 +2,29 @@
2
2
 
3
3
  import ReleaseContext from "../../context/release";
4
4
 
5
- import { rewriteNodes } from "occam-grammar-utilities";
6
-
7
5
  import Rule from "../../rule";
8
6
  import Type from "../../type";
9
7
  import Axiom from "../../axiom";
10
8
  import Lemma from "../../lemma";
11
9
  import Theorem from "../../theorem";
10
+ import Conjecture from "../../conjecture";
12
11
  import Combinator from "../../combinator";
13
12
  import Constructor from "../../constructor";
14
13
 
15
14
  import { push } from "../../utilities/array";
16
15
  import { customGrammarFromNameAndEntries } from "../../utilities/customGrammar";
17
- import { RULE_KIND, TYPE_KIND, AXIOM_KIND, LEMMA_KIND, THEOREM_KIND, COMBINATOR_KIND, CONSTRUCTOR_KIND } from "../../kinds";
16
+ import { RULE_KIND, TYPE_KIND, AXIOM_KIND, LEMMA_KIND, THEOREM_KIND, CONJECTURE_KIND, COMBINATOR_KIND, CONSTRUCTOR_KIND } from "../../kinds";
18
17
 
19
18
  export default class FileReleaseContext extends ReleaseContext {
20
- constructor(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, combinators, constructors) {
21
- super(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts);
19
+ constructor(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors, contextJSON) {
20
+ super(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts);
22
21
 
23
22
  this.types = types;
24
23
  this.rules = rules;
25
24
  this.axioms = axioms;
26
25
  this.lemmas = lemmas;
27
26
  this.theorems = theorems;
27
+ this.conjectures = conjectures;
28
28
  this.combinators = combinators;
29
29
  this.constructors = constructors;
30
30
  this.contextJSON = contextJSON;
@@ -153,6 +153,25 @@ export default class FileReleaseContext extends ReleaseContext {
153
153
  return theorems;
154
154
  }
155
155
 
156
+ getConjectures(includeDependencies = true) {
157
+ const conjectures = [];
158
+
159
+ push(conjectures, this.conjectures);
160
+
161
+ if (includeDependencies) {
162
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
163
+
164
+ dependencyReleaseContexts.forEach((releaseContext) => {
165
+ const includeDependencies = false,
166
+ releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
167
+
168
+ push(conjectures, releaseContextConjectures);
169
+ });
170
+ }
171
+
172
+ return conjectures;
173
+ }
174
+
156
175
  getCombinators(includeDependencies = true) {
157
176
  const combinators = [];
158
177
 
@@ -191,29 +210,17 @@ export default class FileReleaseContext extends ReleaseContext {
191
210
  return constructors;
192
211
  }
193
212
 
194
- nodeFromContentAndRuleName(content, ruleName) {
195
- const ruleMap = this.florenceParser.getRuleMap(),
196
- rule = ruleMap[ruleName],
197
- tokens = this.florenceLexer.tokenise(content),
198
- node = this.florenceParser.parse(tokens, rule);
199
-
200
- if (node !== null) {
201
- rewriteNodes(node);
202
- }
203
-
204
- return node;
205
- }
206
-
207
213
  fromJSON() {
208
214
  const jsonArray = this.contextJSON,
209
- releaseContext = this; ///
215
+ lexer = this.getLexer(),
216
+ parser = this.getParser();
210
217
 
211
218
  jsonArray.forEach((json) => {
212
219
  const { kind } = json;
213
220
 
214
221
  switch (kind) {
215
222
  case TYPE_KIND: {
216
- const type = Type.fromJSON(json, releaseContext);
223
+ const type = Type.fromJSON(json, lexer, parser);
217
224
 
218
225
  this.types.push(type);
219
226
 
@@ -221,7 +228,7 @@ export default class FileReleaseContext extends ReleaseContext {
221
228
  }
222
229
 
223
230
  case RULE_KIND: {
224
- const rule = Rule.fromJSON(json, releaseContext);
231
+ const rule = Rule.fromJSON(json, lexer, parser);
225
232
 
226
233
  this.rules.push(rule);
227
234
 
@@ -229,7 +236,7 @@ export default class FileReleaseContext extends ReleaseContext {
229
236
  }
230
237
 
231
238
  case AXIOM_KIND: {
232
- const axiom = Axiom.fromJSON(json, releaseContext);
239
+ const axiom = Axiom.fromJSON(json, lexer, parser);
233
240
 
234
241
  this.axioms.push(axiom);
235
242
 
@@ -237,7 +244,7 @@ export default class FileReleaseContext extends ReleaseContext {
237
244
  }
238
245
 
239
246
  case LEMMA_KIND: {
240
- const lemma = Lemma.fromJSON(json, releaseContext);
247
+ const lemma = Lemma.fromJSON(json, lexer, parser);
241
248
 
242
249
  this.lemmas.push(lemma);
243
250
 
@@ -245,15 +252,23 @@ export default class FileReleaseContext extends ReleaseContext {
245
252
  }
246
253
 
247
254
  case THEOREM_KIND: {
248
- const theorem = Theorem.fromJSON(json, releaseContext);
255
+ const theorem = Theorem.fromJSON(json, lexer, parser);
249
256
 
250
257
  this.theorems.push(theorem);
251
258
 
252
259
  break;
253
260
  }
254
261
 
262
+ case CONJECTURE_KIND: {
263
+ const conjecture = Conjecture.fromJSON(json, lexer, parser);
264
+
265
+ this.conjectures.push(conjecture);
266
+
267
+ break;
268
+ }
269
+
255
270
  case COMBINATOR_KIND: {
256
- const combinator = Combinator.fromJSON(json, releaseContext);
271
+ const combinator = Combinator.fromJSON(json, lexer, parser);
257
272
 
258
273
  this.combinators.push(combinator);
259
274
 
@@ -261,7 +276,7 @@ export default class FileReleaseContext extends ReleaseContext {
261
276
  }
262
277
 
263
278
  case CONSTRUCTOR_KIND: {
264
- const constructor = Constructor.fromJSON(json, releaseContext);
279
+ const constructor = Constructor.fromJSON(json, lexer, parser);
265
280
 
266
281
  this.constructors.push(constructor);
267
282
 
@@ -277,20 +292,21 @@ export default class FileReleaseContext extends ReleaseContext {
277
292
  this.fromJSON();
278
293
  }
279
294
 
280
- static fromLogNameEntriesCallbacksAndContextJSON(log, name, entries, callbacks, contextJSON) {
281
- const verified = true,
295
+ static fromLogNameEntriesAndContextJSON(log, name, entries, contextJSON) {
296
+ const lexer = null,
297
+ parser = null,
298
+ verified = true,
282
299
  customGrammar = customGrammarFromNameAndEntries(name, entries),
283
- florenceLexer = null,
284
- florenceParser = null,
285
300
  dependencyReleaseContexts = null,
286
301
  types = [],
287
302
  rules = [],
288
303
  axioms = [],
289
304
  lemmas = [],
290
305
  theorems = [],
306
+ conjectures = [],
291
307
  combinators = [],
292
308
  constructors = [],
293
- releaseContext = new FileReleaseContext(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, combinators, constructors);
309
+ releaseContext = new FileReleaseContext(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors, contextJSON);
294
310
 
295
311
  return releaseContext;
296
312
  }
@@ -8,20 +8,19 @@ const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
8
8
  { florenceParserFromCombinedCustomGrammar } = parsersUtilities;
9
9
 
10
10
  export default class ReleaseContext {
11
- constructor(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts) {
11
+ constructor(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts) {
12
12
  this.log = log;
13
13
  this.name = name;
14
14
  this.entries = entries;
15
- this.callbacks = callbacks;
15
+ this.lexer = lexer;
16
+ this.parser = parser;
16
17
  this.verified = verified;
17
18
  this.customGrammar = customGrammar;
18
- this.florenceLexer = florenceLexer;
19
- this.florenceParser = florenceParser;
20
19
  this.dependencyReleaseContexts = dependencyReleaseContexts;
21
20
  }
22
21
 
23
22
  getLog() {
24
- return this.log;
23
+ return log;
25
24
  }
26
25
 
27
26
  getName() {
@@ -32,8 +31,12 @@ export default class ReleaseContext {
32
31
  return this.entries;
33
32
  }
34
33
 
35
- getCallbacks() {
36
- return this.callbacks;
34
+ getLexer() {
35
+ return this.lexer;
36
+ }
37
+
38
+ getParser() {
39
+ return this.parser;
37
40
  }
38
41
 
39
42
  isVerified() {
@@ -44,14 +47,6 @@ export default class ReleaseContext {
44
47
  return this.customGrammar;
45
48
  }
46
49
 
47
- getFlorenceLexer() {
48
- return this.florenceLexer;
49
- }
50
-
51
- getFlorenceParser() {
52
- return this.florenceParser;
53
- }
54
-
55
50
  getDependencyReleaseContexts() {
56
51
  return this.dependencyReleaseContexts;
57
52
  }
@@ -96,27 +91,21 @@ export default class ReleaseContext {
96
91
  this.verified = verified;
97
92
  }
98
93
 
99
- tokenise(content) { return this.florenceLexer.tokenise(content); }
100
-
101
- parse(tokens) { return this.florenceParser.parse(tokens); }
102
-
103
- trace(message) { this.log.trace(message); }
104
-
105
- debug(message) { this.log.debug(message); }
94
+ tokenise(content) { return this.lexer.tokenise(content); }
106
95
 
107
- info(message) { this.log.info(message); }
96
+ parse(tokens) { return this.parser.parse(tokens); }
108
97
 
109
- warning(message) { this.log.warning(message); }
98
+ trace(message, node = null, tokens = null, filePath = null) { this.log.trace(message, node, tokens, filePath); }
110
99
 
111
- error(message) { this.log.error(message); }
100
+ debug(message, node = null, tokens = null, filePath = null) { this.log.debug(message, node, tokens, filePath); }
112
101
 
113
- fatal(message) { this.log.fatal(message); }
102
+ info(message, node = null, tokens = null, filePath = null) { this.log.info(message, node, tokens, filePath); }
114
103
 
115
- halt(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.halt(filePath, leastLineIndex, greatestLineIndex); }
104
+ warning(message, node = null, tokens = null, filePath = null) { this.log.warning(message, node, tokens, filePath); }
116
105
 
117
- begin(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.begin(filePath, leastLineIndex, greatestLineIndex); }
106
+ error(message, node = null, tokens = null, filePath = null) { this.log.error(message, node, tokens, filePath); }
118
107
 
119
- complete(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.complete(filePath, leastLineIndex, greatestLineIndex); }
108
+ fatal(message, node = null, tokens = null, filePath = null) { this.log.fatal(message, node, tokens, filePath); }
120
109
 
121
110
  initialise(dependencyReleaseContexts) {
122
111
  const releaseContext = this, ///
@@ -124,11 +113,13 @@ export default class ReleaseContext {
124
113
  releaseContext,
125
114
  ...dependencyReleaseContexts
126
115
  ],
127
- combinedCustomGrammar = combinedCustomGrammarFromReleaseContexts(releaseContexts);
116
+ combinedCustomGrammar = combinedCustomGrammarFromReleaseContexts(releaseContexts),
117
+ florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar),
118
+ florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
128
119
 
129
- this.florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar);
120
+ this.lexer = florenceLexer; ///
130
121
 
131
- this.florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
122
+ this.parser = florenceParser; ///
132
123
 
133
124
  this.dependencyReleaseContexts = dependencyReleaseContexts;
134
125
  }