occam-verify-cli 1.0.781 → 1.0.787

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 (59) hide show
  1. package/lib/context/branching.js +1 -1
  2. package/lib/context/ephemeral.js +22 -11
  3. package/lib/context/file/nominal.js +4 -4
  4. package/lib/context/proof.js +45 -40
  5. package/lib/context.js +16 -24
  6. package/lib/element/assumption.js +53 -17
  7. package/lib/element/frame.js +1 -39
  8. package/lib/element/judgement.js +33 -5
  9. package/lib/element/label.js +9 -1
  10. package/lib/element/metavariable.js +7 -7
  11. package/lib/element/proofAssertion/step.js +3 -3
  12. package/lib/element/reference.js +24 -22
  13. package/lib/element/substitution/frame.js +5 -7
  14. package/lib/element/substitution/reference.js +9 -9
  15. package/lib/element/substitution/statement.js +7 -11
  16. package/lib/element/substitution/term.js +4 -6
  17. package/lib/element/topLevelMetaAssertion.js +9 -9
  18. package/lib/nonTerminalNodeMap.js +1 -3
  19. package/lib/preamble.js +1 -2
  20. package/lib/process/instantiate.js +2 -8
  21. package/lib/process/unify.js +72 -5
  22. package/lib/ruleNames.js +1 -5
  23. package/lib/utilities/context.js +5 -22
  24. package/lib/utilities/element.js +25 -76
  25. package/lib/utilities/json.js +1 -23
  26. package/lib/utilities/string.js +8 -19
  27. package/lib/utilities/unification.js +8 -6
  28. package/package.json +4 -4
  29. package/src/context/branching.js +1 -1
  30. package/src/context/ephemeral.js +26 -10
  31. package/src/context/file/nominal.js +3 -3
  32. package/src/context/proof.js +52 -46
  33. package/src/context.js +21 -34
  34. package/src/element/assumption.js +82 -23
  35. package/src/element/frame.js +1 -61
  36. package/src/element/judgement.js +45 -5
  37. package/src/element/label.js +14 -0
  38. package/src/element/metavariable.js +6 -9
  39. package/src/element/proofAssertion/step.js +2 -2
  40. package/src/element/reference.js +32 -29
  41. package/src/element/substitution/frame.js +6 -8
  42. package/src/element/substitution/reference.js +13 -11
  43. package/src/element/substitution/statement.js +11 -15
  44. package/src/element/substitution/term.js +6 -8
  45. package/src/element/topLevelMetaAssertion.js +13 -13
  46. package/src/nonTerminalNodeMap.js +0 -3
  47. package/src/preamble.js +0 -1
  48. package/src/process/instantiate.js +2 -6
  49. package/src/process/unify.js +117 -7
  50. package/src/ruleNames.js +0 -1
  51. package/src/utilities/context.js +4 -33
  52. package/src/utilities/element.js +46 -101
  53. package/src/utilities/json.js +0 -26
  54. package/src/utilities/string.js +8 -22
  55. package/src/utilities/unification.js +8 -8
  56. package/lib/element/substitution/metaLevel.js +0 -148
  57. package/lib/node/substitution/metaLevel.js +0 -40
  58. package/src/element/substitution/metaLevel.js +0 -212
  59. package/src/node/substitution/metaLevel.js +0 -37
@@ -3,7 +3,7 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { simplify, instantiate } from "../../utilities/context";
6
+ import { instantiate } from "../../utilities/context";
7
7
  import { stripBracketsFromTerm } from "../../utilities/brackets";
8
8
  import { instantiateTermSubstitution } from "../../process/instantiate";
9
9
  import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
@@ -212,14 +212,12 @@ export default define(class TermSubstitution extends Substitution {
212
212
 
213
213
  let termSubstitution;
214
214
 
215
- simplify((context) => {
216
- instantiate((context) => {
217
- const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
218
- string = termSubstitutionString, ///
219
- termSubstitutionNode = instantiateTermSubstitution(string, context);
215
+ instantiate((context) => {
216
+ const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
217
+ string = termSubstitutionString, ///
218
+ termSubstitutionNode = instantiateTermSubstitution(string, context);
220
219
 
221
- termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
222
- }, context);
220
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
223
221
  }, context);
224
222
 
225
223
  return termSubstitution;
@@ -7,23 +7,23 @@ import { topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "..
7
7
  import { labelFromJSON,
8
8
  labelToLabelJSON,
9
9
  deductionFromJSON,
10
+ assumptionsFromJSON,
10
11
  suppositionsFromJSON,
11
12
  deductionToDeductionJSON,
12
- suppositionsToSuppositionsJSON,
13
- metaLevelSubstitutionsFromJSON,
14
- metaLevelSubstitutionsToMetaLevelSubstitutionsJSON } from "../utilities/json";
13
+ assumptionsToAssumptionsJSON,
14
+ suppositionsToSuppositionsJSON } from "../utilities/json";
15
15
 
16
16
  const { asyncForwardsEvery } = asynchronousUtilities;
17
17
 
18
18
  export default class TopLevelMetaAssertion extends Element {
19
- constructor(context, string, node, label, suppositions, deduction, proof, metaLevelSubstitutions) {
19
+ constructor(context, string, node, label, suppositions, deduction, proof, assumptions) {
20
20
  super(context, string, node);
21
21
 
22
22
  this.label = label;
23
23
  this.suppositions = suppositions;
24
24
  this.deduction = deduction;
25
25
  this.proof = proof;
26
- this.metaLevelSubstitutions = metaLevelSubstitutions;
26
+ this.assumptions = assumptions;
27
27
  }
28
28
 
29
29
  getLabel() {
@@ -42,8 +42,8 @@ export default class TopLevelMetaAssertion extends Element {
42
42
  return this.proof;
43
43
  }
44
44
 
45
- getMetaLevelSubstitutions() {
46
- return this.metaLevelSubstitutions;
45
+ getAssumptions() {
46
+ return this.assumptions;
47
47
  }
48
48
 
49
49
  getStatement() {
@@ -121,7 +121,7 @@ export default class TopLevelMetaAssertion extends Element {
121
121
  }
122
122
  }
123
123
  }
124
- }, this.metaLevelSubstitutions, context);
124
+ }, this.assumptions, context);
125
125
 
126
126
  if (verifies) {
127
127
  context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta assertion.`);
@@ -234,16 +234,16 @@ export default class TopLevelMetaAssertion extends Element {
234
234
  const labelJSON = labelToLabelJSON(this.label),
235
235
  deductionJSON = deductionToDeductionJSON(this.deduction),
236
236
  suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
237
- metaLevelSubstitutionsJSON = metaLevelSubstitutionsToMetaLevelSubstitutionsJSON(this.metaLevelSubstitutions),
237
+ assumptionsJSON = assumptionsToAssumptionsJSON(this.assumptions),
238
238
  label = labelJSON, ///
239
239
  deduction = deductionJSON, ///
240
240
  suppositions = suppositionsJSON, ///
241
- metaLevelSubstitutions = metaLevelSubstitutionsJSON, ///
241
+ assumptions = assumptionsJSON, ///
242
242
  json = {
243
243
  label,
244
244
  deduction,
245
245
  suppositions,
246
- metaLevelSubstitutions
246
+ assumptions
247
247
  };
248
248
 
249
249
  return json;
@@ -253,11 +253,11 @@ export default class TopLevelMetaAssertion extends Element {
253
253
  const label = labelFromJSON(json, context),
254
254
  deduction = deductionFromJSON(json, context),
255
255
  suppositions = suppositionsFromJSON(json, context),
256
- metaLevelSubstitutions = metaLevelSubstitutionsFromJSON(json, context),
256
+ assumptions = assumptionsFromJSON(json, context),
257
257
  node = null,
258
258
  proof = null,
259
259
  string = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
260
- topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, metaLevelSubstitutions);
260
+ topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, assumptions);
261
261
 
262
262
  return topLevelMetaAssertion;
263
263
  }
@@ -79,7 +79,6 @@ import SimpleTypeDeclarationNode from "./node/declaration/simpleType";
79
79
  import CombinatorDeclarationNode from "./node/declaration/combinator";
80
80
  import ReferenceSubstitutionNode from "./node/substitution/reference";
81
81
  import StatementSubstitutionNode from "./node/substitution/statement";
82
- import MetaLevelSubstitutionNode from "./node/substitution/metaLevel";
83
82
  import TypePrefixDeclarationNode from "./node/declaration/typePrefix";
84
83
  import ComplexTypeDeclarationNode from "./node/declaration/complexType";
85
84
  import DonstructorDeclarationNode from "./node/declaration/constructor";
@@ -164,7 +163,6 @@ import {
164
163
  COMBINATOR_DECLARATION_RULE_NAME,
165
164
  REFERENCE_SUBSTITUTION_RULE_NAME,
166
165
  STATEMENT_SUBSTITUTION_RULE_NAME,
167
- META_LEVEL_SUBSTITUTION_RULE_NAME,
168
166
  SIMPLE_TYPE_DECLARATION_RULE_NAME,
169
167
  CONSTRUCTOR_DECLARATION_RULE_NAME,
170
168
  TYPE_PREFIX_DECLARATION_RULE_NAME,
@@ -250,7 +248,6 @@ const NonTerminalNodeMap = {
250
248
  [COMBINATOR_DECLARATION_RULE_NAME]: CombinatorDeclarationNode,
251
249
  [STATEMENT_SUBSTITUTION_RULE_NAME]: StatementSubstitutionNode,
252
250
  [REFERENCE_SUBSTITUTION_RULE_NAME]: ReferenceSubstitutionNode,
253
- [META_LEVEL_SUBSTITUTION_RULE_NAME]: MetaLevelSubstitutionNode,
254
251
  [SIMPLE_TYPE_DECLARATION_RULE_NAME]: SimpleTypeDeclarationNode,
255
252
  [TYPE_PREFIX_DECLARATION_RULE_NAME]: TypePrefixDeclarationNode,
256
253
  [CONSTRUCTOR_DECLARATION_RULE_NAME]: DonstructorDeclarationNode,
package/src/preamble.js CHANGED
@@ -57,7 +57,6 @@ import SimpleTypeDeclaration from "./element/declaration/simpleType";
57
57
  import StatementSubstitution from "./element/substitution/statement";
58
58
  import ReferenceSubstitution from "./element/substitution/reference";
59
59
  import CombinatorDeclaration from "./element/declaration/combinator";
60
- import MetaLevelSubstitution from "./element/substitution/metaLevel";
61
60
  import TypePrefixDeclaration from "./element/declaration/typePrefix";
62
61
  import ConstructorDeclaration from "./element/declaration/constructor";
63
62
  import ComplexTypeDeclaration from "./element/declaration/complexType";
@@ -34,8 +34,7 @@ import { TERM_RULE_NAME,
34
34
  CONTAINED_ASSERTION_RULE_NAME,
35
35
  SATISFIES_ASSERTION_RULE_NAME,
36
36
  STATEMENT_SUBSTITUTION_RULE_NAME,
37
- REFERENCE_SUBSTITUTION_RULE_NAME,
38
- META_LEVEL_SUBSTITUTION_RULE_NAME } from "../ruleNames";
37
+ REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
39
38
 
40
39
  const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
41
40
  typePlaceholderRule = ruleFromRuleName(TYPE_RULE_NAME),
@@ -70,8 +69,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
70
69
  containedAssertionPlaceholderRule = ruleFromRuleName(CONTAINED_ASSERTION_RULE_NAME),
71
70
  satisfiesAssertionPlaceholderRule = ruleFromRuleName(SATISFIES_ASSERTION_RULE_NAME),
72
71
  statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
73
- referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME),
74
- metaLevelSubstitutionPlaceholderRule = ruleFromRuleName(META_LEVEL_SUBSTITUTION_RULE_NAME);
72
+ referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
75
73
 
76
74
  export function instantiatePremise(string, context) {
77
75
  string = `${string}
@@ -161,8 +159,6 @@ export function instantiateStatementSubstitution(string, context) { return insta
161
159
 
162
160
  export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
163
161
 
164
- export function instantiateMetaLevelSubstitution(string, context) { return instantiate(metaLevelSubstitutionPlaceholderRule, string, context); }
165
-
166
162
  function instantiate(placeholderRule, string, context) {
167
163
  let node;
168
164
 
@@ -14,8 +14,9 @@ const typeNodeQuery = nodeQuery("/type"),
14
14
  frameNodeQuery = nodeQuery("/frame"),
15
15
  metaTypeNodeQuery = nodeQuery("/metaType"),
16
16
  statementNodeQuery = nodeQuery("/statement"),
17
+ metavariableNodeQuery = nodeQuery("/metavariable"),
17
18
  termVariableNodeQuery = nodeQuery("/term/variable!"),
18
- frameAMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
19
+ frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
19
20
  statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
20
21
  assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!");
21
22
 
@@ -89,7 +90,7 @@ class MetaLevelPass extends ZipPassBase {
89
90
  }
90
91
  },
91
92
  {
92
- generalNodeQuery: frameAMetavariableNodeQuery,
93
+ generalNodeQuery: frameMetavariableNodeQuery,
93
94
  specificNodeQuery: frameNodeQuery,
94
95
  run: (generalFrameMetavariableNode, specificFrameNode, generalContext, specificContext) => {
95
96
  let success = false;
@@ -147,6 +148,98 @@ class MetaLevelPass extends ZipPassBase {
147
148
  ];
148
149
  }
149
150
 
151
+ class AssumptionPass extends ZipPass {
152
+ static maps = [
153
+ {
154
+ generalNodeQuery: statementMetavariableNodeQuery,
155
+ specificNodeQuery: statementNodeQuery,
156
+ run: (generalStatementMetavariableNode, specificStatementNode, generalContext, specificContext) => {
157
+ let success = false;
158
+
159
+ const statementNode = specificStatementNode, ///
160
+ metavariableNode = generalStatementMetavariableNode, ///
161
+ metavariableName = metavariableNode.getMetavariableName();
162
+
163
+ let context;
164
+
165
+ context = generalContext; ///
166
+
167
+ const metavariable = context.findMetavariableByMetavariableName(metavariableName);
168
+
169
+ context = specificContext; ///
170
+
171
+ const statement = context.findStatementByStatementNode(statementNode),
172
+ substitution = null,
173
+ statementUnifies = metavariable.unifyStatement(statement, substitution, generalContext, specificContext);
174
+
175
+ if (statementUnifies) {
176
+ success = true;
177
+ }
178
+
179
+ return success;
180
+ }
181
+ },
182
+ {
183
+ generalNodeQuery: metavariableNodeQuery,
184
+ specificNodeQuery: metavariableNodeQuery,
185
+ run: (generalMetavariableNode, specificMetavariableNode, generalContext, specificContext) => {
186
+ let success = false;
187
+
188
+ let context,
189
+ metavariableNode;
190
+
191
+ context = generalContext; ///
192
+
193
+ metavariableNode = generalMetavariableNode; ///
194
+
195
+ const metavariableName = metavariableNode.getMetavariableName(),
196
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
197
+
198
+ context = specificContext; ///
199
+
200
+ metavariableNode = specificMetavariableNode; ///
201
+
202
+ const reference = context.findReferenceByMetavariableNode(metavariableNode),
203
+ referenceUnifies = metavariable.unifyReference(reference, generalContext, specificContext);
204
+
205
+ if (referenceUnifies) {
206
+ success = true;
207
+ }
208
+
209
+ return success;
210
+ }
211
+ },
212
+ {
213
+ generalNodeQuery: termVariableNodeQuery,
214
+ specificNodeQuery: termNodeQuery,
215
+ run: (generalTermVariableNode, specificTermNode, generalContext, specificContext) => {
216
+ let success = false;
217
+
218
+ const termNode = specificTermNode, ///
219
+ variableNode = generalTermVariableNode, ///
220
+ variableIdentifier = variableNode.getVariableIdentifier();
221
+
222
+ let context;
223
+
224
+ context = generalContext; ///
225
+
226
+ const variable = context.findVariableByVariableIdentifier(variableIdentifier);
227
+
228
+ context = specificContext; ///
229
+
230
+ const term = context.findTermByTermNode(termNode),
231
+ termUnifies = variable.unifyTerm(term, generalContext, specificContext);
232
+
233
+ if (termUnifies) {
234
+ success = true;
235
+ }
236
+
237
+ return success;
238
+ }
239
+ }
240
+ ];
241
+ }
242
+
150
243
  class CombinatorPass extends ZipPass {
151
244
  static maps = [
152
245
  {
@@ -307,7 +400,7 @@ class MetavariablePass extends ZipPass {
307
400
  class SubstitutionPass extends ZipPass {
308
401
  static maps = [
309
402
  {
310
- generalNodeQuery: frameAMetavariableNodeQuery,
403
+ generalNodeQuery: frameMetavariableNodeQuery,
311
404
  specificNodeQuery: frameNodeQuery,
312
405
  run: (generalFrameMetavariableNode, specificFrameNode, generalContext, specificContext) => {
313
406
  let success = false;
@@ -399,6 +492,7 @@ class IntrinsicLevelPass extends ZipPass {
399
492
  }
400
493
 
401
494
  const metaLevelPass = new MetaLevelPass(),
495
+ assumptionPass = new AssumptionPass(),
402
496
  combinatorPass = new CombinatorPass(),
403
497
  constructorPass = new ConstructorPass(),
404
498
  metavariablePass = new MetavariablePass(),
@@ -421,14 +515,30 @@ export function unifyStatement(generalStatement, specificStatement, generalConte
421
515
  return statementUnifies;
422
516
  }
423
517
 
518
+ export function unifyAssumption(generalAssumption, specificAssumption, generalContext, specificContext) {
519
+ let assumptionUnifies = false;
520
+
521
+ const generalAssumptionNode = generalAssumption.getNode(),
522
+ specificAssumptionNode = specificAssumption.getNode(),
523
+ generalNode = generalAssumptionNode, ///
524
+ specificNode = specificAssumptionNode, ///
525
+ success = assumptionPass.run(generalNode, specificNode, generalContext, specificContext);
526
+
527
+ if (success) {
528
+ assumptionUnifies = true;
529
+ }
530
+
531
+ return assumptionUnifies;
532
+ }
533
+
424
534
  export function unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext) {
425
535
  let substitutionUnifies = false;
426
536
 
427
537
  const generalSubstitutionNode = generalSubstitution.getNode(),
428
- specificSubstitutionNode = specificSubstitution.getNode(),
429
- generalNode = generalSubstitutionNode, ///
430
- specificNode = specificSubstitutionNode, ///
431
- success = substitutionPass.run(generalNode, specificNode, generalContext, specificContext);
538
+ specificSubstitutionNode = specificSubstitution.getNode(),
539
+ generalNode = generalSubstitutionNode, ///
540
+ specificNode = specificSubstitutionNode, ///
541
+ success = substitutionPass.run(generalNode, specificNode, generalContext, specificContext);
432
542
 
433
543
  if (success) {
434
544
  substitutionUnifies = true;
package/src/ruleNames.js CHANGED
@@ -78,7 +78,6 @@ export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
78
78
  export const COMBINATOR_DECLARATION_RULE_NAME = "combinatorDeclaration";
79
79
  export const STATEMENT_SUBSTITUTION_RULE_NAME = "statementSubstitution";
80
80
  export const REFERENCE_SUBSTITUTION_RULE_NAME = "referenceSubstitution";
81
- export const META_LEVEL_SUBSTITUTION_RULE_NAME = "metaLevelSubstitution";
82
81
  export const TYPE_PREFIX_DECLARATION_RULE_NAME = "typePrefixDeclaration";
83
82
  export const SIMPLE_TYPE_DECLARATION_RULE_NAME = "simpleTypeDeclaration";
84
83
  export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
@@ -90,22 +90,6 @@ export function nominally(innerFunction) {
90
90
  return innerFunction(context);
91
91
  }
92
92
 
93
- export function simplify(innerFunction, context) {
94
- let contextExtraneousContext = isContextExtraneousContext(context);
95
-
96
- while (contextExtraneousContext) {
97
- context = context.getContext();
98
-
99
- contextExtraneousContext = isContextExtraneousContext(context);
100
- }
101
-
102
- const ephemeralContext = EphemeralContext.fromNothing(context);
103
-
104
- context = ephemeralContext; ///
105
-
106
- return innerFunction(context);
107
- }
108
-
109
93
  export function serialise(innerFunction, context) {
110
94
  const ephemeralContext = context, ///
111
95
  ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
@@ -124,14 +108,14 @@ export function unserialise(innerFunction, json, context) {
124
108
  return innerFunction(json, context);
125
109
  }
126
110
 
127
- export async function asyncRestrict(innerFunction, metaLevelSubstitutions, context) {
111
+ export async function asyncRestrict(innerFunction, assumptions, context) {
128
112
  if (context === undefined) {
129
- context = metaLevelSubstitutions; ///
113
+ context = assumptions; ///
130
114
 
131
- metaLevelSubstitutions = null;
115
+ assumptions = null;
132
116
  }
133
117
 
134
- const proofContext = ProofContext.fromMetaLevelSubstitutions(metaLevelSubstitutions, context);
118
+ const proofContext = ProofContext.fromAssumptions(assumptions, context);
135
119
 
136
120
  context = proofContext; ///
137
121
 
@@ -145,16 +129,3 @@ export async function asyncReconcile(innerFunction, context) {
145
129
 
146
130
  return await innerFunction(context);
147
131
  }
148
-
149
- function isContextExtraneousContext(context) {
150
- const contextLiminalContext = (context instanceof LiminalContext),
151
- contextEphemeralContext = (context instanceof EphemeralContext),
152
- contextBranchingContext = (context instanceof BranchingContext),
153
- contextSyntheticContext = (context instanceof SyntheticContext),
154
- contextExtraneousContext = ( contextLiminalContext
155
- || contextEphemeralContext
156
- || contextBranchingContext
157
- || contextSyntheticContext );
158
-
159
- return contextExtraneousContext;
160
- }
@@ -3,8 +3,6 @@
3
3
  import elements from "../elements";
4
4
 
5
5
  import { baseTypeFromNothing } from "../utilities/type";
6
- import { simplify, instantiate,} from "../utilities/context";
7
- import { instantiateLabel, instantiateReference } from "../process/instantiate";
8
6
  import { equivalenceStringFromTerms,
9
7
  typeStringFromNominalTypeName,
10
8
  rulsStringFromLabelsPremisesAndConclusion,
@@ -348,11 +346,11 @@ export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
348
346
  label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
349
347
  deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
350
348
  suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
351
- metaLevelSubstitutions = metaLevelSubstitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
349
+ assumptions = assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
352
350
  topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
353
351
  node = metaLemmaMetathoremNode, ///
354
352
  string = topLevelMetaAssertionString, ///
355
- metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof, metaLevelSubstitutions);
353
+ metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof, assumptions);
356
354
 
357
355
  return metaLemma;
358
356
  }
@@ -437,20 +435,6 @@ export function conclusionFromConclusionNode(conclusionNode, context) {
437
435
  return conclusion;
438
436
  }
439
437
 
440
- export function assumptionFromAssumptionNode(assumptionNode, context) {
441
- const { Assumption } = elements,
442
- node = assumptionNode, ///
443
- string = context.nodeAsString(node),
444
- reference = referenceFromAssumptionNode(assumptionNode, context),
445
- statement = statementFromAssumptionNode(assumptionNode, context);
446
-
447
- context = null;
448
-
449
- const assumption = new Assumption(context, string, node, reference, statement);
450
-
451
- return assumption;
452
- }
453
-
454
438
  export function derivationFromDerivationNode(derivationNode, context) {
455
439
  const { Derivation } = elements,
456
440
  node = derivationNode, ///
@@ -478,6 +462,20 @@ export function typePrefixFromTypePrefixNode(typePrefixNode, context) {
478
462
  return typePrefix;
479
463
  }
480
464
 
465
+ export function assumptionFromAssumptionNode(assumptionNode, context) {
466
+ const { Assumption } = elements,
467
+ node = assumptionNode, ///
468
+ string = context.nodeAsString(node),
469
+ reference = referenceFromAssumptionNode(assumptionNode, context),
470
+ statement = statementFromAssumptionNode(assumptionNode, context);
471
+
472
+ context = null;
473
+
474
+ const assumption = new Assumption(context, string, node, reference, statement);
475
+
476
+ return assumption;
477
+ }
478
+
481
479
  export function constructorFromConstructorNode(constructorNode, context) {
482
480
  const { Constructor } = elements,
483
481
  node = constructorNode, ///
@@ -525,11 +523,11 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
525
523
  label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
526
524
  deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
527
525
  suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
528
- metaLevelSubstitutions = metaLevelSubstitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
526
+ assumptions = assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
529
527
  topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
530
528
  node = metaLemmaMetathoremNode, ///
531
529
  string = topLevelMetaAssertionString, ///
532
- metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof, metaLevelSubstitutions);
530
+ metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof, assumptions);
533
531
 
534
532
  return metatheorem;
535
533
  }
@@ -788,21 +786,6 @@ export function statementSubstitutionFromStatementSubstitutionNode(statementSubs
788
786
  return statementSubstitution;
789
787
  }
790
788
 
791
- export function metaLevelSubstitutionFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
792
- const { MetaLevelSubstitution } = elements,
793
- node = metaLevelSubstitutionNode, ///
794
- string = context.nodeAsString(node),
795
- targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
796
- replacementStatement = replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
797
- ephemeralContext = context.retrieveEphemeralContext();
798
-
799
- context = ephemeralContext; ///
800
-
801
- const metaLevelSubstitution = new MetaLevelSubstitution(context, string, node, targetReference, replacementStatement);
802
-
803
- return metaLevelSubstitution;
804
- }
805
-
806
789
  export function constructorDeclarationFromConstructorDeclarationNode(constructorDeclarationNode, context) {
807
790
  const { ConstructorDeclaration } = elements,
808
791
  node = constructorDeclarationNode, ///
@@ -937,9 +920,10 @@ export function referenceFromStepNode(stepNode, context) {
937
920
  const referenceNode = stepNode.getReferenceNode();
938
921
 
939
922
  if (referenceNode !== null) {
940
- const referenceString = context.nodeAsString(referenceNode);
923
+ const { Reference } = elements,
924
+ referenceString = context.nodeAsString(referenceNode);
941
925
 
942
- reference = referenceFromReferenceString(referenceString, context);
926
+ reference = Reference.fromReferenceString(referenceString, context);
943
927
  }
944
928
 
945
929
  return reference;
@@ -1361,9 +1345,10 @@ export function metavariableFromReferenceNode(referenceNode, context) {
1361
1345
  }
1362
1346
 
1363
1347
  export function referenceFromMetavariableNode(metavariableNode, context) {
1364
- const metavariableString = context.nodeAsString(metavariableNode),
1348
+ const { Reference } = elements,
1349
+ metavariableString = context.nodeAsString(metavariableNode),
1365
1350
  referenceString = metavariableString, ///
1366
- reference = referenceFromReferenceString(referenceString, context);
1351
+ reference = Reference.fromReferenceString(referenceString, context);
1367
1352
 
1368
1353
  return reference;
1369
1354
  }
@@ -1601,9 +1586,10 @@ export function proofFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, cont
1601
1586
  }
1602
1587
 
1603
1588
  export function labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
1604
- const labelNode = metaLemmaMetathoremNode.getLabelNode(),
1589
+ const { Label } = elements,
1590
+ labelNode = metaLemmaMetathoremNode.getLabelNode(),
1605
1591
  labelString = context.nodeAsString(labelNode),
1606
- label = labelFromLabelString(labelString, context);
1592
+ label = Label.fromLabelString(labelString, context);
1607
1593
 
1608
1594
  return label;
1609
1595
  }
@@ -1724,9 +1710,10 @@ export function signatureFromJSatisfiesAssertionNode(sasisfiesAssertionNode, con
1724
1710
  }
1725
1711
 
1726
1712
  export function referenceFromJSatisfiesAssertionNode(sasisfiesAssertionNode, context) {
1727
- const referenceNode = sasisfiesAssertionNode.getReferenceNode(),
1713
+ const { Reference } = elements,
1714
+ referenceNode = sasisfiesAssertionNode.getReferenceNode(),
1728
1715
  referenceString = context.nodeAsString(referenceNode),
1729
- reference = referenceFromReferenceString(referenceString, context);
1716
+ reference = Reference.fromReferenceString(referenceString, context);
1730
1717
 
1731
1718
  return reference;
1732
1719
  }
@@ -1813,6 +1800,12 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
1813
1800
  return metaType;
1814
1801
  }
1815
1802
 
1803
+ export function assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
1804
+ const assumptions = [];
1805
+
1806
+ return assumptions;
1807
+ }
1808
+
1816
1809
  export function provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
1817
1810
  const provisional = simpleTypeDeclarationNode.isProvisional();
1818
1811
 
@@ -1889,19 +1882,12 @@ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarat
1889
1882
  }
1890
1883
 
1891
1884
  export function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
1892
- const targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
1893
- targetReferenceString = context.nodeAsString(targetReferenceNode),
1894
- targetRefernece = referenceFromReferenceString(targetReferenceString, context);
1895
-
1896
- return targetRefernece;
1897
- }
1898
-
1899
- export function targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
1900
- const targetReferenceNode = metaLevelSubstitutionNode.getTargetReferenceNode(),
1885
+ const { Reference } = elements,
1886
+ targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
1901
1887
  targetReferenceString = context.nodeAsString(targetReferenceNode),
1902
- targetRefernece = referenceFromReferenceString(targetReferenceString, context);
1888
+ targetReference = Reference.fromReferenceString(targetReferenceString, context);
1903
1889
 
1904
- return targetRefernece;
1890
+ return targetReference;
1905
1891
  }
1906
1892
 
1907
1893
  export function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context) {
@@ -1936,9 +1922,10 @@ export function frameSubstitutionFromStatementSubstitutionNode(statementSubstitu
1936
1922
  }
1937
1923
 
1938
1924
  export function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
1939
- const replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
1925
+ const { Reference } = elements,
1926
+ replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
1940
1927
  replacementReferenceString = context.nodeAsString(replacementReferenceNode),
1941
- replacementReference = referenceFromReferenceString(replacementReferenceString, context);
1928
+ replacementReference = Reference.fromReferenceString(replacementReferenceString, context);
1942
1929
 
1943
1930
  return replacementReference;
1944
1931
  }
@@ -1950,19 +1937,6 @@ export function replacementStatementFromStatementSubstitutionNode(statementSubst
1950
1937
  return replacementStatement;
1951
1938
  }
1952
1939
 
1953
- export function replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
1954
- const replacementStatementNode = metaLevelSubstitutionNode.getReplacementStatementNode(),
1955
- replacementStatement = statementFromStatementNode(replacementStatementNode, context);
1956
-
1957
- return replacementStatement;
1958
- }
1959
-
1960
- export function metaLevelSubstitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
1961
- const metaLevelSubstitutions = [];
1962
-
1963
- return metaLevelSubstitutions;
1964
- }
1965
-
1966
1940
  export function termsFromTermNodes(termNodes, context) {
1967
1941
  const terms = termNodes.map((termNode) => {
1968
1942
  const term = termFromTermNode(termNode, context);
@@ -1986,8 +1960,9 @@ export function typesFromTypesNode(typesNode, context) {
1986
1960
 
1987
1961
  export function labelsFromLabelNodes(labelNodes, context) {
1988
1962
  const labels = labelNodes.map((labelNode) => {
1989
- const labelString = context.nodeAsString(labelNode),
1990
- label = labelFromLabelString(labelString, context);
1963
+ const { Label } = elements,
1964
+ labelString = context.nodeAsString(labelNode),
1965
+ label = Label.fromLabelString(labelString, context);
1991
1966
 
1992
1967
  return label;
1993
1968
  });
@@ -2076,33 +2051,3 @@ export function stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context
2076
2051
 
2077
2052
  return stepsOrSubproofs;
2078
2053
  }
2079
-
2080
- export function labelFromLabelString(labelString, context) {
2081
- let label;
2082
-
2083
- simplify((context) => {
2084
- instantiate((context) => {
2085
- const string = labelString, ///
2086
- labelNode = instantiateLabel(string, context);
2087
-
2088
- label = labelFromLabelNode(labelNode, context);
2089
- }, context);
2090
- }, context);
2091
-
2092
- return label;
2093
- }
2094
-
2095
- export function referenceFromReferenceString(referenceString, context) {
2096
- let reference;
2097
-
2098
- simplify((context) => {
2099
- instantiate((context) => {
2100
- const string = referenceString, ///
2101
- referenceNode = instantiateReference(string, context);
2102
-
2103
- reference = referenceFromReferenceNode(referenceNode, context);
2104
- }, context);
2105
- }, context);
2106
-
2107
- return reference;
2108
- }