occam-verify-cli 1.0.651 → 1.0.655

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 (95) hide show
  1. package/lib/context/ephemeral.js +42 -1
  2. package/lib/context/file/nominal.js +23 -4
  3. package/lib/element/assertion/contained.js +24 -1
  4. package/lib/element/assertion/defined.js +24 -1
  5. package/lib/element/assertion/property.js +24 -1
  6. package/lib/element/assertion/satisfies.js +24 -1
  7. package/lib/element/assertion/subproof.js +37 -1
  8. package/lib/element/assertion/type.js +27 -1
  9. package/lib/element/assumption.js +2 -7
  10. package/lib/element/combinator.js +16 -3
  11. package/lib/element/conclusion.js +18 -3
  12. package/lib/element/constructor.js +8 -2
  13. package/lib/element/declaration/complexType.js +52 -52
  14. package/lib/element/declaration/constructor.js +38 -38
  15. package/lib/element/declaration/metavariable.js +35 -35
  16. package/lib/element/declaration/simpleType.js +42 -42
  17. package/lib/element/declaration/typePrefix.js +32 -32
  18. package/lib/element/declaration/variable.js +39 -39
  19. package/lib/element/deduction.js +2 -4
  20. package/lib/element/equivalences.js +3 -3
  21. package/lib/element/frame.js +2 -9
  22. package/lib/element/hypothesis.js +18 -24
  23. package/lib/element/label.js +14 -3
  24. package/lib/element/metavariable.js +10 -3
  25. package/lib/element/parameter.js +2 -3
  26. package/lib/element/procedureCall.js +2 -3
  27. package/lib/element/procedureReference.js +2 -3
  28. package/lib/element/proofAssertion/premise.js +54 -49
  29. package/lib/element/proofAssertion/step.js +86 -86
  30. package/lib/element/proofAssertion/supposition.js +39 -49
  31. package/lib/element/property.js +2 -3
  32. package/lib/element/reference.js +2 -3
  33. package/lib/element/rule.js +2 -4
  34. package/lib/element/section.js +14 -14
  35. package/lib/element/signature.js +2 -3
  36. package/lib/element/statement.js +8 -2
  37. package/lib/element/subproof.js +8 -8
  38. package/lib/element/substitution/statement.js +2 -2
  39. package/lib/element/term.js +15 -29
  40. package/lib/element/topLevelAssertion/axiom.js +63 -63
  41. package/lib/element/topLevelMetaAssertion.js +15 -15
  42. package/lib/element/type.js +2 -3
  43. package/lib/element/typePrefix.js +2 -3
  44. package/lib/element/variable.js +2 -2
  45. package/lib/process/instantiate.js +38 -2
  46. package/lib/utilities/equivalence.js +27 -0
  47. package/lib/utilities/json.js +197 -30
  48. package/package.json +1 -1
  49. package/src/context/ephemeral.js +84 -0
  50. package/src/context/file/nominal.js +38 -18
  51. package/src/element/assertion/contained.js +25 -0
  52. package/src/element/assertion/defined.js +25 -0
  53. package/src/element/assertion/property.js +25 -0
  54. package/src/element/assertion/satisfies.js +25 -0
  55. package/src/element/assertion/subproof.js +46 -0
  56. package/src/element/assertion/type.js +32 -0
  57. package/src/element/assumption.js +1 -12
  58. package/src/element/combinator.js +33 -3
  59. package/src/element/conclusion.js +33 -3
  60. package/src/element/constructor.js +17 -4
  61. package/src/element/declaration/complexType.js +49 -49
  62. package/src/element/declaration/constructor.js +32 -32
  63. package/src/element/declaration/metavariable.js +26 -26
  64. package/src/element/declaration/simpleType.js +34 -34
  65. package/src/element/declaration/typePrefix.js +35 -35
  66. package/src/element/declaration/variable.js +30 -30
  67. package/src/element/deduction.js +1 -6
  68. package/src/element/equivalences.js +1 -1
  69. package/src/element/frame.js +1 -15
  70. package/src/element/hypothesis.js +23 -34
  71. package/src/element/label.js +22 -5
  72. package/src/element/metavariable.js +20 -2
  73. package/src/element/parameter.js +1 -6
  74. package/src/element/procedureCall.js +1 -7
  75. package/src/element/procedureReference.js +1 -6
  76. package/src/element/proofAssertion/premise.js +54 -39
  77. package/src/element/proofAssertion/step.js +62 -62
  78. package/src/element/proofAssertion/supposition.js +27 -44
  79. package/src/element/property.js +1 -6
  80. package/src/element/reference.js +1 -6
  81. package/src/element/rule.js +3 -11
  82. package/src/element/section.js +12 -12
  83. package/src/element/signature.js +1 -7
  84. package/src/element/statement.js +13 -1
  85. package/src/element/subproof.js +6 -6
  86. package/src/element/substitution/statement.js +1 -1
  87. package/src/element/term.js +16 -24
  88. package/src/element/topLevelAssertion/axiom.js +45 -45
  89. package/src/element/topLevelMetaAssertion.js +19 -19
  90. package/src/element/type.js +1 -10
  91. package/src/element/typePrefix.js +1 -6
  92. package/src/element/variable.js +1 -1
  93. package/src/process/instantiate.js +26 -2
  94. package/src/utilities/equivalence.js +26 -0
  95. package/src/utilities/json.js +233 -37
@@ -2,6 +2,25 @@
2
2
 
3
3
  import Context from "../context";
4
4
 
5
+ import { termsFromJSON,
6
+ framesFromJSON,
7
+ termsToTermsJSON,
8
+ framesToFramesJSON,
9
+ judgementsFromJSON,
10
+ equalitiesFromJSON,
11
+ statementsFromJSON,
12
+ assertionsFromJSON,
13
+ referencesFromJSON,
14
+ assumptionsFromJSON,
15
+ substitutionsFromJSON,
16
+ judgementsToJudgementsJSON,
17
+ equalitiesToEqualitiesJSON,
18
+ statementsToStatementsJSON,
19
+ assertionsToAssertionsJSON,
20
+ referencesToReferencesJSON,
21
+ assumptionsToAssumptionsJSON,
22
+ substitutionsToCSubstitutionsJSON } from "../utilities/json";
23
+
5
24
  export default class EphemeralContext extends Context {
6
25
  constructor(context, terms, frames, judgements, equalities, assertions, statements, references, assumptions, substitutions) {
7
26
  super(context);
@@ -449,6 +468,71 @@ export default class EphemeralContext extends Context {
449
468
  return substitutionPresent;
450
469
  }
451
470
 
471
+ initialise(json) {
472
+ const context = this; ///
473
+
474
+ this.terms = termsFromJSON(json, context);
475
+ this.frames = framesFromJSON(json, context);
476
+ this.judgements = judgementsFromJSON(json, context);
477
+ this.equalities = equalitiesFromJSON(json, context);
478
+ this.statements = statementsFromJSON(json, context);
479
+ this.assertions = assertionsFromJSON(json, context);
480
+ this.references = referencesFromJSON(json, context);
481
+ this.assumptions = assumptionsFromJSON(json, context);
482
+ this.substitutions = substitutionsFromJSON(json, context);
483
+ }
484
+
485
+ toJSON() {
486
+ const termsJSON = termsToTermsJSON(this.terms),
487
+ framesJSON = framesToFramesJSON(this.frames),
488
+ judgementsJSON = judgementsToJudgementsJSON(this.judgements),
489
+ equalitiesJSON = equalitiesToEqualitiesJSON(this.equalities),
490
+ statementsJSON = statementsToStatementsJSON(this.statements),
491
+ assertionsJSON = assertionsToAssertionsJSON(this.assertions),
492
+ referencesJSON = referencesToReferencesJSON(this.references),
493
+ assumptionsJSON = assumptionsToAssumptionsJSON(this.assumptions),
494
+ substitutionsJSON = substitutionsToCSubstitutionsJSON(this.substitutions),
495
+ terms = termsJSON, ///
496
+ frames = framesJSON, ///
497
+ judgements = judgementsJSON, ///
498
+ equalities = equalitiesJSON, ///
499
+ statements = statementsJSON, ///
500
+ assertions = assertionsJSON, ///
501
+ references = referencesJSON, ///
502
+ assumptions = assumptionsJSON, ///
503
+ substitutions = substitutionsJSON, ///
504
+ json = {
505
+ terms,
506
+ frames,
507
+ judgements,
508
+ equalities,
509
+ statements,
510
+ assertions,
511
+ references,
512
+ assumptions,
513
+ substitutions
514
+ };
515
+
516
+ return json;
517
+ }
518
+
519
+ static fromJSON(json, context) {
520
+ const terms = null,
521
+ frames = null,
522
+ judgements = null,
523
+ equalities = null,
524
+ statements = null,
525
+ assertions = null,
526
+ references = null,
527
+ assumptions = null,
528
+ substitutions = null,
529
+ emphemeralContext = new EphemeralContext(context, terms, frames, judgements, equalities, assertions, statements, references, assumptions, substitutions);
530
+
531
+ emphemeralContext.initialise(json);
532
+
533
+ return emphemeralContext;
534
+ }
535
+
452
536
  static fromNothing(context) {
453
537
  const terms = [],
454
538
  frames = [],
@@ -831,6 +831,28 @@ export default class NominalFileContext extends FileContext {
831
831
  return fileVerifies;
832
832
  }
833
833
 
834
+ initialise(json) {
835
+ const fileContext = this; ///
836
+
837
+ this.types = [];
838
+
839
+ typesFromJSON(json, this.types, fileContext);
840
+
841
+ this.lemmas = lemmasFromNothing();
842
+ this.metaLemmas = metaLemmasFromNothing();
843
+
844
+ this.metavariables = metavariablesFromJSON(json, fileContext);
845
+ this.variables = variablesFromJSON(json, fileContext);
846
+ this.rules = rulesFromJSON(json, fileContext);
847
+ this.axioms = axiomsFromJSON(json, fileContext);
848
+ this.theorems = theoremsFromJSON(json, fileContext);
849
+ this.conjectures = conjecturesFromJSON(json, fileContext);
850
+ this.combinators = combinatorsFromJSON(json, fileContext);
851
+ this.typePrefixes = typePrefixesFromJSON(json, fileContext);
852
+ this.constructors = constructorsFromJSON(json, fileContext);
853
+ this.metatheorems = metatheoremsFromJSON(json, fileContext);
854
+ }
855
+
834
856
  toJSON() {
835
857
  const typesJSON = typesToTypesJSON(this.types),
836
858
  rulesJSON = rulesToRulesJSON(this.rules),
@@ -899,31 +921,29 @@ export default class NominalFileContext extends FileContext {
899
921
  }
900
922
 
901
923
  static fromJSON(json, context) {
902
- const fileContext = this, ///
903
- releaseContext = context, ///
924
+ const releaseContext = context, ///
904
925
  combinedCustomGrammar = releaseContext.getCombinedCustomGrammar(),
905
926
  nominalLexer = nominalLexerFromCombinedCustomGrammar(NominalLexer, combinedCustomGrammar),
906
927
  nominalParser = nominalParserFromCombinedCustomGrammar(NominalParser, combinedCustomGrammar),
907
928
  lexer = nominalLexer, ///
908
929
  parser = nominalParser, ///
909
- types = [];
910
-
911
- typesFromJSON(json, types, fileContext);
912
-
913
- const rules = rulesFromJSON(json, fileContext),
914
- axioms = axiomsFromJSON(json, fileContext),
915
- lemmas = lemmasFromNothing(),
916
- theorems = theoremsFromJSON(json, fileContext),
917
- variables = variablesFromJSON(json, fileContext),
918
- metaLemmas = metaLemmasFromNothing(),
919
- conjectures = conjecturesFromJSON(json, fileContext),
920
- combinators = combinatorsFromJSON(json, fileContext),
921
- typePrefixes = typePrefixesFromJSON(json, fileContext),
922
- constructors = constructorsFromJSON(json, fileContext),
923
- metatheorems = metatheoremsFromJSON(json, fileContext),
924
- metavariables = metavariablesFromJSON(json, fileContext),
930
+ types = null,
931
+ rules = null,
932
+ axioms = null,
933
+ lemmas = null,
934
+ theorems = null,
935
+ variables = null,
936
+ metaLemmas = null,
937
+ conjectures = null,
938
+ combinators = null,
939
+ typePrefixes = null,
940
+ constructors = null,
941
+ metatheorems = null,
942
+ metavariables = null,
925
943
  nominalFileContext = FileContext.fromJSON(NominalFileContext, json, lexer, parser, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typePrefixes, constructors, metatheorems, metavariables, context);
926
944
 
945
+ nominalFileContext.initialise(json);
946
+
927
947
  return nominalFileContext;
928
948
  }
929
949
  }
@@ -236,7 +236,32 @@ export default define(class ContainedAssertion extends Assertion {
236
236
  return unifiesIndependently;
237
237
  }
238
238
 
239
+ toJSON() {
240
+ debugger
241
+
242
+ const { name } = this.constructor,
243
+ string = this.getString(),
244
+ json = {
245
+ name,
246
+ string
247
+ };
248
+
249
+ return json;
250
+ }
251
+
239
252
  static name = "ContainedAssertion";
253
+
254
+ static fromJSON(json, context) {
255
+ let containedAssertion = null;
256
+
257
+ const { name } = json;
258
+
259
+ if (this.name === name) {
260
+ debugger
261
+ }
262
+
263
+ return containedAssertion;
264
+ }
240
265
  });
241
266
 
242
267
  function validateWhenDerived(term, frame, statement, negated, generalContext, specificContext) {
@@ -205,7 +205,32 @@ export default define(class DefinedAssertion extends Assertion {
205
205
  return unifiesIndependently;
206
206
  }
207
207
 
208
+ toJSON() {
209
+ debugger
210
+
211
+ const { name } = this.constructor,
212
+ string = this.getString(),
213
+ json = {
214
+ name,
215
+ string
216
+ };
217
+
218
+ return json;
219
+ }
220
+
208
221
  static name = "DefinedAssertion";
222
+
223
+ static fromJSON(json, context) {
224
+ let definedAssertion = null;
225
+
226
+ const { name } = json;
227
+
228
+ if (this.name === name) {
229
+ debugger
230
+ }
231
+
232
+ return definedAssertion;
233
+ }
209
234
  });
210
235
 
211
236
  function validateWhenDerived(term, frame, negated, generalContext, specificContext) {
@@ -193,5 +193,30 @@ export default define(class PropertyAssertion extends Assertion {
193
193
  context.addAssignment(assignment);
194
194
  }
195
195
 
196
+ toJSON() {
197
+ debugger
198
+
199
+ const { name } = this.constructor,
200
+ string = this.getString(),
201
+ json = {
202
+ name,
203
+ string
204
+ };
205
+
206
+ return json;
207
+ }
208
+
196
209
  static name = "PropertyAssertion";
210
+
211
+ static fromJSON(json, context) {
212
+ let proopertyAssertion = null;
213
+
214
+ const { name } = json;
215
+
216
+ if (this.name === name) {
217
+ debugger
218
+ }
219
+
220
+ return proopertyAssertion;
221
+ }
197
222
  });
@@ -154,5 +154,30 @@ export default define(class SatisfiesAssertion extends Assertion {
154
154
  return statementUnifies;
155
155
  }
156
156
 
157
+ toJSON() {
158
+ debugger
159
+
160
+ const { name } = this.constructor,
161
+ string = this.getString(),
162
+ json = {
163
+ name,
164
+ string
165
+ };
166
+
167
+ return json;
168
+ }
169
+
157
170
  static name = "SatisfiesAssertion";
171
+
172
+ static fromJSON(json, context) {
173
+ let satisfiesAssertion = null;
174
+
175
+ const { name } = json;
176
+
177
+ if (this.name === name) {
178
+ debugger
179
+ }
180
+
181
+ return satisfiesAssertion;
182
+ }
158
183
  });
@@ -5,7 +5,10 @@ import { arrayUtilities } from "necessary";
5
5
  import Assertion from "../assertion";
6
6
 
7
7
  import { define } from "../../elements";
8
+ import { literally } from "../../utilities/context";
8
9
  import { unifyStatement } from "../../process/unify";
10
+ import { statementsToStatementsJSON } from "../../utilities/json";
11
+ import { instantiateSubproofAssertion } from "../../process/instantiate";
9
12
 
10
13
  const { match } = arrayUtilities;
11
14
 
@@ -111,6 +114,49 @@ export default define(class SubproofAssertion extends Assertion {
111
114
  return subproofUnifies;
112
115
  }
113
116
 
117
+ toJSON() {
118
+ const { name } = this.constructor,
119
+ statementJSON = statementsToStatementsJSON(this.statements),
120
+ statements = statementJSON, ///
121
+ string = this.getString(),
122
+ json = {
123
+ name,
124
+ string,
125
+ statements
126
+ };
127
+
128
+ return json;
129
+ }
130
+
114
131
  static name = "SubproofAssertion";
132
+
133
+ static fromJSON(json, context) {
134
+ let subproorAssertion = null;
135
+
136
+ const { name } = json;
137
+
138
+ if (this.name === name) {
139
+ subproorAssertion = literally((context) => {
140
+ const { string } = json,
141
+ subproofAssertionNode = instantiateSubproofAssertion(string, context),
142
+ statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
143
+ node = subproofAssertionNode; ///
144
+
145
+ subproorAssertion = new SubproofAssertion(context, string, node, statements);
146
+ }, context);
147
+ }
148
+
149
+ return subproorAssertion;
150
+ }
115
151
  });
116
152
 
153
+ function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
154
+ const statementNodes = subproofAssertionNode.getStatementNodes(),
155
+ statements = statementNodes.map((statemetNode) => {
156
+ const statement = context.findStatementByStatementNode(statemetNode);
157
+
158
+ return statement;
159
+ });
160
+
161
+ return statements;
162
+ }
@@ -4,6 +4,7 @@ import Assertion from "../assertion";
4
4
 
5
5
  import { define } from "../../elements";
6
6
  import { variableAssignmentFromTypeAssertion } from "../../process/assign";
7
+ import {termToTermJSON} from "../../utilities/json";
7
8
 
8
9
  export default define(class TypeAssertion extends Assertion {
9
10
  constructor(context, string, node, term, type) {
@@ -188,5 +189,36 @@ export default define(class TypeAssertion extends Assertion {
188
189
  }
189
190
  }
190
191
 
192
+ toJSON() {
193
+ debugger
194
+
195
+ const { name } = this.constructor,
196
+ termJSON = termToTermJSON(this.term),
197
+ typeJSON = typeToTypeJSON(this.type),
198
+ term = termJSON, ///
199
+ type = typeJSON, ///
200
+ string = this.getString(),
201
+ json = {
202
+ name,
203
+ term,
204
+ type,
205
+ string
206
+ };
207
+
208
+ return json;
209
+ }
210
+
191
211
  static name = "TypeAssertion";
212
+
213
+ static fromJSON(json, context) {
214
+ let typeAssertion = null;
215
+
216
+ const { name } = json;
217
+
218
+ if (this.name === name) {
219
+ debugger
220
+ }
221
+
222
+ return typeAssertion;
223
+ }
192
224
  });
@@ -336,17 +336,6 @@ export default define(class Assumption extends Element {
336
336
  static name = "Assumption";
337
337
 
338
338
  static fromJSON(json, context) {
339
- let assumption = null;
340
-
341
- if (json !== null) {
342
- const string = null,
343
- node = null,
344
- statement = null,
345
- reference = referenceFromJSON(json, context);
346
-
347
- assumption = new Assumption(string, node, statement, reference)
348
- }
349
-
350
- return assumption;
339
+ debugger
351
340
  }
352
341
  });
@@ -3,10 +3,16 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { attempt } from "../utilities/context";
6
+ import { attempt, literally } from "../utilities/context";
7
+ import { instantiateCombinator } from "../process/instantiate";
7
8
  import { verifyStatementAsCombinator } from "../process/verify";
8
9
  import { unifyStatementWithCombinator } from "../process/unify";
9
- import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
10
+ import {
11
+ statementFromJSON,
12
+ ephemeralContextFromJSON,
13
+ statementToStatementJSON,
14
+ procedureCallToProcedureCallJSON
15
+ } from "../utilities/json";
10
16
 
11
17
  export default define(class Combinator extends Element {
12
18
  constructor(context, string, node, statement) {
@@ -79,9 +85,20 @@ export default define(class Combinator extends Element {
79
85
  }
80
86
 
81
87
  toJSON() {
88
+ let context;
89
+
90
+ context = this.getContext();
91
+
92
+ const contextJSON = context.toJSON();
93
+
94
+ context = contextJSON; ///
95
+
82
96
  const statementJSON = statementToStatementJSON(this.statement),
83
97
  statement = statementJSON, ///
98
+ string = this.getString(),
84
99
  json = {
100
+ context,
101
+ string,
85
102
  statement
86
103
  };
87
104
 
@@ -91,7 +108,20 @@ export default define(class Combinator extends Element {
91
108
  static name = "Combinator";
92
109
 
93
110
  static fromJSON(json, context) {
94
- debugger
111
+ const combinator = literally((context) => {
112
+ const { string } = json,
113
+ combinatorNode = instantiateCombinator(string, context),
114
+ node = combinatorNode, ///
115
+ statement = statementFromJSON(json, context),
116
+ ephemeralContext = ephemeralContextFromJSON(json, context);
117
+
118
+ context = ephemeralContext; ///
119
+
120
+ const combinator = new Combinator(context, string, node, statement);
121
+
122
+ return combinator;
123
+ }, context);
95
124
 
125
+ return combinator;
96
126
  }
97
127
  });
@@ -3,8 +3,9 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { attempt } from "../utilities/context";
7
- import { statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
6
+ import { attempt, literally } from "../utilities/context";
7
+ import { instantiateConclusion } from "../process/instantiate";
8
+ import { statementFromJSON, ephemeralContextFromJSON, statementToStatementJSON } from "../utilities/json";
8
9
 
9
10
  export default define(class Conclusion extends Element {
10
11
  constructor(context, string, node, statement) {
@@ -87,9 +88,20 @@ export default define(class Conclusion extends Element {
87
88
  }
88
89
 
89
90
  toJSON() {
91
+ let context;
92
+
93
+ context = this.getContext();
94
+
95
+ const contextJSON = context.toJSON();
96
+
97
+ context = contextJSON; ///
98
+
90
99
  const statementJSON = statementToStatementJSON(this.statement),
91
100
  statement = statementJSON, ///
101
+ string = this.getString(),
92
102
  json = {
103
+ context,
104
+ string,
93
105
  statement
94
106
  };
95
107
 
@@ -99,6 +111,24 @@ export default define(class Conclusion extends Element {
99
111
  static name = "Conclusion";
100
112
 
101
113
  static fromJSON(json, context) {
102
- debugger
114
+ const conclusion = literally((context) => {
115
+ let { string } = json;
116
+
117
+ string = `${string}
118
+ `; ///
119
+
120
+ const conclusionNode = instantiateConclusion(string, context),
121
+ node = conclusionNode, ///
122
+ statement = statementFromJSON(json, context),
123
+ ephemeralContext = ephemeralContextFromJSON(json, context);
124
+
125
+ context = ephemeralContext; ///
126
+
127
+ const conclusion = new Conclusion(context, string, node, statement);
128
+
129
+ return conclusion;
130
+ }, context);
131
+
132
+ return conclusion;
103
133
  }
104
134
  });
@@ -3,10 +3,11 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { attempt } from "../utilities/context";
6
+ import { attempt, literally } from "../utilities/context";
7
+ import { instantiateConstructor } from "../process/instantiate";
7
8
  import { verifyTermAsConstructor } from "../process/verify";
8
9
  import { unifyTermWithConstructor } from "../process/unify";
9
- import { termFromJSON, termToTermJSON } from "../utilities/json";
10
+ import { termFromJSON, termToTermJSON, ephemeralContextFromJSON } from "../utilities/json";
10
11
 
11
12
  export default define(class Constructor extends Element {
12
13
  constructor(context, string, node, term) {
@@ -124,8 +125,20 @@ export default define(class Constructor extends Element {
124
125
  static name = "Constructor";
125
126
 
126
127
  static fromJSON(json, context) {
127
- const term = termFromJSON(json, context),
128
- constructor = new Constructor(term);
128
+ const constructor = literally((context) => {
129
+ const { string } = json,
130
+ constructorNode = instantiateConstructor(string, context),
131
+ node = constructorNode, ///
132
+ term = termFromJSON(json, context),
133
+ ephemeralContext = ephemeralContextFromJSON(json, context);
134
+
135
+ context = ephemeralContext; ///
136
+
137
+ const constructor = new Constructor(context, string, node, term);
138
+
139
+ return constructor;
140
+
141
+ }, context);
129
142
 
130
143
  return constructor;
131
144
  }