occam-verify-cli 1.0.228 → 1.0.233

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 (111) hide show
  1. package/lib/context/local.js +1 -14
  2. package/lib/dom/assertion/property.js +2 -2
  3. package/lib/dom/axiom.js +25 -17
  4. package/lib/dom/combinator.js +5 -5
  5. package/lib/dom/conclusion.js +5 -5
  6. package/lib/dom/conjecture.js +9 -9
  7. package/lib/dom/constructor.js +5 -5
  8. package/lib/dom/declaration/combinator.js +14 -14
  9. package/lib/dom/declaration/complexType.js +35 -35
  10. package/lib/dom/declaration/constructor.js +19 -19
  11. package/lib/dom/declaration/metavariable.js +22 -22
  12. package/lib/dom/declaration/simpleType.js +23 -23
  13. package/lib/dom/declaration/variable.js +20 -20
  14. package/lib/dom/declaration.js +4 -2
  15. package/lib/dom/deduction.js +5 -5
  16. package/lib/dom/derivation.js +5 -5
  17. package/lib/dom/error.js +9 -9
  18. package/lib/dom/hypothesis.js +260 -0
  19. package/lib/dom/label.js +18 -24
  20. package/lib/dom/lemma.js +7 -7
  21. package/lib/dom/metaLemma.js +9 -9
  22. package/lib/dom/metaType.js +4 -10
  23. package/lib/dom/metatheorem.js +9 -9
  24. package/lib/dom/metavariable.js +7 -8
  25. package/lib/dom/parameter.js +2 -2
  26. package/lib/dom/premise.js +5 -5
  27. package/lib/dom/procedureCall.js +11 -10
  28. package/lib/dom/proof.js +3 -3
  29. package/lib/dom/property.js +9 -9
  30. package/lib/dom/reference.js +23 -22
  31. package/lib/dom/rule.js +68 -37
  32. package/lib/dom/section.js +146 -0
  33. package/lib/dom/signature.js +5 -5
  34. package/lib/dom/statement.js +25 -20
  35. package/lib/dom/step.js +9 -7
  36. package/lib/dom/subDerivation.js +5 -5
  37. package/lib/dom/subproof.js +7 -7
  38. package/lib/dom/substitution/statement.js +3 -3
  39. package/lib/dom/supposition.js +5 -5
  40. package/lib/dom/term.js +5 -6
  41. package/lib/dom/theorem.js +9 -9
  42. package/lib/dom/topLevelAssertion.js +72 -33
  43. package/lib/dom/topLevelMetaAssertion.js +56 -24
  44. package/lib/dom/type.js +21 -21
  45. package/lib/dom/variable.js +9 -15
  46. package/lib/index.js +3 -1
  47. package/lib/node/hypothesis.js +123 -0
  48. package/lib/node/section.js +116 -0
  49. package/lib/nonTerminalNodeMap.js +5 -3
  50. package/lib/ruleNames.js +9 -1
  51. package/lib/utilities/json.js +59 -59
  52. package/lib/utilities/subproof.js +10 -10
  53. package/lib/verifier/combinator.js +9 -10
  54. package/lib/verifier/constructor.js +10 -11
  55. package/lib/verifier/topLevel.js +38 -31
  56. package/package.json +6 -6
  57. package/src/context/local.js +0 -14
  58. package/src/dom/assertion/property.js +1 -1
  59. package/src/dom/axiom.js +33 -30
  60. package/src/dom/combinator.js +4 -4
  61. package/src/dom/conclusion.js +5 -5
  62. package/src/dom/conjecture.js +8 -8
  63. package/src/dom/constructor.js +4 -4
  64. package/src/dom/declaration/combinator.js +14 -14
  65. package/src/dom/declaration/complexType.js +35 -35
  66. package/src/dom/declaration/constructor.js +20 -20
  67. package/src/dom/declaration/metavariable.js +22 -22
  68. package/src/dom/declaration/simpleType.js +22 -22
  69. package/src/dom/declaration/variable.js +21 -21
  70. package/src/dom/declaration.js +5 -3
  71. package/src/dom/deduction.js +5 -5
  72. package/src/dom/derivation.js +5 -5
  73. package/src/dom/error.js +8 -8
  74. package/src/dom/hypothesis.js +230 -0
  75. package/src/dom/label.js +17 -19
  76. package/src/dom/lemma.js +8 -8
  77. package/src/dom/metaLemma.js +8 -8
  78. package/src/dom/metaType.js +2 -6
  79. package/src/dom/metatheorem.js +8 -8
  80. package/src/dom/metavariable.js +9 -12
  81. package/src/dom/parameter.js +1 -1
  82. package/src/dom/premise.js +8 -8
  83. package/src/dom/procedureCall.js +9 -9
  84. package/src/dom/proof.js +2 -2
  85. package/src/dom/property.js +8 -8
  86. package/src/dom/reference.js +23 -27
  87. package/src/dom/rule.js +74 -46
  88. package/src/dom/section.js +70 -0
  89. package/src/dom/signature.js +4 -4
  90. package/src/dom/statement.js +24 -32
  91. package/src/dom/step.js +10 -8
  92. package/src/dom/subDerivation.js +5 -5
  93. package/src/dom/subproof.js +8 -8
  94. package/src/dom/substitution/statement.js +5 -5
  95. package/src/dom/supposition.js +7 -7
  96. package/src/dom/term.js +3 -8
  97. package/src/dom/theorem.js +7 -7
  98. package/src/dom/topLevelAssertion.js +85 -48
  99. package/src/dom/topLevelMetaAssertion.js +61 -33
  100. package/src/dom/type.js +22 -22
  101. package/src/dom/variable.js +8 -11
  102. package/src/index.js +2 -0
  103. package/src/node/hypothesis.js +23 -0
  104. package/src/node/section.js +16 -0
  105. package/src/nonTerminalNodeMap.js +7 -1
  106. package/src/ruleNames.js +2 -0
  107. package/src/utilities/json.js +58 -58
  108. package/src/utilities/subproof.js +10 -10
  109. package/src/verifier/combinator.js +6 -11
  110. package/src/verifier/constructor.js +9 -12
  111. package/src/verifier/topLevel.js +42 -30
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+
3
+ import dom from "../dom";
4
+
5
+ import { domAssigned } from "../dom";
6
+ import { assignAssignments } from "../utilities/assignments";
7
+ import { subproofAssertionFromStatement } from "../utilities/context";
8
+ import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
9
+
10
+ export default domAssigned(class Hypothesis {
11
+ constructor(string, statement) {
12
+ this.string = string;
13
+ this.statement = statement;
14
+ }
15
+
16
+ getString() {
17
+ return this.string;
18
+ }
19
+
20
+ getStatement() {
21
+ return this.statement;
22
+ }
23
+
24
+ verify(context) {
25
+ let verifies = false;
26
+
27
+ const hypothesisString = this.string; ///
28
+
29
+ context.trace(`Verifying the '${hypothesisString}' hypothesis...`);
30
+
31
+ if (false) {
32
+ ///
33
+ } else if (this.statement !== null) {
34
+ const stated = true,
35
+ assignments = [],
36
+ statementVerifies = this.statement.verify(assignments, stated, context);
37
+
38
+ if (statementVerifies) {
39
+ const assignmentsAssigned = assignAssignments(assignments, context);
40
+
41
+ if (assignmentsAssigned) {
42
+ const { Step } = dom,
43
+ step = Step.fromStatement(this.statement, context),
44
+ stepOrSubproof = step; ///
45
+
46
+ context.addStepOrSubproof(stepOrSubproof);
47
+
48
+ verifies = true;
49
+ }
50
+ }
51
+ } else {
52
+ context.debug(`Unable to verify the '${hypothesisString}' hypothesis because it is nonsense.`);
53
+ }
54
+
55
+ if (verifies) {
56
+ context.debug(`...verified the '${hypothesisString}' hypothesis.`);
57
+ }
58
+
59
+ return verifies;
60
+ }
61
+
62
+ unifyHypothesis(hypothesis, substitutions, generalContext, specificContext) {
63
+ let hypothesisUnifies;
64
+
65
+ const context = specificContext, ///
66
+ specificHypothesis = hypothesis, ///
67
+ generalHypothesisString = this.string, ///
68
+ specificHypothesisString = specificHypothesis.getString();
69
+
70
+ context.trace(`Unifying the '${specificHypothesisString}' hypothesis with the '${generalHypothesisString}' hypothesis...`);
71
+
72
+ const statement = specificHypothesis.getStatement(),
73
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
74
+
75
+ hypothesisUnifies = statementUnifies; ///
76
+
77
+ if (hypothesisUnifies) {
78
+ context.debug(`...unified the '${specificHypothesisString}' hypothesis with the '${generalHypothesisString}' hypothesis.`);
79
+ }
80
+
81
+ return hypothesisUnifies;
82
+ }
83
+
84
+ unifyIndependently(substitutions, context) {
85
+ let unifiesIndependently;
86
+
87
+ if (this.statement !== null) {
88
+ const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, context);
89
+
90
+ unifiesIndependently = statementResolvedIndependently; ///
91
+ }
92
+
93
+ if (this.procedureCall !== null) {
94
+ const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(substitutions, context);
95
+
96
+ unifiesIndependently = procedureCallResolvedIndependently; ///
97
+ }
98
+
99
+ return unifiesIndependently;
100
+ }
101
+
102
+ unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext) {
103
+ let stepOrSubproofUnifies = false;
104
+
105
+ const stepOrSubProofStep = stepOrSubproof.isStep(),
106
+ subproof = stepOrSubProofStep ?
107
+ null :
108
+ stepOrSubproof,
109
+ step = stepOrSubProofStep ?
110
+ stepOrSubproof :
111
+ null;
112
+
113
+ substitutions.snapshot();
114
+
115
+ if (subproof !== null) {
116
+ const subproofUnifies = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
117
+
118
+ stepOrSubproofUnifies = subproofUnifies; ///
119
+ }
120
+
121
+ if (step !== null) {
122
+ const statementUnifies = this.unifyStep(step, substitutions, generalContext, specificContext);
123
+
124
+ stepOrSubproofUnifies = statementUnifies; ///
125
+ }
126
+
127
+ if (stepOrSubproofUnifies) {
128
+ substitutions.resolve(generalContext, specificContext);
129
+ }
130
+
131
+ stepOrSubproofUnifies ?
132
+ substitutions.continue() :
133
+ substitutions.rollback(specificContext);
134
+
135
+ return stepOrSubproofUnifies;
136
+ }
137
+
138
+ unifyStep(step, substitutions, generalContext, specificContext) {
139
+ let stepUnifies;
140
+
141
+ const statement = step.getStatement(),
142
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
143
+
144
+ stepUnifies = statementUnifies; ///
145
+
146
+ return stepUnifies;
147
+ }
148
+
149
+ unifySubproof(subproof, substitutions, generalContext, specificContext) {
150
+ let subproofUnifies = false;
151
+
152
+ const hypothesis = this, ///
153
+ subproofString = subproof.getString(),
154
+ hypothesisStatement = hypothesis.getStatement(),
155
+ hypothesisStatementString = hypothesisStatement.getString();
156
+
157
+ specificContext.trace(`Unifying the '${subproofString}' subproof with the hypothesis's '${hypothesisStatementString}' statement...`);
158
+
159
+ if (this.statement !== null) {
160
+ const context = generalContext, ///
161
+ subproofAssertion = subproofAssertionFromStatement(this.statement, context);
162
+
163
+ if (subproofAssertion !== null) {
164
+ subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
165
+ }
166
+ }
167
+
168
+ if (subproofUnifies) {
169
+ specificContext.debug(`...unified the '${subproofString}' subproof with the hypothesis's '${hypothesisStatementString}' statement.`);
170
+ }
171
+
172
+ return subproofUnifies;
173
+ }
174
+
175
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
176
+ let statementUnifies;
177
+
178
+ const hypothesis = this, ///
179
+ statementString = statement.getString(),
180
+ hypothesisString = hypothesis.getString();
181
+
182
+ specificContext.trace(`Unifying the '${statementString}' statement with the '${hypothesisString}' hypothesis...`);
183
+
184
+ if (this.statement !== null) {
185
+ statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
186
+ }
187
+
188
+ if (statementUnifies) {
189
+ specificContext.debug(`...unified the '${statementString}' statement with the '${hypothesisString}' hypothesis.`);
190
+ }
191
+
192
+ return statementUnifies;
193
+ }
194
+
195
+ toJSON() {
196
+ const statementJSON = statementToStatementJSON(this.statement),
197
+ statement = statementJSON, ///
198
+ json = {
199
+ statement
200
+ };
201
+
202
+ return json;
203
+ }
204
+
205
+ static name = "Hypothesis";
206
+
207
+ static fromJSON(json, context) {
208
+ const statement = statementFromJSON(json, context);
209
+
210
+ let string;
211
+
212
+ if (statement !== null) {
213
+ string = statement.getString();
214
+ }
215
+
216
+ const hypothesis = new Hypothesis(string, statement);
217
+
218
+ return hypothesis;
219
+ }
220
+
221
+ static fromHypothesisNode(hypothesisNode, context) {
222
+ const { Statement } = dom,
223
+ node = hypothesisNode, ///
224
+ string = context.nodeAsString(node),
225
+ statement = Statement.fromHypothesisNode(hypothesisNode, context),
226
+ hypothesis = new Hypothesis(string, statement);
227
+
228
+ return hypothesis
229
+ }
230
+ });
package/src/dom/label.js CHANGED
@@ -1,23 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  import dom from "../dom";
4
- import LocalContext from "../context/local";
5
4
 
6
5
  import { domAssigned } from "../dom";
7
6
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
8
7
 
9
8
  export default domAssigned(class Label {
10
- constructor(metavariable, fileContext) {
9
+ constructor(context, metavariable) {
10
+ this.context = context;
11
11
  this.metavariable = metavariable;
12
- this.fileContext = fileContext;
13
12
  }
14
13
 
15
- getMetavariable() {
16
- return this.metavariable;
14
+ getContext() {
15
+ return this.context;
17
16
  }
18
17
 
19
- getFileContext() {
20
- return this.fileContext;
18
+ getMetavariable() {
19
+ return this.metavariable;
21
20
  }
22
21
 
23
22
  getString() { return this.metavariable.getString(); }
@@ -56,28 +55,28 @@ export default domAssigned(class Label {
56
55
 
57
56
  const labelString = this.getString(); ///
58
57
 
59
- this.fileContext.trace(`Verifying the '${labelString}' label...`);
58
+ this.context.trace(`Verifying the '${labelString}' label...`);
60
59
 
61
60
  let labelPresent;
62
61
 
63
62
  if (nameOnly) {
64
63
  const metavariableName = this.getMetavariableName();
65
64
 
66
- labelPresent = this.fileContext.isLabelPresentByMetavariableName(metavariableName);
65
+ labelPresent = this.context.isLabelPresentByMetavariableName(metavariableName);
67
66
  } else {
68
67
  const metavariable = this.getMetavariable();
69
68
 
70
- labelPresent = this.fileContext.isLabelPresentByMetavariable(metavariable);
69
+ labelPresent = this.context.isLabelPresentByMetavariable(metavariable);
71
70
  }
72
71
 
73
72
  if (labelPresent) {
74
- this.fileContext.debug(`The '${labelString}' label is already present.`);
73
+ this.context.debug(`The '${labelString}' label is already present.`);
75
74
  } else {
76
75
  verifies = true;
77
76
  }
78
77
 
79
78
  if (verifies) {
80
- this.fileContext.debug(`...verified the '${labelString}' label.`);
79
+ this.context.debug(`...verified the '${labelString}' label.`);
81
80
  }
82
81
 
83
82
  return verifies;
@@ -95,18 +94,17 @@ export default domAssigned(class Label {
95
94
 
96
95
  static name = "Label";
97
96
 
98
- static fromJSON(json, fileContext) {
99
- const metavariable = metavariableFromJSON(json, fileContext),
100
- label = new Label(metavariable, fileContext);
97
+ static fromJSON(json, context) {
98
+ const metavariable = metavariableFromJSON(json, context),
99
+ label = new Label(context, metavariable);
101
100
 
102
101
  return label;
103
102
  }
104
103
 
105
- static fromLabelNode(labelNode, fileContext) {
104
+ static fromLabelNode(labelNode, context) {
106
105
  const { Metavariable } = dom,
107
- localContext = LocalContext.fromFileContext(fileContext),
108
- metavariable = Metavariable.fromLabelNode(labelNode, localContext),
109
- label = new Label(metavariable, fileContext);
106
+ metavariable = Metavariable.fromLabelNode(labelNode, context),
107
+ label = new Label(context, metavariable);
110
108
 
111
109
  return label;
112
110
  }
package/src/dom/lemma.js CHANGED
@@ -9,23 +9,23 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
9
9
  let verifies;
10
10
 
11
11
  const lemma = this, ///
12
- fileContext = this.getFileContext(),
12
+ context = this.getContext(),
13
13
  lemmaString = lemma.getString();
14
14
 
15
15
  (lemmaString === null) ?
16
- fileContext.trace(`Verifying a lemma...`) :
17
- fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
16
+ context.trace(`Verifying a lemma...`) :
17
+ context.trace(`Verifying the '${lemmaString}' lemma...`);
18
18
 
19
19
  verifies = super.verify();
20
20
 
21
21
  if (verifies) {
22
22
  const lemma = this; ///
23
23
 
24
- fileContext.addLemma(lemma);
24
+ context.addLemma(lemma);
25
25
 
26
26
  (lemmaString === null) ?
27
- fileContext.debug(`...verified a lemma.`) :
28
- fileContext.debug(`...verified the '${lemmaString}' lemma.`);
27
+ context.debug(`...verified a lemma.`) :
28
+ context.debug(`...verified the '${lemmaString}' lemma.`);
29
29
  }
30
30
 
31
31
  return verifies;
@@ -33,9 +33,9 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
33
33
 
34
34
  static name = "Lemma";
35
35
 
36
- static fromLemmaNode(lemmaNode, fileContext) {
36
+ static fromLemmaNode(lemmaNode, context) {
37
37
  const node = lemmaNode, ///
38
- lemma = TopLevelAssertion.fromNode(Lemma, node, fileContext);
38
+ lemma = TopLevelAssertion.fromNode(Lemma, node, context);
39
39
 
40
40
  return lemma;
41
41
  }
@@ -8,20 +8,20 @@ export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
11
- const metaLemma = this, ///
12
- fileContext = this.getFileContext(),
11
+ const context = this.getContext(),
12
+ metaLemma = this, ///
13
13
  metaLemmaString = metaLemma.getString();
14
14
 
15
- fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
15
+ context.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
16
16
 
17
17
  verifies = super.verify();
18
18
 
19
19
  if (verifies) {
20
20
  const metaTheorem = this; ///
21
21
 
22
- fileContext.addMetatheorem(metaTheorem);
22
+ context.addMetatheorem(metaTheorem);
23
23
 
24
- fileContext.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
24
+ context.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
25
25
  }
26
26
 
27
27
  return verifies;
@@ -29,11 +29,11 @@ export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
29
29
 
30
30
  static name = "MetaLemma";
31
31
 
32
- static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, fileContext); }
32
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
33
33
 
34
- static fromMetaLemmaNode(metaLemmaNode, fileContext) {
34
+ static fromMetaLemmaNode(metaLemmaNode, context) {
35
35
  const node = metaLemmaNode, ///
36
- metaLemma = TopLevelMetaAssertion.fromNode(MetaLemma, node, fileContext);
36
+ metaLemma = TopLevelMetaAssertion.fromNode(MetaLemma, node, context);
37
37
 
38
38
  return metaLemma;
39
39
  }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import LocalContext from "../context/local";
4
-
5
3
  import { domAssigned } from "../dom";
6
4
  import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
7
5
 
@@ -43,7 +41,7 @@ class MetaType {
43
41
 
44
42
  static name = "MetaType";
45
43
 
46
- static fromJSON(json, fileContext) {
44
+ static fromJSON(json, context) {
47
45
  const { name } = json,
48
46
  metaTypeName = name, ///
49
47
  metaType = metaTypeFromMetaTypeName(metaTypeName);
@@ -57,10 +55,8 @@ class MetaType {
57
55
  return metaType;
58
56
  }
59
57
 
60
- static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
58
+ static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
61
59
  const metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
62
- localContext = LocalContext.fromFileContext(fileContext),
63
- context = localContext, ///
64
60
  metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
65
61
 
66
62
  return metaType;
@@ -8,20 +8,20 @@ export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
11
- const metaLemma = this, ///
12
- fileContext = this.getFileContext(),
11
+ const context = this.getContext(),
12
+ metaLemma = this, ///
13
13
  metaLemmaString = metaLemma.getString();
14
14
 
15
- fileContext.trace(`Verifying the '${metaLemmaString}' metatheorem...`);
15
+ context.trace(`Verifying the '${metaLemmaString}' metatheorem...`);
16
16
 
17
17
  verifies = super.verify();
18
18
 
19
19
  if (verifies) {
20
20
  const metaTheorem = this; ///
21
21
 
22
- fileContext.addMetatheorem(metaTheorem);
22
+ context.addMetatheorem(metaTheorem);
23
23
 
24
- fileContext.debug(`...verified the '${metaLemmaString}' metatheorem.`);
24
+ context.debug(`...verified the '${metaLemmaString}' metatheorem.`);
25
25
  }
26
26
 
27
27
  return verifies;
@@ -29,11 +29,11 @@ export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
29
29
 
30
30
  static name = "Metatheorem";
31
31
 
32
- static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, fileContext); }
32
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
33
33
 
34
- static fromMetatheoremNode(metatheoremNode, fileContext) {
34
+ static fromMetatheoremNode(metatheoremNode, context) {
35
35
  const node = metatheoremNode, ///
36
- metatheorem = TopLevelMetaAssertion.fromNode(Metatheorem, node, fileContext);
36
+ metatheorem = TopLevelMetaAssertion.fromNode(Metatheorem, node, context);
37
37
 
38
38
  return metatheorem;
39
39
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import dom from "../dom";
4
- import LocalContext from "../context/local";
5
4
  import MetavariablePartialContext from "../context/partial/metavariable";
6
5
 
7
6
  import { domAssigned } from "../dom";
@@ -442,10 +441,10 @@ export default domAssigned(class Metavariable {
442
441
 
443
442
  static name = "Metavariable";
444
443
 
445
- static fromJSON(json, fileContext) {
444
+ static fromJSON(json, context) {
446
445
  const { string } = json,
447
- lexer = fileContext.getLexer(),
448
- parser = fileContext.getParser(),
446
+ lexer = context.getLexer(),
447
+ parser = context.getParser(),
449
448
  metavariablePartialContext = MetavariablePartialContext.fromStringLexerAndParser(string, lexer, parser),
450
449
  metavariableTokens = metavariablePartialContext.getMetavariableTokens(),
451
450
  metavariableNode = metavariablePartialContext.getMetavariableNode(),
@@ -453,8 +452,8 @@ export default domAssigned(class Metavariable {
453
452
  name = metavariableName, ///
454
453
  node = metavariableNode, ///
455
454
  tokens = metavariableTokens, ///
456
- type = typeFromJSON(json, fileContext),
457
- metaType = metaTypeFromJSON(json, fileContext),
455
+ type = typeFromJSON(json, context),
456
+ metaType = metaTypeFromJSON(json, context),
458
457
  metavariable = new Metavariable(string, node, tokens, name, type, metaType);
459
458
 
460
459
  return metavariable;
@@ -510,12 +509,10 @@ export default domAssigned(class Metavariable {
510
509
  return metavariable;
511
510
  }
512
511
 
513
- static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
512
+ static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
514
513
  const { MetaType } = dom,
515
514
  metavariableNode = metavariableDeclarationNode.getMetavariableNode(),
516
- localContext = LocalContext.fromFileContext(fileContext),
517
- context = localContext, ///
518
- type = typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
515
+ type = typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
519
516
  metaType = MetaType.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
520
517
  metavariable = metavariableFromMetavariableNode(metavariableNode, context);
521
518
 
@@ -541,7 +538,7 @@ function metavariableFromMetavariableNode(metavariableNode, context) {
541
538
  return metavariable;
542
539
  }
543
540
 
544
- function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
541
+ function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
545
542
  let type = null;
546
543
 
547
544
  const typeNode = metavariableDeclarationNode.getTypeNode();
@@ -549,7 +546,7 @@ function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileCo
549
546
  if (typeNode !== null) {
550
547
  const typeName = typeNode.getTypeName();
551
548
 
552
- type = fileContext.findTypeByTypeName(typeName);
549
+ type = context.findTypeByTypeName(typeName);
553
550
  }
554
551
 
555
552
  return type;
@@ -46,7 +46,7 @@ export default domAssigned(class Parameter {
46
46
 
47
47
  static name = "Parameter";
48
48
 
49
- static fromJSON(json, fileContext) {
49
+ static fromJSON(json, context) {
50
50
  const { name } = json,
51
51
  parameter = new Parameter(name);
52
52
 
@@ -200,9 +200,9 @@ export default domAssigned(class Premise {
200
200
 
201
201
  static name = "Premise";
202
202
 
203
- static fromJSON(json, fileContext) {
204
- const statement = statementFromJSON(json, fileContext),
205
- procedureCall = procedureCallFromJSON(json, fileContext);
203
+ static fromJSON(json, context) {
204
+ const statement = statementFromJSON(json, context),
205
+ procedureCall = procedureCallFromJSON(json, context);
206
206
 
207
207
  let string;
208
208
 
@@ -219,12 +219,12 @@ export default domAssigned(class Premise {
219
219
  return premise;
220
220
  }
221
221
 
222
- static fromPremiseNode(premiseNode, fileContext) {
222
+ static fromPremiseNode(premiseNode, context) {
223
223
  const { Statement, ProcedureCall } = dom,
224
- node = premiseNode,
225
- string = fileContext.nodeAsString(node),
226
- statement = Statement.fromPremiseNode(premiseNode, fileContext),
227
- procedureCall = ProcedureCall.fromPremiseNode(premiseNode, fileContext),
224
+ node = premiseNode, ///
225
+ string = context.nodeAsString(node),
226
+ statement = Statement.fromPremiseNode(premiseNode, context),
227
+ procedureCall = ProcedureCall.fromPremiseNode(premiseNode, context),
228
228
  premise = new Premise(string, statement, procedureCall);
229
229
 
230
230
  return premise
@@ -76,16 +76,16 @@ export default domAssigned(class ProcedureCall {
76
76
  nodes = this.findNodes(substitutions),
77
77
  expressions = Expressions.fromNodes(nodes, context);
78
78
 
79
- try {
79
+ // try {
80
80
  const value = procedure.call(expressions, context),
81
81
  boolean = value.getBoolean();
82
82
 
83
83
  unifiesIndependently = boolean; ///
84
- } catch (exception) {
85
- const message = exception.getMessage();
86
-
87
- context.info(message);
88
- }
84
+ // } catch (exception) {
85
+ // const message = exception.getMessage();
86
+ //
87
+ // context.info(message);
88
+ // }
89
89
 
90
90
  if (unifiesIndependently) {
91
91
  context.debug(`...unified the '${procedureCallString}' procedure call independently.`);
@@ -109,9 +109,9 @@ export default domAssigned(class ProcedureCall {
109
109
 
110
110
  static name = "ProcedureCall";
111
111
 
112
- static fromJSON(json, fileContext) {
113
- const reference = referenceFromJSON(json, fileContext),
114
- parameters = parametersFromJSON(json, fileContext),
112
+ static fromJSON(json, context) {
113
+ const reference = referenceFromJSON(json, context),
114
+ parameters = parametersFromJSON(json, context),
115
115
  string = stringFromReferenceAndParameters(reference, parameters),
116
116
  procedureCall = new ProcedureCall(string, reference, parameters);
117
117
 
package/src/dom/proof.js CHANGED
@@ -52,13 +52,13 @@ export default domAssigned(class Proof {
52
52
 
53
53
  static name = "Proof";
54
54
 
55
- static fromProofNode(proofNode, fileContext) {
55
+ static fromProofNode(proofNode, context) {
56
56
  let proof = null;
57
57
 
58
58
  if (proofNode !== null) {
59
59
  const { Derivation } = dom,
60
60
  derivationNode = proofNode.getDerivationNode(),
61
- derivation = Derivation.fromDerivationNode(derivationNode, fileContext);
61
+ derivation = Derivation.fromDerivationNode(derivationNode, context);
62
62
 
63
63
  proof = new Proof(derivation);
64
64
  }
@@ -50,29 +50,29 @@ export default domAssigned(class Property {
50
50
 
51
51
  static name = "Property";
52
52
 
53
- static fromJSON(json, fileContext) {
53
+ static fromJSON(json, context) {
54
54
  const { name } = json,
55
- type = typeFromJSON(json, fileContext),
55
+ type = typeFromJSON(json, context),
56
56
  string = name, ///
57
57
  property = new Property(string, name, type);
58
58
 
59
59
  return property;
60
60
  }
61
61
 
62
- static fromPropertyNode(propertyNode, fileContext) {
63
- const property = propertyFromPropertyNode(propertyNode, fileContext)
62
+ static fromPropertyNode(propertyNode, context) {
63
+ const property = propertyFromPropertyNode(propertyNode, context)
64
64
 
65
65
  return property;
66
66
  }
67
67
 
68
- static fromPropertyRelationNode(propertyRelationNode, fileContext) {
68
+ static fromPropertyRelationNode(propertyRelationNode, context) {
69
69
  const propertyNode = propertyRelationNode.getPropertyNode(),
70
- property = propertyFromPropertyNode(propertyNode, fileContext);
70
+ property = propertyFromPropertyNode(propertyNode, context);
71
71
 
72
72
  return property;
73
73
  }
74
74
 
75
- static fromPropertyDeclarationNode(propertyDeclarationNode, fileContext) {
75
+ static fromPropertyDeclarationNode(propertyDeclarationNode, context) {
76
76
  const { Type } = dom,
77
77
  type = Type.fromPropertyDeclarationNode(propertyDeclarationNode),
78
78
  propertyName = propertyDeclarationNode.getPropertyName(),
@@ -84,7 +84,7 @@ export default domAssigned(class Property {
84
84
  }
85
85
  });
86
86
 
87
- function propertyFromPropertyNode(propertyNode, fileContext) {
87
+ function propertyFromPropertyNode(propertyNode, context) {
88
88
  const { Property } = dom,
89
89
  propertyName = propertyNode.getPropertyName(),
90
90
  name = propertyName, ///